Complexity Score
Low
Open Issues
0
Dependent Projects
148
Weekly Downloadsglobal
385,499
License
- MIT
- Yesattribution
- Permissivelinking
- Permissivedistribution
- Permissivemodification
- Nopatent grant
- Yesprivate use
- Permissivesublicensing
- Notrademark grant
Downloads
Readme
kebab-case
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
import kebabCase from "kebab-case";
kebabCase("WebkitTransform");
// "-webkit-transform"
kebabCase.reverse("-webkit-transform");
// "WebkitTransform"
kebabCase("WebkitTransform", false);
// "webkit-transform"
API
kebabCase(str)
Name
Type
Description
str
String
The string to convert
keepLeadingDash
Boolean
Whether to keep the leading dash or not. Default is true
.
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
Dependencies
No runtime dependency information found for this package.
CVE IssuesActive
0
Scorecards Score
3.70
Test Coverage
No Data
Follows Semver
Yes
Github Stars
23
Dependenciestotal
4
DependenciesOutdated
0
DependenciesDeprecated
0
Threat Modelling
No
Repo Audits
No
Learn how to distribute kebab-case in your own private NPM registry
$npm config set registry
https://npm.cloudsmith.com/owner/repo
/Processing...
✓Done
$npm install kebab-case
/Processing...
✓Done
5 Releases
NPM on Cloudsmith