Rename to hkt.sh
This commit is contained in:
21
node_modules/shallow-clone/LICENSE
generated
vendored
Normal file
21
node_modules/shallow-clone/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
94
node_modules/shallow-clone/README.md
generated
vendored
Normal file
94
node_modules/shallow-clone/README.md
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# shallow-clone [](http://badge.fury.io/js/shallow-clone)
|
||||
|
||||
> Make a shallow clone of an object, array or primitive.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i shallow-clone --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var clone = require('shallow-clone');
|
||||
```
|
||||
|
||||
## shallow clones arrays
|
||||
|
||||
The array itself is cloned, but not the elements of the array. So any objects in the array will still not be cloned (e.g. they will be the same object as in the orginal array).
|
||||
|
||||
```js
|
||||
var arr = [{ 'a': 0 }, { 'b': 1 }]
|
||||
var foo = clone(arr);
|
||||
// foo => [{ 'a': 0 }, { 'b': 1 }]
|
||||
|
||||
// array is cloned
|
||||
assert.equal(actual === expected, false);
|
||||
|
||||
// array elements are not
|
||||
assert.deepEqual(actual[0], expected[0]); // true
|
||||
```
|
||||
|
||||
## returns primitives as-is
|
||||
|
||||
```js
|
||||
clone(0)
|
||||
//=> 0
|
||||
|
||||
clone('foo')
|
||||
//=> 'foo'
|
||||
```
|
||||
|
||||
## shallow clone a regex
|
||||
|
||||
```js
|
||||
clone(/foo/g)
|
||||
//=> /foo/g
|
||||
```
|
||||
|
||||
## shallow clone an object
|
||||
|
||||
```js
|
||||
clone({a: 1, b: 2, c: 3 })
|
||||
//=> {a: 1, b: 2, c: 3 }
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
* [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object.
|
||||
* [clone-deep](https://github.com/jonschlinkert/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
|
||||
* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util.
|
||||
* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor.
|
||||
* [mixin-object](https://github.com/jonschlinkert/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://github.com/jonschlinkert/mixin-object)
|
||||
* [mixin-deep](https://github.com/jonschlinkert/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/shallow-clone/issues/new)
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2015 Jon Schlinkert
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 10, 2015._
|
||||
56
node_modules/shallow-clone/index.js
generated
vendored
Normal file
56
node_modules/shallow-clone/index.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*!
|
||||
* shallow-clone <https://github.com/jonschlinkert/shallow-clone>
|
||||
*
|
||||
* Copyright (c) 2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Shallow copy an object, array or primitive.
|
||||
*
|
||||
* @param {any} `val`
|
||||
* @return {any}
|
||||
*/
|
||||
|
||||
function clone(val) {
|
||||
var type = utils.typeOf(val);
|
||||
|
||||
if (clone.hasOwnProperty(type)) {
|
||||
return clone[type](val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
clone.array = function cloneArray(arr) {
|
||||
return arr.slice();
|
||||
};
|
||||
|
||||
clone.date = function cloneDate(date) {
|
||||
return new Date(+date);
|
||||
};
|
||||
|
||||
clone.object = function cloneObject(obj) {
|
||||
if (utils.isObject(obj)) {
|
||||
return utils.mixin({}, obj);
|
||||
} else {
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
clone.regexp = function cloneRegExp(re) {
|
||||
var flags = '';
|
||||
flags += re.multiline ? 'm' : '';
|
||||
flags += re.global ? 'g' : '';
|
||||
flags += re.ignorecase ? 'i' : '';
|
||||
return new RegExp(re.source, flags);
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose `clone`
|
||||
*/
|
||||
|
||||
module.exports = clone;
|
||||
22
node_modules/shallow-clone/node_modules/kind-of/LICENSE
generated
vendored
Normal file
22
node_modules/shallow-clone/node_modules/kind-of/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
212
node_modules/shallow-clone/node_modules/kind-of/README.md
generated
vendored
Normal file
212
node_modules/shallow-clone/node_modules/kind-of/README.md
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
# kind-of [](http://badge.fury.io/js/kind-of) [](https://travis-ci.org/jonschlinkert/kind-of)
|
||||
|
||||
> Get the native type of a value.
|
||||
|
||||
[](#optimizations)**What makes this so fast?**
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i kind-of --save
|
||||
```
|
||||
|
||||
Install with [bower](http://bower.io/)
|
||||
|
||||
```sh
|
||||
$ bower install kind-of --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
> es5, browser and es6 ready
|
||||
|
||||
```js
|
||||
var kindOf = require('kind-of');
|
||||
|
||||
kindOf(undefined);
|
||||
//=> 'undefined'
|
||||
|
||||
kindOf(null);
|
||||
//=> 'null'
|
||||
|
||||
kindOf(true);
|
||||
//=> 'boolean'
|
||||
|
||||
kindOf(false);
|
||||
//=> 'boolean'
|
||||
|
||||
kindOf(new Boolean(true));
|
||||
//=> 'boolean'
|
||||
|
||||
kindOf(new Buffer(''));
|
||||
//=> 'buffer'
|
||||
|
||||
kindOf(42);
|
||||
//=> 'number'
|
||||
|
||||
kindOf(new Number(42));
|
||||
//=> 'number'
|
||||
|
||||
kindOf('str');
|
||||
//=> 'string'
|
||||
|
||||
kindOf(new String('str'));
|
||||
//=> 'string'
|
||||
|
||||
kindOf(arguments);
|
||||
//=> 'arguments'
|
||||
|
||||
kindOf({});
|
||||
//=> 'object'
|
||||
|
||||
kindOf(Object.create(null));
|
||||
//=> 'object'
|
||||
|
||||
kindOf(new Test());
|
||||
//=> 'object'
|
||||
|
||||
kindOf(new Date());
|
||||
//=> 'date'
|
||||
|
||||
kindOf([]);
|
||||
//=> 'array'
|
||||
|
||||
kindOf([1, 2, 3]);
|
||||
//=> 'array'
|
||||
|
||||
kindOf(new Array());
|
||||
//=> 'array'
|
||||
|
||||
kindOf(/[\s\S]+/);
|
||||
//=> 'regexp'
|
||||
|
||||
kindOf(new RegExp('^' + 'foo$'));
|
||||
//=> 'regexp'
|
||||
|
||||
kindOf(function () {});
|
||||
//=> 'function'
|
||||
|
||||
kindOf(function * () {});
|
||||
//=> 'function'
|
||||
|
||||
kindOf(new Function());
|
||||
//=> 'function'
|
||||
|
||||
kindOf(new Map());
|
||||
//=> 'map'
|
||||
|
||||
kindOf(new WeakMap());
|
||||
//=> 'weakmap'
|
||||
|
||||
kindOf(new Set());
|
||||
//=> 'set'
|
||||
|
||||
kindOf(new WeakSet());
|
||||
//=> 'weakset'
|
||||
|
||||
kindOf(Symbol('str'));
|
||||
//=> 'symbol'
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
* [is-number](https://github.com/jonschlinkert/is-number): Returns true if the value is a number. comprehensive tests.
|
||||
* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null.
|
||||
* [is-primitive](https://github.com/jonschlinkert/is-primitive): Returns `true` if the value is a primitive.
|
||||
* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor.
|
||||
* [is-match](https://github.com/jonschlinkert/is-match): Create a matching function from a glob pattern, regex, string, array or function.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of).
|
||||
Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`.
|
||||
|
||||
```bash
|
||||
#1: array
|
||||
current x 23,329,397 ops/sec ±0.82% (94 runs sampled)
|
||||
lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled)
|
||||
lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled)
|
||||
|
||||
#2: boolean
|
||||
current x 27,197,115 ops/sec ±0.85% (94 runs sampled)
|
||||
lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled)
|
||||
lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled)
|
||||
|
||||
#3: date
|
||||
current x 20,190,117 ops/sec ±0.86% (92 runs sampled)
|
||||
lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled)
|
||||
lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled)
|
||||
|
||||
#4: function
|
||||
current x 23,855,460 ops/sec ±0.60% (97 runs sampled)
|
||||
lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled)
|
||||
lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled)
|
||||
|
||||
#5: null
|
||||
current x 27,061,047 ops/sec ±0.97% (96 runs sampled)
|
||||
lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled)
|
||||
lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled)
|
||||
|
||||
#6: number
|
||||
current x 25,075,682 ops/sec ±0.53% (99 runs sampled)
|
||||
lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled)
|
||||
lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled)
|
||||
|
||||
#7: object
|
||||
current x 3,348,980 ops/sec ±0.49% (99 runs sampled)
|
||||
lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled)
|
||||
lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled)
|
||||
|
||||
#8: regex
|
||||
current x 21,284,827 ops/sec ±0.72% (96 runs sampled)
|
||||
lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled)
|
||||
lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled)
|
||||
|
||||
#9: string
|
||||
current x 25,379,234 ops/sec ±0.58% (96 runs sampled)
|
||||
lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled)
|
||||
lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled)
|
||||
|
||||
#10: undef
|
||||
current x 27,459,221 ops/sec ±1.01% (93 runs sampled)
|
||||
lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled)
|
||||
lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled)
|
||||
```
|
||||
|
||||
## Optimizations
|
||||
|
||||
In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library:
|
||||
|
||||
1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot.
|
||||
2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it.
|
||||
3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'`
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/kind-of/issues/new)
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 31, 2015._
|
||||
84
node_modules/shallow-clone/node_modules/kind-of/index.js
generated
vendored
Normal file
84
node_modules/shallow-clone/node_modules/kind-of/index.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
var isBuffer = require('is-buffer');
|
||||
var toString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Get the native `typeof` a value.
|
||||
*
|
||||
* @param {*} `val`
|
||||
* @return {*} Native javascript type
|
||||
*/
|
||||
|
||||
module.exports = function kindOf(val) {
|
||||
// primitivies
|
||||
if (typeof val === 'undefined') {
|
||||
return 'undefined';
|
||||
}
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (val === true || val === false || val instanceof Boolean) {
|
||||
return 'boolean';
|
||||
}
|
||||
if (typeof val === 'string' || val instanceof String) {
|
||||
return 'string';
|
||||
}
|
||||
if (typeof val === 'number' || val instanceof Number) {
|
||||
return 'number';
|
||||
}
|
||||
|
||||
// functions
|
||||
if (typeof val === 'function' || val instanceof Function) {
|
||||
return 'function';
|
||||
}
|
||||
|
||||
// array
|
||||
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
|
||||
return 'array';
|
||||
}
|
||||
|
||||
// check for instances of RegExp and Date before calling `toString`
|
||||
if (val instanceof RegExp) {
|
||||
return 'regexp';
|
||||
}
|
||||
if (val instanceof Date) {
|
||||
return 'date';
|
||||
}
|
||||
|
||||
// other objects
|
||||
var type = toString.call(val);
|
||||
|
||||
if (type === '[object RegExp]') {
|
||||
return 'regexp';
|
||||
}
|
||||
if (type === '[object Date]') {
|
||||
return 'date';
|
||||
}
|
||||
if (type === '[object Arguments]') {
|
||||
return 'arguments';
|
||||
}
|
||||
|
||||
// buffer
|
||||
if (typeof Buffer !== 'undefined' && isBuffer(val)) {
|
||||
return 'buffer';
|
||||
}
|
||||
|
||||
// es6: Map, WeakMap, Set, WeakSet
|
||||
if (type === '[object Set]') {
|
||||
return 'set';
|
||||
}
|
||||
if (type === '[object WeakSet]') {
|
||||
return 'weakset';
|
||||
}
|
||||
if (type === '[object Map]') {
|
||||
return 'map';
|
||||
}
|
||||
if (type === '[object WeakMap]') {
|
||||
return 'weakmap';
|
||||
}
|
||||
if (type === '[object Symbol]') {
|
||||
return 'symbol';
|
||||
}
|
||||
|
||||
// must be a plain object
|
||||
return 'object';
|
||||
};
|
||||
57
node_modules/shallow-clone/node_modules/kind-of/package.json
generated
vendored
Normal file
57
node_modules/shallow-clone/node_modules/kind-of/package.json
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "kind-of",
|
||||
"description": "Get the native type of a value.",
|
||||
"version": "2.0.1",
|
||||
"homepage": "https://github.com/jonschlinkert/kind-of",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"repository": "jonschlinkert/kind-of",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/kind-of/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"prepublish": "browserify -o browser.js -e index.js -s index --bare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"benchmarked": "^0.1.3",
|
||||
"chalk": "^0.5.1",
|
||||
"glob": "^4.3.5",
|
||||
"mocha": "^2.2.5",
|
||||
"should": "^4.6.1",
|
||||
"type-of": "^2.0.1",
|
||||
"typeof": "^1.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"arguments",
|
||||
"array",
|
||||
"boolean",
|
||||
"check",
|
||||
"date",
|
||||
"function",
|
||||
"is",
|
||||
"is-type",
|
||||
"is-type-of",
|
||||
"kind",
|
||||
"kind-of",
|
||||
"number",
|
||||
"object",
|
||||
"regexp",
|
||||
"string",
|
||||
"test",
|
||||
"type",
|
||||
"type-of",
|
||||
"typeof",
|
||||
"types"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-buffer": "^1.0.2"
|
||||
}
|
||||
}
|
||||
21
node_modules/shallow-clone/node_modules/lazy-cache/LICENSE
generated
vendored
Normal file
21
node_modules/shallow-clone/node_modules/lazy-cache/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
128
node_modules/shallow-clone/node_modules/lazy-cache/README.md
generated
vendored
Normal file
128
node_modules/shallow-clone/node_modules/lazy-cache/README.md
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
# lazy-cache [](https://www.npmjs.com/package/lazy-cache) [](https://travis-ci.org/jonschlinkert/lazy-cache)
|
||||
|
||||
> Cache requires to be lazy-loaded when needed.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i lazy-cache --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var lazy = require('lazy-cache')(require);
|
||||
```
|
||||
|
||||
**Use as a property on `lazy`**
|
||||
|
||||
The module is also added as a property to the `lazy` function
|
||||
so it can be called without having to call a function first.
|
||||
|
||||
```js
|
||||
var lazy = require('lazy-cache')(require);
|
||||
|
||||
// `npm install glob`
|
||||
lazy('glob');
|
||||
|
||||
// glob sync
|
||||
console.log(lazy.glob.sync('*.js'));
|
||||
|
||||
// glob async
|
||||
lazy.glob('*.js', function (err, files) {
|
||||
console.log(files);
|
||||
});
|
||||
```
|
||||
|
||||
**Use as a function**
|
||||
|
||||
```js
|
||||
var lazy = require('lazy-cache')(require);
|
||||
var glob = lazy('glob');
|
||||
|
||||
// `glob` is a now a function that may be called when needed
|
||||
glob().sync('foo/*.js');
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
An alias may be passed as the second argument if you don't want to use the automatically camel-cased variable name.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var utils = require('lazy-cache')(require);
|
||||
|
||||
utils('ansi-yellow', 'yellow');
|
||||
console.log(utils.yellow('foo'));
|
||||
```
|
||||
|
||||
## Browserify usage
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var utils = require('lazy-cache')(require);
|
||||
// temporarily re-assign `require` to trick browserify
|
||||
var fn = require;
|
||||
require = utils;
|
||||
// list module dependencies (here, `require` is actually `lazy-cache`)
|
||||
require('glob');
|
||||
require = fn; // restore the native `require` function
|
||||
|
||||
/**
|
||||
* Now you can use glob with the `utils.glob` variable
|
||||
*/
|
||||
|
||||
// sync
|
||||
console.log(utils.glob.sync('*.js'));
|
||||
|
||||
// async
|
||||
utils.glob('*.js', function (err, files) {
|
||||
console.log(files.join('\n'));
|
||||
});
|
||||
```
|
||||
|
||||
## Kill switch
|
||||
|
||||
In certain rare edge cases, it may be necessary to unlazy all lazy-cached dependencies (two reported cases out of > 9 million downloads).
|
||||
|
||||
To force lazy-cache to immediately invoke all dependencies, do:
|
||||
|
||||
```js
|
||||
process.env.UNLAZY = true;
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
[lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps)
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/lazy-cache/issues/new).
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb](https://github.com/verbose/verb) on December 09, 2015._
|
||||
67
node_modules/shallow-clone/node_modules/lazy-cache/index.js
generated
vendored
Normal file
67
node_modules/shallow-clone/node_modules/lazy-cache/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Cache results of the first function call to ensure only calling once.
|
||||
*
|
||||
* ```js
|
||||
* var utils = require('lazy-cache')(require);
|
||||
* // cache the call to `require('ansi-yellow')`
|
||||
* utils('ansi-yellow', 'yellow');
|
||||
* // use `ansi-yellow`
|
||||
* console.log(utils.yellow('this is yellow'));
|
||||
* ```
|
||||
*
|
||||
* @param {Function} `fn` Function that will be called only once.
|
||||
* @return {Function} Function that can be called to get the cached function
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function lazyCache(fn) {
|
||||
var cache = {};
|
||||
var proxy = function(mod, name) {
|
||||
name = name || camelcase(mod);
|
||||
|
||||
// check both boolean and string in case `process.env` cases to string
|
||||
if (process.env.UNLAZY === 'true' || process.env.UNLAZY === true) {
|
||||
cache[name] = fn(mod);
|
||||
}
|
||||
|
||||
Object.defineProperty(proxy, name, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: getter
|
||||
});
|
||||
|
||||
function getter() {
|
||||
if (cache.hasOwnProperty(name)) {
|
||||
return cache[name];
|
||||
}
|
||||
return (cache[name] = fn(mod));
|
||||
}
|
||||
return getter;
|
||||
};
|
||||
return proxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to camelcase the name to be stored on the `lazy` object.
|
||||
*
|
||||
* @param {String} `str` String containing `_`, `.`, `-` or whitespace that will be camelcased.
|
||||
* @return {String} camelcased string.
|
||||
*/
|
||||
|
||||
function camelcase(str) {
|
||||
if (str.length === 1) {
|
||||
return str.toLowerCase();
|
||||
}
|
||||
str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase();
|
||||
return str.replace(/[\W_]+(\w|$)/g, function(_, ch) {
|
||||
return ch.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `lazyCache`
|
||||
*/
|
||||
|
||||
module.exports = lazyCache;
|
||||
46
node_modules/shallow-clone/node_modules/lazy-cache/package.json
generated
vendored
Normal file
46
node_modules/shallow-clone/node_modules/lazy-cache/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "lazy-cache",
|
||||
"description": "Cache requires to be lazy-loaded when needed.",
|
||||
"version": "0.2.7",
|
||||
"homepage": "https://github.com/jonschlinkert/lazy-cache",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"repository": "jonschlinkert/lazy-cache",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/lazy-cache/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ansi-yellow": "^0.1.1",
|
||||
"glob": "^5.0.14",
|
||||
"mocha": "*"
|
||||
},
|
||||
"keywords": [
|
||||
"cache",
|
||||
"caching",
|
||||
"dependencies",
|
||||
"dependency",
|
||||
"lazy",
|
||||
"require",
|
||||
"requires"
|
||||
],
|
||||
"verb": {
|
||||
"related": {
|
||||
"list": [
|
||||
"lint-deps"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
]
|
||||
}
|
||||
}
|
||||
55
node_modules/shallow-clone/package.json
generated
vendored
Normal file
55
node_modules/shallow-clone/package.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "shallow-clone",
|
||||
"description": "Make a shallow clone of an object, array or primitive.",
|
||||
"version": "0.1.2",
|
||||
"homepage": "https://github.com/jonschlinkert/shallow-clone",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"repository": "jonschlinkert/shallow-clone",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/shallow-clone/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js",
|
||||
"utils.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-extendable": "^0.1.1",
|
||||
"kind-of": "^2.0.1",
|
||||
"lazy-cache": "^0.2.3",
|
||||
"mixin-object": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"keywords": [
|
||||
"array",
|
||||
"clone",
|
||||
"copy",
|
||||
"extend",
|
||||
"mixin",
|
||||
"object",
|
||||
"primitive",
|
||||
"shallow"
|
||||
],
|
||||
"verb": {
|
||||
"related": {
|
||||
"list": [
|
||||
"clone-deep",
|
||||
"is-plain-object",
|
||||
"mixin-object",
|
||||
"mixin-deep",
|
||||
"extend-shallow",
|
||||
"assign-deep"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
10
node_modules/shallow-clone/utils.js
generated
vendored
Normal file
10
node_modules/shallow-clone/utils.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var utils = require('lazy-cache')(require);
|
||||
var fn = require;
|
||||
require = utils;
|
||||
require('is-extendable', 'isObject');
|
||||
require('mixin-object', 'mixin');
|
||||
require('kind-of', 'typeOf');
|
||||
require = fn;
|
||||
module.exports = utils;
|
||||
Reference in New Issue
Block a user