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

change-case

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

change-case - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

16

index.js

@@ -10,2 +10,4 @@ var acceptString = function (fn) {

var insignificant = exports.insignificantWords = ['and'];
var lowerCase = exports.lowerCase = exports.lower = acceptString(function (str) {

@@ -25,4 +27,3 @@ return str.toLowerCase();

return splitWords(str).map(function (word) {
word = lowerCase(word);
if (!isSignificant && (word.length < 3 || ~['and'].indexOf(word))) {
if (!isSignificant && (word.length < 3 || ~insignificant.indexOf(word))) {
return word;

@@ -62,1 +63,12 @@ }

});
exports.switchCase = exports.switch = acceptString(function (str) {
var char;
for (var i = 0; i < str.length; i++) {
char = str.charAt(i);
str = str.substr(0, i) + (char === upperCase(char) ? lowerCase(char) : upperCase(char)) + str.substr(i + 1);
}
return str;
});

2

package.json
{
"name": "change-case",
"version": "0.0.1",
"version": "0.0.2",
"description": "Convert strings between camelCase, PascalCase, Title Case, snake_case, etc",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,11 +17,12 @@ # Change Case

* `changeCase.upperCase(string)`
* `changeCase.lowerCase(string)`
* `changeCase.titleCase(string [, ignoreInsignificantWords])`
* `changeCase.camelCase(string)`
* `changeCase.snakeCase(string)`
* `changeCase.paramCase(string)`
* `changeCase.dotCase(string)`
* `changeCase.pathCase(string)`
* `changeCase.constantCase(string)`
* changeCase.upperCase(string)
* changeCase.lowerCase(string)
* changeCase.titleCase(string [, ignoreInsignificantWords])
* changeCase.camelCase(string)
* changeCase.snakeCase(string)
* changeCase.paramCase(string)
* changeCase.dotCase(string)
* changeCase.pathCase(string)
* changeCase.constantCase(string)
* changeCase.switchCase(string)

@@ -39,2 +40,3 @@ ```javascript

changeCase.constantCase('test string') // "TEST_STRING"
changeCase.switchCase('TeST stRInG') // "tEst STriNg"
```

@@ -41,0 +43,0 @@

@@ -68,2 +68,7 @@ /* global describe, it */

});
it('should switch the cases', function () {
assert.equal(changeCase.switchCase('RaNdOMcasE'), 'rAnDomCASe');
assert.equal(changeCase.switchCase('mIX It.Down?'), 'Mix iT.dOWN?');
});
});
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