added unit testing, and started implementing unit tests...phew
This commit is contained in:
21
node_modules/just-extend/LICENSE
generated
vendored
Normal file
21
node_modules/just-extend/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 angus croll
|
||||
|
||||
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.
|
36
node_modules/just-extend/README.md
generated
vendored
Normal file
36
node_modules/just-extend/README.md
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
## just-extend
|
||||
|
||||
Part of a [library](../../../../) of zero-dependency npm modules that do just do one thing.
|
||||
Guilt-free utilities for every occasion.
|
||||
|
||||
[Try it now](http://anguscroll.com/just/just-extend)
|
||||
|
||||
```js
|
||||
import extend from 'just-extend';
|
||||
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 4, b: 5, c: 8}
|
||||
|
||||
var obj = {a: 3, b: 5};
|
||||
extend({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 3, b: 5}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3, 4]}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(true, obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
|
||||
extend({a: 4, b: 5}); // {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, 3); {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, true); {a: 4, b: 5}
|
||||
extend('hello', {a: 4, b: 5}); // throws
|
||||
extend(3, {a: 4, b: 5}); // throws
|
||||
```
|
62
node_modules/just-extend/index.js
generated
vendored
Normal file
62
node_modules/just-extend/index.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
module.exports = extend;
|
||||
|
||||
/*
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 4, b: 5, c: 8}
|
||||
|
||||
var obj = {a: 3, b: 5};
|
||||
extend({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 3, b: 5}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3, 4]}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(true, obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
|
||||
extend({a: 4, b: 5}); // {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, 3); {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, true); {a: 4, b: 5}
|
||||
extend('hello', {a: 4, b: 5}); // throws
|
||||
extend(3, {a: 4, b: 5}); // throws
|
||||
*/
|
||||
|
||||
function extend(/* [deep], obj1, obj2, [objn] */) {
|
||||
var args = [].slice.call(arguments);
|
||||
var deep = false;
|
||||
if (typeof args[0] == 'boolean') {
|
||||
deep = args.shift();
|
||||
}
|
||||
var result = args[0];
|
||||
if (!result || (typeof result != 'object' && typeof result != 'function')) {
|
||||
throw new Error('extendee must be an object');
|
||||
}
|
||||
var extenders = args.slice(1);
|
||||
var len = extenders.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var extender = extenders[i];
|
||||
for (var key in extender) {
|
||||
if (extender.hasOwnProperty(key)) {
|
||||
var value = extender[key];
|
||||
if (deep && isCloneable(value)) {
|
||||
var base = Array.isArray(value) ? [] : {};
|
||||
result[key] = extend(true, result.hasOwnProperty(key) ? result[key] : base, value);
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function isCloneable(obj) {
|
||||
return Array.isArray(obj) || {}.toString.call(obj) == '[object Object]';
|
||||
}
|
57
node_modules/just-extend/package.json
generated
vendored
Normal file
57
node_modules/just-extend/package.json
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"_from": "just-extend@^4.0.2",
|
||||
"_id": "just-extend@4.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==",
|
||||
"_location": "/just-extend",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "just-extend@^4.0.2",
|
||||
"name": "just-extend",
|
||||
"escapedName": "just-extend",
|
||||
"rawSpec": "^4.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nise"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz",
|
||||
"_shasum": "f3f47f7dfca0f989c55410a7ebc8854b07108afc",
|
||||
"_spec": "just-extend@^4.0.2",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/nise",
|
||||
"author": {
|
||||
"name": "Angus Croll"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angus-c/just/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "extend an object",
|
||||
"homepage": "https://github.com/angus-c/just#readme",
|
||||
"keywords": [
|
||||
"object",
|
||||
"assign",
|
||||
"clone",
|
||||
"copy",
|
||||
"merge",
|
||||
"deep-copy",
|
||||
"extend",
|
||||
"no-dependencies",
|
||||
"just"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "just-extend",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angus-c/just.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "4.0.2"
|
||||
}
|
Reference in New Issue
Block a user