lodash.camelcase
Advanced tools
Comparing version 3.0.1 to 4.0.0
56
index.js
/** | ||
* lodash 3.0.1 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* lodash 4.0.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
*/ | ||
var createCompounder = require('lodash._createcompounder'); | ||
var capitalize = require('lodash.capitalize'), | ||
deburr = require('lodash.deburr'), | ||
words = require('lodash.words'); | ||
/** | ||
* Converts `string` to camel case. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/CamelCase) for more details. | ||
* A specialized version of `_.reduce` for arrays without support for | ||
* iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array} array The array to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @param {*} [accumulator] The initial value. | ||
* @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. | ||
* @returns {*} Returns the accumulated value. | ||
*/ | ||
function arrayReduce(array, iteratee, accumulator, initFromArray) { | ||
var index = -1, | ||
length = array.length; | ||
if (initFromArray && length) { | ||
accumulator = array[++index]; | ||
} | ||
while (++index < length) { | ||
accumulator = iteratee(accumulator, array[index], index, array); | ||
} | ||
return accumulator; | ||
} | ||
/** | ||
* Creates a function like `_.camelCase`. | ||
* | ||
* @private | ||
* @param {Function} callback The function to combine each word. | ||
* @returns {Function} Returns the new compounder function. | ||
*/ | ||
function createCompounder(callback) { | ||
return function(string) { | ||
return arrayReduce(words(deburr(string)), callback, ''); | ||
}; | ||
} | ||
/** | ||
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). | ||
* | ||
* @static | ||
@@ -33,5 +71,5 @@ * @memberOf _ | ||
word = word.toLowerCase(); | ||
return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word); | ||
return result + (index ? capitalize(word) : word); | ||
}); | ||
module.exports = camelCase; |
{ | ||
"name": "lodash.camelcase", | ||
"version": "3.0.1", | ||
"description": "The modern build of lodash’s `_.camelCase` as a module.", | ||
"version": "4.0.0", | ||
"description": "The lodash method `_.camelCase` exported as a module.", | ||
"homepage": "https://lodash.com/", | ||
"icon": "https://lodash.com/icon.svg", | ||
"license": "MIT", | ||
"keywords": "lodash, lodash-modularized, stdlib, util", | ||
"keywords": "lodash, lodash-modularized, stdlib, util, camelcase", | ||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"contributors": [ | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)", | ||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -20,4 +18,6 @@ ], | ||
"dependencies": { | ||
"lodash._createcompounder": "^3.0.0" | ||
"lodash.capitalize": "^4.0.0", | ||
"lodash.deburr": "^3.0.0", | ||
"lodash.words": "^3.0.0" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# lodash.camelcase v3.0.1 | ||
# lodash.camelcase v4.0.0 | ||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.camelCase` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
The [lodash](https://lodash.com/) method `_.camelCase` exported as a [Node.js](https://nodejs.org/) module. | ||
@@ -8,3 +8,2 @@ ## Installation | ||
Using npm: | ||
```bash | ||
@@ -15,4 +14,3 @@ $ {sudo -H} npm i -g npm | ||
In Node.js/io.js: | ||
In Node.js: | ||
```js | ||
@@ -22,2 +20,2 @@ var camelCase = require('lodash.camelcase'); | ||
See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/3.0.1-npm-packages/lodash.camelcase) for more details. | ||
See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.camelcase) for more details. |
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
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
4773
69
3
19
+ Addedlodash.capitalize@^4.0.0
+ Addedlodash.deburr@^3.0.0
+ Addedlodash.words@^3.0.0
+ Addedlodash.capitalize@4.2.1(transitive)
- Removedlodash._createcompounder@^3.0.0
- Removedlodash._createcompounder@3.0.0(transitive)