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

to-camel-case

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-camel-case - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

test/index.html

22

component.json
{
"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:

@@ -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

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