Version: v0.5.1 - Beta.  We welcome contributors & feedback.  THanks!

String.toTokenCase

toTokenCase(delimiter = '-')

Description

Convert to a lower case token, where words are joined by delimiter.

A word is any substring that starts with an upper-case character (e.g. in “camelCase”), or is separated by non-alphanumber characters (spaces, punctutation, etc).

'list of posts'.toTokenCase();
//= 'list-of-posts'

'listOfPosts'.toTokenCase();
//= 'list-of-posts'

'list of posts'.toTokenCase('_');
//= 'list_of_posts'

See Also