Socket
Socket
Sign inDemoInstall

camelcase

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 2.0.0

6

index.js

@@ -13,3 +13,7 @@ 'use strict';

if (str.length === 1 || !(/[_.\- ]+/).test(str) ) {
if (str.length === 1) {
return str;
}
if (!(/[_.\- ]+/).test(str)) {
if (str[0] === str[0].toLowerCase() && str.slice(1) !== str.slice(1).toLowerCase()) {

@@ -16,0 +20,0 @@ return str;

7

package.json
{
"name": "camelcase",
"version": "1.2.1",
"version": "2.0.0",
"description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "node test.js"
"test": "xo && ava"
},

@@ -37,4 +37,5 @@ "files": [

"devDependencies": {
"ava": "0.0.4"
"ava": "*",
"xo": "*"
}
}

@@ -8,3 +8,3 @@ # camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)

```sh
```
$ npm install --save camelcase

@@ -17,32 +17,32 @@ ```

```js
var camelCase = require('camelcase');
const camelCase = require('camelcase');
camelCase('foo-bar');
//=> fooBar
//=> 'fooBar'
camelCase('foo_bar');
//=> fooBar
//=> 'fooBar'
camelCase('Foo-Bar');
//=> fooBar
//=> 'fooBar'
camelCase('--foo.bar');
//=> fooBar
//=> 'fooBar'
camelCase('__foo__bar__');
//=> fooBar
//=> 'fooBar'
camelCase('foo bar');
//=> fooBar
//=> 'fooBar'
console.log(process.argv[3]);
//=> --foo-bar
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> fooBar
//=> 'fooBar'
camelCase('foo', 'bar');
//=> fooBar
//=> 'fooBar'
camelCase('__foo__', '--bar');
//=> fooBar
//=> 'fooBar'
```

@@ -53,3 +53,4 @@

See [`decamelize`](https://github.com/sindresorhus/decamelize) for the inverse.
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase

@@ -56,0 +57,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc