@substrate-system/kebab-case
    Preparing search index...

    @substrate-system/kebab-case

    kebab case

    tests types module semantic versioning Common Changelog install size dependencies license

    Kebab case a string.

    import { kebabCase } from '@substrate-system/kebab-case'

    kebabCase('the quick brown fox'); // 'the-quick-brown-fox'
    kebabCase('the-quick-brown-fox'); // 'the-quick-brown-fox'
    kebabCase('the_quick_brown_fox'); // 'the-quick-brown-fox'
    kebabCase('theQuickBrownFox'); // 'the-quick-brown-fox'
    kebabCase('theQuickBrown Fox'); // 'the-quick-brown-fox'
    kebabCase('thequickbrownfox'); // 'thequickbrownfox'
    kebabCase('the - quick * brown# fox'); // 'the-quick-brown-fox'
    kebabCase('theQUICKBrownFox'); // 'the-quick-brown-fox'

    Contents

    npm i -S @substrate-system/kebab-case
    

    This exposes ESM and common JS via package.json exports field.

    import { kebabCase } from '@substrate-system/kebab-case'
    
    const { kebabCase } = require('@substrate-system/kebab-case')
    

    This package exposes minified JS files too. Copy them to a location that is accessible to your web server, then link to them in HTML.

    cp ./node_modules/@substrate-system/kebab-case/dist/module.min.js ./public
    
    <script type="module" src="./module.min.js"></script>
    

    Take a string in any format, return a URL-safe kebab case string.

    import { kebabCase } from '@substrate-system/kebab-case'

    kebabCase('the quick brown fox'); // 'the-quick-brown-fox'
    kebabCase('the-quick-brown-fox'); // 'the-quick-brown-fox'
    kebabCase('the_quick_brown_fox'); // 'the-quick-brown-fox'
    kebabCase('theQuickBrownFox'); // 'the-quick-brown-fox'
    kebabCase('theQuickBrown Fox'); // 'the-quick-brown-fox'
    kebabCase('thequickbrownfox'); // 'thequickbrownfox'
    kebabCase('the - quick * brown# fox'); // 'the-quick-brown-fox'
    kebabCase('theQUICKBrownFox'); // 'the-quick-brown-fox'