Skip to content

Commit

Permalink
Add npm-package
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Jul 8, 2020
1 parent 1b6c282 commit 2e1c0f2
Show file tree
Hide file tree
Showing 1,046 changed files with 40,050 additions and 0 deletions.
39 changes: 39 additions & 0 deletions npm-package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# lodash v4.17.18

The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.

## Installation

Using npm:
```shell
$ npm i -g npm
$ npm i --save lodash
```

In Node.js:
```js
// Load the full build.
var _ = require('lodash');
// Load the core build.
var _ = require('lodash/core');
// Load the FP build for immutable auto-curried iteratee-first data-last methods.
var fp = require('lodash/fp');

// Load method categories.
var array = require('lodash/array');
var object = require('lodash/fp/object');

// Cherry-pick methods for smaller browserify/rollup/webpack bundles.
var at = require('lodash/at');
var curryN = require('lodash/fp/curryN');
```

See the [package source](https://github.com/lodash/lodash/tree/4.17.18-npm) for more details.

**Note:**<br>
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.

## Support

Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.<br>
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available.
7 changes: 7 additions & 0 deletions npm-package/_DataView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');

/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView');

module.exports = DataView;
32 changes: 32 additions & 0 deletions npm-package/_Hash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var hashClear = require('./_hashClear'),
hashDelete = require('./_hashDelete'),
hashGet = require('./_hashGet'),
hashHas = require('./_hashHas'),
hashSet = require('./_hashSet');

/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}

// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;

module.exports = Hash;
28 changes: 28 additions & 0 deletions npm-package/_LazyWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var baseCreate = require('./_baseCreate'),
baseLodash = require('./_baseLodash');

/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295;

/**
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
*
* @private
* @constructor
* @param {*} value The value to wrap.
*/
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}

// Ensure `LazyWrapper` is an instance of `baseLodash`.
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;

module.exports = LazyWrapper;
32 changes: 32 additions & 0 deletions npm-package/_ListCache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var listCacheClear = require('./_listCacheClear'),
listCacheDelete = require('./_listCacheDelete'),
listCacheGet = require('./_listCacheGet'),
listCacheHas = require('./_listCacheHas'),
listCacheSet = require('./_listCacheSet');

/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}

// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;

module.exports = ListCache;
22 changes: 22 additions & 0 deletions npm-package/_LodashWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var baseCreate = require('./_baseCreate'),
baseLodash = require('./_baseLodash');

/**
* The base constructor for creating `lodash` wrapper objects.
*
* @private
* @param {*} value The value to wrap.
* @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined;
}

LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;

module.exports = LodashWrapper;
7 changes: 7 additions & 0 deletions npm-package/_Map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');

/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');

module.exports = Map;
32 changes: 32 additions & 0 deletions npm-package/_MapCache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var mapCacheClear = require('./_mapCacheClear'),
mapCacheDelete = require('./_mapCacheDelete'),
mapCacheGet = require('./_mapCacheGet'),
mapCacheHas = require('./_mapCacheHas'),
mapCacheSet = require('./_mapCacheSet');

/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}

// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;

module.exports = MapCache;
7 changes: 7 additions & 0 deletions npm-package/_Promise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');

/* Built-in method references that are verified to be native. */
var Promise = getNative(root, 'Promise');

module.exports = Promise;
7 changes: 7 additions & 0 deletions npm-package/_Set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');

/* Built-in method references that are verified to be native. */
var Set = getNative(root, 'Set');

module.exports = Set;
27 changes: 27 additions & 0 deletions npm-package/_SetCache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var MapCache = require('./_MapCache'),
setCacheAdd = require('./_setCacheAdd'),
setCacheHas = require('./_setCacheHas');

/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;

this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}

// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;

module.exports = SetCache;
27 changes: 27 additions & 0 deletions npm-package/_Stack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var ListCache = require('./_ListCache'),
stackClear = require('./_stackClear'),
stackDelete = require('./_stackDelete'),
stackGet = require('./_stackGet'),
stackHas = require('./_stackHas'),
stackSet = require('./_stackSet');

/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}

// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;

module.exports = Stack;
6 changes: 6 additions & 0 deletions npm-package/_Symbol.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var root = require('./_root');

/** Built-in value references. */
var Symbol = root.Symbol;

module.exports = Symbol;
6 changes: 6 additions & 0 deletions npm-package/_Uint8Array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var root = require('./_root');

/** Built-in value references. */
var Uint8Array = root.Uint8Array;

module.exports = Uint8Array;
7 changes: 7 additions & 0 deletions npm-package/_WeakMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');

/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root, 'WeakMap');

module.exports = WeakMap;
21 changes: 21 additions & 0 deletions npm-package/_apply.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}

module.exports = apply;
22 changes: 22 additions & 0 deletions npm-package/_arrayAggregator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array == null ? 0 : array.length;

while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}

module.exports = arrayAggregator;
22 changes: 22 additions & 0 deletions npm-package/_arrayEach.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;

while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}

module.exports = arrayEach;
21 changes: 21 additions & 0 deletions npm-package/_arrayEachRight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* A specialized version of `_.forEachRight` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEachRight(array, iteratee) {
var length = array == null ? 0 : array.length;

while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
}

module.exports = arrayEachRight;
Loading

1 comment on commit 2e1c0f2

@JacksonKearl
Copy link

@JacksonKearl JacksonKearl commented on 2e1c0f2 Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mathiasbynens, could you help me understand why this change was made? There's no info in the commit message and it says it's in the 4.17.19 branch but does not appear in the timeline, which seems odd to me. It's concerning if the npm package is not derived from the github source but rather an orphaned commit that has unknown contents.

Please sign in to comment.