Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
Dailin 415ba84223 pre0115 3 år sedan
..
.editorconfig pre0115 3 år sedan
.npmignore pre0115 3 år sedan
.travis.yml pre0115 3 år sedan
README.md pre0115 3 år sedan
index.js pre0115 3 år sedan
package.json pre0115 3 år sedan
test.js pre0115 3 år sedan

README.md

kebab-case

Build status NPM version XO code style

Convert a string to kebab-case, i.e. its dash separated form

The difference between kebab-case and e.g. dashify is that this module doesn't modify the string in any other way than transforming uppercased letters to their lowercased counterparts prefixed with -. Thanks to this there's also a reverse function to do the opposite, i.e. get back the original value.

This is used in Unistyle to transform JavaScript CSS properties to their CSS counterparts without losing a possible browser prefix, e.g: WebkitTransform -> -webkit-transform.

Installation

Install kebab-case using npm:

npm install --save kebab-case

Usage

Module usage

var kebabCase = require('kebab-case');

kebabCase('WebkitTransform');
// "-webkit-transform"
kebabCase.reverse('-webkit-transform');
// "WebkitTransform"

API

kebabCase(str)

Name Type Description
str String The string to convert

Returns: String, the kebab cased string.

kebabCase.reverse(str)

Name Type Description
str String The string to convert back

Returns: String, the "unkebab cased" string.

License

MIT © Joakim Carlstein