Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

just-kebab-case

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-kebab-case - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

index.d.ts

16

index.js

@@ -11,3 +11,3 @@ module.exports = kebabCase;

kebabCase('the - quick * brown# fox'); // 'the-quick-brown-fox'
kebabCase('theQUICKBrownFox'); // 'the-q-u-i-c-k-brown-fox'
kebabCase('theQUICKBrownFox'); // 'the-quick-brown-fox'
*/

@@ -18,8 +18,16 @@

var wordSeparators = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/;
var capitals = /[A-Z\u00C0-\u00D6\u00D9-\u00DD]/g;
var capital_plus_lower = /[A-ZÀ-Ý\u00C0-\u00D6\u00D9-\u00DD][a-zà-ÿ]/g;
var capitals = /[A-ZÀ-Ý\u00C0-\u00D6\u00D9-\u00DD]+/g;
function kebabCase(str) {
//replace capitals with space + lower case equivalent for later parsing
// replace word starts with space + lower case equivalent for later parsing
// 1) treat cap + lower as start of new word
str = str.replace(capital_plus_lower, function(match) {
// match is one caps followed by one non-cap
return ' ' + (match[0].toLowerCase() || match[0]) + match[1];
});
// 2) treat all remaining capitals as words
str = str.replace(capitals, function(match) {
return ' ' + (match.toLowerCase() || match);
// match is a series of caps
return ' ' + match.toLowerCase();
});

@@ -26,0 +34,0 @@ return str

{
"name": "just-kebab-case",
"version": "1.1.0",
"version": "2.0.0",
"description": "convert a string to kebab case",
"main": "index.js",
"types": "index.d.ts",
"scripts": {

@@ -22,2 +23,2 @@ "test": "echo \"Error: no test specified\" && exit 1"

}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc