to-camel-case
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "to-camel-case", | ||
"repo": "Nami-Doc/to-camel-case", | ||
"description": "Converts a string to camelCase", | ||
"version": "0.2.0", | ||
"keywords": [], | ||
"dependencies": {}, | ||
"development": {}, | ||
"repo": "ianstormtaylor/to-camel-case", | ||
"license": "MIT", | ||
"scripts": [ | ||
"index.js" | ||
] | ||
} | ||
"version": "0.2.1", | ||
"description": "Convert a string to a camel case.", | ||
"keywords": ["camel", "case", "camelcase", "string"], | ||
"dependencies": { | ||
"ianstormtaylor/to-space-case": "0.1.2" | ||
}, | ||
"development": { | ||
"component/assert": "*" | ||
}, | ||
"scripts": ["index.js"] | ||
} |
@@ -1,9 +0,19 @@ | ||
0.2.0 / 2013-04-06 | ||
================== | ||
0.2.1 - October 3, 2013 | ||
----------------------- | ||
* published to npm, thanks [@Nami-Doc](https://github.com/Nami-Doc)! | ||
Add `first` option for PascalCase | ||
0.1.2 - October 1, 2013 | ||
----------------------- | ||
* updated `to-space-case` | ||
0.1.0 / 2013-04-02 | ||
================== | ||
0.1.1 - September 18, 2013 | ||
-------------------------- | ||
* updated `to-space-case` | ||
First version | ||
0.1.0 - September 18, 2013 | ||
-------------------------- | ||
* updated `to-space-case` | ||
0.0.1 - September 18, 2013 | ||
-------------------------- | ||
:sparkles: |
28
index.js
@@ -0,16 +1,24 @@ | ||
var toSpace = require('to-space-case'); | ||
/** | ||
* Convert a string to camel case | ||
* Expose `toCamelCase`. | ||
*/ | ||
module.exports = toCamelCase; | ||
/** | ||
* Convert a `string` to camel case. | ||
* | ||
* @param {String} str | ||
* @param {Boolean} first upper-case first too ? (PascalCase) | ||
* @param {String} string | ||
* @return {String} | ||
*/ | ||
module.exports = function (str, first) { | ||
str = str.replace(/[_-]([a-z])/g, function (l) { | ||
return l[1].toUpperCase() | ||
}) | ||
if (first) | ||
str = str.charAt(0).toUpperCase() + str.slice(1) | ||
return str | ||
function toCamelCase (string) { | ||
return toSpace(string).replace(/\s(\w)/g, function (matches, letter) { | ||
return letter.toUpperCase(); | ||
}); | ||
} |
{ | ||
"name": "to-camel-case", | ||
"repo": "Nami-Doc/to-camel-case", | ||
"version": "0.2.0", | ||
"keywords": ["camel-case", "camelCase", "string", "case"], | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*" | ||
}, | ||
"component": { | ||
"scripts": { | ||
"max": "index.js" | ||
} | ||
"repository": "git://github.com/ianstormtaylor/to-camel-case.git", | ||
"license": "MIT", | ||
"version": "0.2.1", | ||
"description": "Convert a string to camel case.", | ||
"keywords": ["camel", "case", "camelcase", "string"], | ||
"dependencies": { | ||
"to-space-case": "0.1.2" | ||
} | ||
} | ||
} |
@@ -1,26 +0,31 @@ | ||
# to-camel-case | ||
Converts a string to camelCase | ||
Convert a string to a camel case. | ||
## Installation | ||
$ component install Nami-Doc/to-camel-case | ||
$ component install ianstormtaylor/to-camel-case | ||
$ npm install to-camel-case | ||
## API | ||
_Big thanks to [@Nami-Doc](https://github.com/Nami-Doc) for graciously giving up the npm package name :)_ | ||
### toCamelCase(string, first = false) | ||
## Example | ||
```js | ||
toCamelCase("hello-ya").should.equal("helloYa") | ||
var camel = require('to-camel-case'); | ||
toCamelCase("chocolate-rain").should.equal("chocolateRain") | ||
toCamelCase("hello-howare-ya", true).should.equal("HelloHowareYa") | ||
camel('space case'); // "spaceCase" | ||
camel('snake_case'); // "snakeCase" | ||
camel('dot.case'); // "dotCase" | ||
camel('weird[case'); // "weirdCase" | ||
``` | ||
## API | ||
### toCamelCase(string) | ||
Returns the camel-case variant of a `string`. | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
117798
0
11
0
4600
32
1
8
2
+ Addedto-space-case@0.1.2
+ Addedto-no-case@0.1.1(transitive)
+ Addedto-space-case@0.1.2(transitive)