vanillajs-helpers

Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS

View the Project on GitHub Tokimon/vanillajs-helpers

vanillajs-helpers > “snakeCase”

External module: “snakeCase”

Index

Functions


Functions

snakeCase

snakeCase(str: string, settings?: PhrasifySettings): string

Defined in snakeCase.ts:19

Transform phrase into a snake_case phrase (eg. ‘camelCase’ -> ‘camel-case’ or ‘spaced phrase’ -> ‘spaced-phrase’)

snakeCase('Convert This phrase'); // -> convert_this_phrase
snakeCase('dash VERSION1 beta', { numbers: true }); // -> dash_version_1_beta

Parameters:

Param Type Description
str string String to transform
settings PhrasifySettings Settings to pass to the phrasify function

Returns: string