Skip to content

substrate-system/kebab-case

Repository files navigation

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

install

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

API

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

ESM

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

Common JS

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

pre-built JS

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.

copy

cp ./node_modules/@substrate-system/kebab-case/dist/module.min.js ./public

HTML

<script type="module" src="./module.min.js"></script>

use

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

example

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'

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •