Converts one string into snake_case.
Handles lowerCamelCase, UpperCamelCase and space-separated text, as well as acronyms such as REST API and runs of consecutive uppercase letters.
REST API
The Name suffix separates this from toSnakeCase in object_notation_utils.ts, which converts the keys of an object and takes a different argument.
Name
toSnakeCase
object_notation_utils.ts
The input string.
The snake_case form of text.
text
toSnakeCaseName('camelCase'); // 'camel_case'toSnakeCaseName('UpperCamelCase'); // 'upper_camel_case'toSnakeCaseName('REST API'); // 'rest_api' Copy
toSnakeCaseName('camelCase'); // 'camel_case'toSnakeCaseName('UpperCamelCase'); // 'upper_camel_case'toSnakeCaseName('REST API'); // 'rest_api'
Converts one string into snake_case.
Handles lowerCamelCase, UpperCamelCase and space-separated text, as well as acronyms such as
REST APIand runs of consecutive uppercase letters.The
Namesuffix separates this fromtoSnakeCaseinobject_notation_utils.ts, which converts the keys of an object and takes a different argument.