@jf/cc2sep

    2.0.0 • Public • Published

    @jf/cc2sep stable

    npm install @jf/cc2sep

    Transform a camelized string into a lowercased one using a custom separator and accepting unicode uppercase chars.

    You can modify regexp property for customizing the text transformations in your application.

    Arguments

    • text: Text to convert.
    • separator: Separator to use between words (- by defatul).
    • trim: true if you want to remove separators beginning or ending text (true by default).

    Examples

    cc2sep(text)

    'onceuponatime'    => 'onceuponatime'
    'onceUponATime'    => 'once-upon-a-time'
    'OnceUponATime'    => 'once-upon-a-time'
    'ONCE UPON A TIME' => 'o-n-c-e u-p-o-n a t-i-m-e'
    'once-upon-a-time' => 'once-upon-a-time'
    'innerHTML'        => 'inner-h-t-m-l'
    'ÁáááÉéééÍíÓóó'    => 'áááá-éééé-íí-óóó'
    

    cc2sep(text, '-', false)

    'OnceUponATime'    -> '-once-upon-a-time'
    'ONCE UPON A TIME' -> '-o-n-c-e -u-p-o-n -a -t-i-m-e'
    'ÁáááÉéééÍíÓóó'    -> '-áááá-éééé-íí-óóó'
    

    Install

    npm i @jf/cc2sep

    DownloadsWeekly Downloads

    26

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    5.17 kB

    Total Files

    4

    Last publish

    Collaborators

    • jf