aboutsummaryrefslogtreecommitdiff
path: root/node_modules/es5-ext
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/es5-ext')
-rw-r--r--node_modules/es5-ext/.editorconfig14
-rw-r--r--node_modules/es5-ext/.npmignore3
-rw-r--r--node_modules/es5-ext/CHANGELOG.md103
-rw-r--r--node_modules/es5-ext/appveyor.yml26
-rw-r--r--node_modules/es5-ext/array/#/copy-within/implement.js11
-rw-r--r--node_modules/es5-ext/array/#/index.js1
-rw-r--r--node_modules/es5-ext/array/#/is-empty.js8
-rw-r--r--node_modules/es5-ext/circle.yml11
-rw-r--r--node_modules/es5-ext/date/ensure-time-value.js10
-rw-r--r--node_modules/es5-ext/date/index.js2
-rw-r--r--node_modules/es5-ext/date/is-time-value.js12
-rw-r--r--node_modules/es5-ext/function/#/curry.js2
-rw-r--r--node_modules/es5-ext/index.js1
-rw-r--r--node_modules/es5-ext/json/safe-stringify.js2
-rw-r--r--node_modules/es5-ext/object/assign-deep.js33
-rw-r--r--node_modules/es5-ext/object/copy-deep.js53
-rw-r--r--node_modules/es5-ext/object/ensure-array.js9
-rw-r--r--node_modules/es5-ext/object/ensure-finite-number.js2
-rw-r--r--node_modules/es5-ext/object/flatten.js2
-rw-r--r--node_modules/es5-ext/object/index.js3
-rw-r--r--node_modules/es5-ext/object/is-array-like.js1
-rw-r--r--node_modules/es5-ext/object/is-plain-function.js11
-rw-r--r--node_modules/es5-ext/object/set-prototype-of/shim.js6
-rw-r--r--node_modules/es5-ext/package.json10
-rw-r--r--node_modules/es5-ext/string/#/repeat/shim.js18
-rw-r--r--node_modules/es5-ext/string/index.js1
-rw-r--r--node_modules/es5-ext/string/random-uniq.js10
-rw-r--r--node_modules/es5-ext/string/random.js42
-rw-r--r--node_modules/es5-ext/test/.eslintrc.json23
-rw-r--r--node_modules/es5-ext/test/array/#/is-empty.js8
-rw-r--r--node_modules/es5-ext/test/array/to-array.js26
-rw-r--r--node_modules/es5-ext/test/date/ensure-time-value.js14
-rw-r--r--node_modules/es5-ext/test/date/is-time-value.js15
-rw-r--r--node_modules/es5-ext/test/function/#/copy.js2
-rw-r--r--node_modules/es5-ext/test/iterable/is.js12
-rw-r--r--node_modules/es5-ext/test/object/assign-deep.js15
-rw-r--r--node_modules/es5-ext/test/object/copy-deep.js20
-rw-r--r--node_modules/es5-ext/test/object/ensure-array.js55
-rw-r--r--node_modules/es5-ext/test/object/is-array-like.js12
-rw-r--r--node_modules/es5-ext/test/object/is-plain-function.js42
-rw-r--r--node_modules/es5-ext/test/string/#/repeat/shim.js1
-rw-r--r--node_modules/es5-ext/test/string/random.js13
-rw-r--r--node_modules/es5-ext/test/to-short-string-representation.js23
-rw-r--r--node_modules/es5-ext/to-short-string-representation.js16
44 files changed, 572 insertions, 132 deletions
diff --git a/node_modules/es5-ext/.editorconfig b/node_modules/es5-ext/.editorconfig
new file mode 100644
index 000000000..c24a6cd1f
--- /dev/null
+++ b/node_modules/es5-ext/.editorconfig
@@ -0,0 +1,14 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = tab
+
+[{*.json,*.yml}]
+indent_style = space
+indent_size = 2
diff --git a/node_modules/es5-ext/.npmignore b/node_modules/es5-ext/.npmignore
index 14b020063..ee45d6a44 100644
--- a/node_modules/es5-ext/.npmignore
+++ b/node_modules/es5-ext/.npmignore
@@ -11,4 +11,5 @@ npm-debug.log
/.travis.yml
/.gitignore
/.circle.yml
-/.appveyor.yml
+/.circleci
+/appveyor.yml
diff --git a/node_modules/es5-ext/CHANGELOG.md b/node_modules/es5-ext/CHANGELOG.md
index 2058f757c..15024e6b8 100644
--- a/node_modules/es5-ext/CHANGELOG.md
+++ b/node_modules/es5-ext/CHANGELOG.md
@@ -2,6 +2,109 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+<a name="0.10.37"></a>
+## [0.10.37](https://github.com/medikoo/es5-ext/compare/v0.10.36...v0.10.37) (2017-11-23)
+
+
+### Features
+
+* String.random util ([7c28739](https://github.com/medikoo/es5-ext/commit/7c28739))
+
+
+
+<a name="0.10.36"></a>
+## [0.10.36](https://github.com/medikoo/es5-ext/compare/v0.10.35...v0.10.36) (2017-11-23)
+
+
+### Features
+
+* **date:** isTimeValue and ensureTimeValue utils ([7659dc5](https://github.com/medikoo/es5-ext/commit/7659dc5))
+
+
+
+<a name="0.10.35"></a>
+## [0.10.35](https://github.com/medikoo/es5-ext/compare/v0.10.34...v0.10.35) (2017-10-13)
+
+
+### Bug Fixes
+
+* **Object.copy:** do not upgrade primitives to objects ([dd4d88f](https://github.com/medikoo/es5-ext/commit/dd4d88f))
+
+
+
+<a name="0.10.34"></a>
+## [0.10.34](https://github.com/medikoo/es5-ext/compare/v0.10.33...v0.10.34) (2017-10-13)
+
+
+### Features
+
+* **copyDeep:** duplicate only recursive instances ([bba529a](https://github.com/medikoo/es5-ext/commit/bba529a))
+
+
+
+<a name="0.10.33"></a>
+## [0.10.33](https://github.com/medikoo/es5-ext/compare/v0.10.32...v0.10.33) (2017-10-13)
+
+
+### Bug Fixes
+
+* **Object.assignDeep:** relax input validation ([1baf57d](https://github.com/medikoo/es5-ext/commit/1baf57d))
+
+
+
+<a name="0.10.32"></a>
+## [0.10.32](https://github.com/medikoo/es5-ext/compare/v0.10.31...v0.10.32) (2017-10-13)
+
+
+### Features
+
+* Object.assignDeep ([2345e0b](https://github.com/medikoo/es5-ext/commit/2345e0b))
+
+
+
+<a name="0.10.31"></a>
+## [0.10.31](https://github.com/medikoo/es5-ext/compare/v0.10.30...v0.10.31) (2017-10-09)
+
+
+### Features
+
+* Object.isPlainFunction utility ([031be0a](https://github.com/medikoo/es5-ext/commit/031be0a))
+
+
+
+<a name="0.10.30"></a>
+## [0.10.30](https://github.com/medikoo/es5-ext/compare/v0.10.29...v0.10.30) (2017-08-25)
+
+
+### Bug Fixes
+
+* value stringification for error message ([37bb96b](https://github.com/medikoo/es5-ext/commit/37bb96b))
+
+
+
+<a name="0.10.29"></a>
+## [0.10.29](https://github.com/medikoo/es5-ext/compare/v0.10.28...v0.10.29) (2017-08-18)
+
+
+### Bug Fixes
+
+* string.repeat after recent regression ([b02fab4](https://github.com/medikoo/es5-ext/commit/b02fab4))
+
+
+
+<a name="0.10.28"></a>
+## [0.10.28](https://github.com/medikoo/es5-ext/compare/v0.10.27...v0.10.28) (2017-08-18)
+
+
+### Features
+
+* array.isEmpty method ([b0cfbdd](https://github.com/medikoo/es5-ext/commit/b0cfbdd))
+* improve new lines representation ([860fe8b](https://github.com/medikoo/es5-ext/commit/860fe8b))
+* Object.ensureArray util ([595c341](https://github.com/medikoo/es5-ext/commit/595c341))
+* toShortStringRepresentation util ([6842d06](https://github.com/medikoo/es5-ext/commit/6842d06))
+
+
+
<a name="0.10.27"></a>
## [0.10.27](https://github.com/medikoo/es5-ext/compare/v0.10.26...v0.10.27) (2017-08-11)
diff --git a/node_modules/es5-ext/appveyor.yml b/node_modules/es5-ext/appveyor.yml
deleted file mode 100644
index 942ab8278..000000000
--- a/node_modules/es5-ext/appveyor.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-# Test against the latest version of this Node.js version
-environment:
- matrix:
- # node.js
- - nodejs_version: "0.12"
- - nodejs_version: "4"
- - nodejs_version: "6"
- - nodejs_version: "8"
-
-# Install scripts. (runs after repo cloning)
-install:
- # Get the latest stable version of Node.js or io.js
- - ps: Install-Product node $env:nodejs_version
- # install modules
- - npm install
-
-# Post-install test scripts.
-test_script:
- # Output useful info for debugging.
- - node --version
- - npm --version
- # run tests
- - npm test
-
-# Don't actually build.
-build: off
diff --git a/node_modules/es5-ext/array/#/copy-within/implement.js b/node_modules/es5-ext/array/#/copy-within/implement.js
index 20910507a..4658fcb4b 100644
--- a/node_modules/es5-ext/array/#/copy-within/implement.js
+++ b/node_modules/es5-ext/array/#/copy-within/implement.js
@@ -1,9 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
- Object.defineProperty(Array.prototype, "copyWithin",
- { value: require("./shim"),
-configurable: true,
-enumerable: false,
- writable: true });
+ Object.defineProperty(Array.prototype, "copyWithin", {
+ value: require("./shim"),
+ configurable: true,
+ enumerable: false,
+ writable: true
+ });
}
diff --git a/node_modules/es5-ext/array/#/index.js b/node_modules/es5-ext/array/#/index.js
index d85645d13..596e83b5e 100644
--- a/node_modules/es5-ext/array/#/index.js
+++ b/node_modules/es5-ext/array/#/index.js
@@ -26,6 +26,7 @@ module.exports = {
"indexesOf": require("./indexes-of"),
"intersection": require("./intersection"),
"isCopy": require("./is-copy"),
+ "isEmpty": require("./is-empty"),
"isUniq": require("./is-uniq"),
"last": require("./last"),
"lastIndex": require("./last-index"),
diff --git a/node_modules/es5-ext/array/#/is-empty.js b/node_modules/es5-ext/array/#/is-empty.js
new file mode 100644
index 000000000..80a306955
--- /dev/null
+++ b/node_modules/es5-ext/array/#/is-empty.js
@@ -0,0 +1,8 @@
+"use strict";
+
+var ensureArray = require("../../object/ensure-array")
+ , firstIndex = require("./first-index");
+
+module.exports = function () {
+ return firstIndex.call(ensureArray(this)) === null;
+};
diff --git a/node_modules/es5-ext/circle.yml b/node_modules/es5-ext/circle.yml
deleted file mode 100644
index 0f2ee9a44..000000000
--- a/node_modules/es5-ext/circle.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-machine:
- node:
- version: 8
-
-test:
- override:
- - npm test
- - nvm use 6; npm test
- - npm run lint
- - nvm use 4; npm test
- - nvm use 0.12; npm test
diff --git a/node_modules/es5-ext/date/ensure-time-value.js b/node_modules/es5-ext/date/ensure-time-value.js
new file mode 100644
index 000000000..09f5afcf7
--- /dev/null
+++ b/node_modules/es5-ext/date/ensure-time-value.js
@@ -0,0 +1,10 @@
+"use strict";
+
+var safeToString = require("../safe-to-string")
+ , toInteger = require("../number/to-integer")
+ , isTimeValue = require("./is-time-value");
+
+module.exports = function (value) {
+ if (isTimeValue(value)) return toInteger(value);
+ throw new TypeError(safeToString(value) + " is not a valid time value");
+};
diff --git a/node_modules/es5-ext/date/index.js b/node_modules/es5-ext/date/index.js
index 507e5e69e..c14314975 100644
--- a/node_modules/es5-ext/date/index.js
+++ b/node_modules/es5-ext/date/index.js
@@ -2,6 +2,8 @@
module.exports = {
"#": require("./#"),
+ "ensureTimeValue": require("./ensure-time-value"),
"isDate": require("./is-date"),
+ "isTimeValue": require("./is-time-value"),
"validDate": require("./valid-date")
};
diff --git a/node_modules/es5-ext/date/is-time-value.js b/node_modules/es5-ext/date/is-time-value.js
new file mode 100644
index 000000000..4240fec5e
--- /dev/null
+++ b/node_modules/es5-ext/date/is-time-value.js
@@ -0,0 +1,12 @@
+"use strict";
+
+module.exports = function (value) {
+ try {
+ value = Number(value);
+ } catch (e) {
+ return false;
+ }
+ if (isNaN(value)) return false;
+ if (Math.abs(value) > 8.64e16) return false;
+ return true;
+};
diff --git a/node_modules/es5-ext/function/#/curry.js b/node_modules/es5-ext/function/#/curry.js
index a9b17814d..cc1e14a5a 100644
--- a/node_modules/es5-ext/function/#/curry.js
+++ b/node_modules/es5-ext/function/#/curry.js
@@ -7,7 +7,7 @@ var toPosInt = require("../../number/to-pos-integer")
, slice = Array.prototype.slice, apply = Function.prototype.apply
, curry;
-curry = function self (fn, length, preArgs) {
+curry = function self(fn, length, preArgs) {
return defineLength(function () {
var args = preArgs
? preArgs.concat(slice.call(arguments, 0, length - preArgs.length))
diff --git a/node_modules/es5-ext/index.js b/node_modules/es5-ext/index.js
index 5034dcd11..a6b57ea7e 100644
--- a/node_modules/es5-ext/index.js
+++ b/node_modules/es5-ext/index.js
@@ -4,6 +4,7 @@ module.exports = {
global: require("./global"),
optionalChaining: require("./optional-chaining"),
safeToString: require("./safe-to-string"),
+ toShortStringRepresentation: require("./to-short-string-representation"),
array: require("./array"),
boolean: require("./boolean"),
diff --git a/node_modules/es5-ext/json/safe-stringify.js b/node_modules/es5-ext/json/safe-stringify.js
index f2562541a..2154f6c01 100644
--- a/node_modules/es5-ext/json/safe-stringify.js
+++ b/node_modules/es5-ext/json/safe-stringify.js
@@ -6,7 +6,7 @@ var compact = require("../array/#/compact")
, isArray = Array.isArray
, stringify = JSON.stringify;
-module.exports = function self (value /*, replacer, space*/) {
+module.exports = function self(value /*, replacer, space*/) {
var replacer = arguments[1], space = arguments[2];
try {
return stringify(value, replacer, space);
diff --git a/node_modules/es5-ext/object/assign-deep.js b/node_modules/es5-ext/object/assign-deep.js
new file mode 100644
index 000000000..8034a038e
--- /dev/null
+++ b/node_modules/es5-ext/object/assign-deep.js
@@ -0,0 +1,33 @@
+"use strict";
+
+var includes = require("../array/#/contains")
+ , uniq = require("../array/#/uniq")
+ , objForEach = require("./for-each")
+ , isPlainObject = require("./is-plain-object")
+ , ensureValue = require("./valid-value");
+
+var isArray = Array.isArray, slice = Array.prototype.slice;
+
+var deepAssign = function (source, target) {
+ if (isPlainObject(source)) {
+ if (!isPlainObject(target)) return target;
+ objForEach(target, function (value, key) {
+ source[key] = deepAssign(source[key], value);
+ });
+ return source;
+ }
+ if (isArray(source)) {
+ if (!isArray(target)) return target;
+ target.forEach(function (item) {
+ if (!includes.call(source, item)) source.push(item);
+ });
+ return source;
+ }
+ return target;
+};
+
+module.exports = function (target /*, ...objects*/) {
+ return uniq
+ .call([ensureValue(target)].concat(slice.call(arguments, 1).map(ensureValue)))
+ .reduce(deepAssign);
+};
diff --git a/node_modules/es5-ext/object/copy-deep.js b/node_modules/es5-ext/object/copy-deep.js
index d1d39c982..39f9a1d69 100644
--- a/node_modules/es5-ext/object/copy-deep.js
+++ b/node_modules/es5-ext/object/copy-deep.js
@@ -3,40 +3,35 @@
var forEach = require("./for-each")
, isPlainObject = require("./is-plain-object")
, ensureValue = require("./valid-value")
- , isArray = Array.isArray
- , copy
- , copyItem;
+ , isArray = Array.isArray;
-copyItem = function (value) {
- var index;
- if (!isPlainObject(value) && !isArray(value)) return value;
- index = this[0].indexOf(value);
- if (index === -1) return copy.call(this, value);
- return this[1][index];
-};
+var copyValue = function (value, ancestors, ancestorsCopy) {
+ var mode;
+ if (isPlainObject(value)) mode = "object";
+ else if (isArray(value)) mode = "array";
+ if (!mode) return value;
+
+ var copy = ancestorsCopy[ancestors.indexOf(value)];
+ if (copy) return copy;
+ copy = mode === "object" ? {} : [];
-copy = function (source) {
- var target = isArray(source) ? [] : {};
- this[0].push(source);
- this[1].push(target);
- if (isArray(source)) {
- source.forEach(function (value, key) {
- target[key] = copyItem.call(this, value, key);
- }, this);
+ ancestors.push(value);
+ ancestorsCopy.push(copy);
+ if (mode === "object") {
+ forEach(value, function (item, key) {
+ copy[key] = copyValue(item, ancestors, ancestorsCopy);
+ });
} else {
- forEach(
- source,
- function (value, key) {
- target[key] = copyItem.call(this, value, key);
- },
- this
- );
+ value.forEach(function (item, index) {
+ copy[index] = copyValue(item, ancestors, ancestorsCopy);
+ });
}
- return target;
+ ancestors.pop();
+ ancestorsCopy.pop();
+
+ return copy;
};
module.exports = function (source) {
- var obj = Object(ensureValue(source));
- if (obj !== source) return obj;
- return copy.call([[], []], obj);
+ return copyValue(ensureValue(source), [], []);
};
diff --git a/node_modules/es5-ext/object/ensure-array.js b/node_modules/es5-ext/object/ensure-array.js
new file mode 100644
index 000000000..5ca7a9493
--- /dev/null
+++ b/node_modules/es5-ext/object/ensure-array.js
@@ -0,0 +1,9 @@
+"use strict";
+
+var toShortString = require("../to-short-string-representation")
+ , isArray = require("./is-array-like");
+
+module.exports = function (value) {
+ if (isArray(value)) return value;
+ throw new TypeError(toShortString(value) + " is not a array");
+};
diff --git a/node_modules/es5-ext/object/ensure-finite-number.js b/node_modules/es5-ext/object/ensure-finite-number.js
index fb4959f23..4f6e4b4a8 100644
--- a/node_modules/es5-ext/object/ensure-finite-number.js
+++ b/node_modules/es5-ext/object/ensure-finite-number.js
@@ -5,5 +5,5 @@ var isFiniteNumber = require("./is-finite-number")
module.exports = function (value) {
if (isFiniteNumber(value)) return Number(value);
- throw new TypeError(safeToString + " does not represent a finite number value");
+ throw new TypeError(safeToString(value) + " does not represent a finite number value");
};
diff --git a/node_modules/es5-ext/object/flatten.js b/node_modules/es5-ext/object/flatten.js
index 4895ed632..34e1ab09b 100644
--- a/node_modules/es5-ext/object/flatten.js
+++ b/node_modules/es5-ext/object/flatten.js
@@ -5,7 +5,7 @@ var isPlainObject = require("./is-plain-object")
, process;
-process = function self (value, key) {
+process = function self(value, key) {
if (isPlainObject(value)) forEach(value, self, this);
else this[key] = value;
};
diff --git a/node_modules/es5-ext/object/index.js b/node_modules/es5-ext/object/index.js
index 9b29a6eb3..7075be41a 100644
--- a/node_modules/es5-ext/object/index.js
+++ b/node_modules/es5-ext/object/index.js
@@ -2,6 +2,7 @@
module.exports = {
assign: require("./assign"),
+ assignDeep: require("./assign-deep"),
clear: require("./clear"),
compact: require("./compact"),
compare: require("./compare"),
@@ -9,6 +10,7 @@ module.exports = {
copyDeep: require("./copy-deep"),
count: require("./count"),
create: require("./create"),
+ ensureArray: require("./ensure-array"),
ensureFiniteNumber: require("./ensure-finite-number"),
ensureNaturalNumber: require("./ensure-natural-number"),
ensureNaturalNumberValue: require("./ensure-natural-number-value"),
@@ -31,6 +33,7 @@ module.exports = {
isFiniteNumber: require("./is-finite-number"),
isNumberValue: require("./is-number-value"),
isObject: require("./is-object"),
+ isPlainFunction: require("./is-plain-function"),
isPlainObject: require("./is-plain-object"),
isPromise: require("./is-promise"),
isValue: require("./is-value"),
diff --git a/node_modules/es5-ext/object/is-array-like.js b/node_modules/es5-ext/object/is-array-like.js
index 8e53500c4..fcb9115d2 100644
--- a/node_modules/es5-ext/object/is-array-like.js
+++ b/node_modules/es5-ext/object/is-array-like.js
@@ -11,7 +11,6 @@ module.exports = function (value) {
// Just checking ((typeof x === 'object') && (typeof x !== 'function'))
// won't work right for some cases, e.g.:
// type of instance of NodeList in Safari is a 'function'
-
((isObject(value) && !isFunction(value)) || typeof value === "string")) ||
false
);
diff --git a/node_modules/es5-ext/object/is-plain-function.js b/node_modules/es5-ext/object/is-plain-function.js
new file mode 100644
index 000000000..a2f32348a
--- /dev/null
+++ b/node_modules/es5-ext/object/is-plain-function.js
@@ -0,0 +1,11 @@
+"use strict";
+
+var isClassStr = RegExp.prototype.test.bind(/^\s*class[\s{/}]/)
+ , fnToString = Function.prototype.toString;
+
+module.exports = function (fn) {
+ if (typeof fn !== "function") return false;
+ if (typeof fn.call !== "function") return false;
+ if (typeof fn.apply !== "function") return false;
+ return !isClassStr(fnToString.call(fn));
+};
diff --git a/node_modules/es5-ext/object/set-prototype-of/shim.js b/node_modules/es5-ext/object/set-prototype-of/shim.js
index 312341e02..bc2178444 100644
--- a/node_modules/es5-ext/object/set-prototype-of/shim.js
+++ b/node_modules/es5-ext/object/set-prototype-of/shim.js
@@ -7,7 +7,7 @@
var isObject = require("../is-object")
, value = require("../valid-value")
- , objIsPrototypOf = Object.prototype.isPrototypeOf
+ , objIsPrototypeOf = Object.prototype.isPrototypeOf
, defineProperty = Object.defineProperty
, nullDesc = {
configurable: true,
@@ -40,10 +40,10 @@ module.exports = (function (status) {
};
}
} else {
- fn = function self (obj, prototype) {
+ fn = function self(obj, prototype) {
var isNullBase;
validate(obj, prototype);
- isNullBase = objIsPrototypOf.call(self.nullPolyfill, obj);
+ isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj);
if (isNullBase) delete self.nullPolyfill.__proto__;
if (prototype === null) prototype = self.nullPolyfill;
obj.__proto__ = prototype;
diff --git a/node_modules/es5-ext/package.json b/node_modules/es5-ext/package.json
index df0b29257..81b25b0aa 100644
--- a/node_modules/es5-ext/package.json
+++ b/node_modules/es5-ext/package.json
@@ -1,6 +1,6 @@
{
"name": "es5-ext",
- "version": "0.10.27",
+ "version": "0.10.37",
"description": "ECMAScript extensions and shims",
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
"keywords": [
@@ -26,12 +26,12 @@
"url": "git://github.com/medikoo/es5-ext.git"
},
"dependencies": {
- "es6-iterator": "2",
- "es6-symbol": "~3.1"
+ "es6-iterator": "~2.0.1",
+ "es6-symbol": "~3.1.1"
},
"devDependencies": {
- "eslint": "^4.2.0",
- "eslint-config-medikoo-es5": "^1.4.1",
+ "eslint": "^4.6.1",
+ "eslint-config-medikoo-es5": "^1.4.4",
"tad": "~0.2.7"
},
"eslintConfig": {
diff --git a/node_modules/es5-ext/string/#/repeat/shim.js b/node_modules/es5-ext/string/#/repeat/shim.js
index 7b8d8fbed..ac259a83b 100644
--- a/node_modules/es5-ext/string/#/repeat/shim.js
+++ b/node_modules/es5-ext/string/#/repeat/shim.js
@@ -1,6 +1,6 @@
-/* eslint no-bitwise: "off" */
-
-// Thanks: http://www.2ality.com/2014/01/efficient-string-repeat.html
+// Thanks
+// @rauchma http://www.2ality.com/2014/01/efficient-string-repeat.html
+// @mathiasbynens https://github.com/mathiasbynens/String.prototype.repeat/blob/4a4b567def/repeat.js
"use strict";
@@ -12,11 +12,13 @@ module.exports = function (count) {
count = toInteger(count);
if (count < 0) throw new RangeError("Count must be >= 0");
if (!isFinite(count)) throw new RangeError("Count must be < ∞");
- if (!count) return "";
- if (count === 1) return str;
result = "";
- if (count & 1) result += str;
- while ((count >>>= 1)) str += str;
- return result + str;
+ while (count) {
+ if (count % 2) result += str;
+ if (count > 1) str += str;
+ // eslint-disable-next-line no-bitwise
+ count >>= 1;
+ }
+ return result;
};
diff --git a/node_modules/es5-ext/string/index.js b/node_modules/es5-ext/string/index.js
index b2e7e6229..4393588f1 100644
--- a/node_modules/es5-ext/string/index.js
+++ b/node_modules/es5-ext/string/index.js
@@ -5,6 +5,7 @@ module.exports = {
"formatMethod": require("./format-method"),
"fromCodePoint": require("./from-code-point"),
"isString": require("./is-string"),
+ "random": require("./random"),
"randomUniq": require("./random-uniq"),
"raw": require("./raw")
};
diff --git a/node_modules/es5-ext/string/random-uniq.js b/node_modules/es5-ext/string/random-uniq.js
index ef549d3f6..ea10a8167 100644
--- a/node_modules/es5-ext/string/random-uniq.js
+++ b/node_modules/es5-ext/string/random-uniq.js
@@ -1,13 +1,13 @@
"use strict";
-var generated = Object.create(null)
-
- , random = Math.random;
+var generated = Object.create(null), random = Math.random;
module.exports = function () {
var str;
do {
- str = random().toString(36).slice(2);
-} while (generated[str]);
+ str = random()
+ .toString(36)
+ .slice(2);
+ } while (generated[str]);
return str;
};
diff --git a/node_modules/es5-ext/string/random.js b/node_modules/es5-ext/string/random.js
new file mode 100644
index 000000000..4ecec7fcd
--- /dev/null
+++ b/node_modules/es5-ext/string/random.js
@@ -0,0 +1,42 @@
+"use strict";
+
+var isValue = require("../object/is-value")
+ , toNaturalNumber = require("../number/to-pos-integer");
+
+var generated = Object.create(null), random = Math.random, uniqTryLimit = 100;
+
+var getChunk = function () {
+ return random()
+ .toString(36)
+ .slice(2);
+};
+
+var getString = function (/* length */) {
+ var str = getChunk(), length = arguments[0];
+ if (!isValue(length)) return str;
+ while (str.length < length) str += getChunk();
+ return str.slice(0, length);
+};
+
+module.exports = function (/* options */) {
+ var options = Object(arguments[0]), length = options.length, isUnique = options.isUnique;
+
+ if (isValue(length)) length = toNaturalNumber(length);
+
+ var str = getString(length);
+ if (isUnique) {
+ var count = 0;
+ while (generated[str]) {
+ if (++count === uniqTryLimit) {
+ throw new Error(
+ "Cannot generate random string.\n" +
+ "String.random is not designed to effectively generate many short and " +
+ "unique random strings"
+ );
+ }
+ str = getString(length);
+ }
+ generated[str] = true;
+ }
+ return str;
+};
diff --git a/node_modules/es5-ext/test/.eslintrc.json b/node_modules/es5-ext/test/.eslintrc.json
index 3e9128d4c..3ac4585bd 100644
--- a/node_modules/es5-ext/test/.eslintrc.json
+++ b/node_modules/es5-ext/test/.eslintrc.json
@@ -1,13 +1,14 @@
{
- "globals": {
- "Symbol": true
- },
- "rules": {
- "consistent-this": "off",
- "id-length": "off",
- "no-empty-function": "off",
- "no-new-wrappers": "off",
- "no-prototype-builtins": "off",
- "no-shadow": "off"
- }
+ "globals": {
+ "Symbol": true
+ },
+ "rules": {
+ "consistent-this": "off",
+ "id-length": "off",
+ "no-empty-function": "off",
+ "no-eval": "off",
+ "no-new-wrappers": "off",
+ "no-prototype-builtins": "off",
+ "no-shadow": "off"
+ }
}
diff --git a/node_modules/es5-ext/test/array/#/is-empty.js b/node_modules/es5-ext/test/array/#/is-empty.js
new file mode 100644
index 000000000..1e1c097b3
--- /dev/null
+++ b/node_modules/es5-ext/test/array/#/is-empty.js
@@ -0,0 +1,8 @@
+"use strict";
+
+module.exports = function (t, a) {
+ var x = {};
+ a(t.call([]), true, "Empty");
+ a(t.call({ length: 0 }), true, "Empty lists");
+ a(t.call([1, x, "raz"]), false, "Non empty");
+};
diff --git a/node_modules/es5-ext/test/array/to-array.js b/node_modules/es5-ext/test/array/to-array.js
index 4e93ad5db..a1f10a4a4 100644
--- a/node_modules/es5-ext/test/array/to-array.js
+++ b/node_modules/es5-ext/test/array/to-array.js
@@ -4,14 +4,24 @@ module.exports = function (t, a) {
var o = [1, 2, 3];
a(t(o), o, "Array");
a.deep(t("12r3v"), ["1", "2", "r", "3", "v"], "String");
- a.deep(t((function () {
- return arguments;
-}(3, o, "raz"))),
- [3, o, "raz"], "Arguments");
- a.deep(t((function () {
- return arguments;
-}(3))), [3],
- "Arguments with one numeric value");
+ a.deep(
+ t(
+ (function () {
+ return arguments;
+ })(3, o, "raz")
+ ),
+ [3, o, "raz"],
+ "Arguments"
+ );
+ a.deep(
+ t(
+ (function () {
+ return arguments;
+ })(3)
+ ),
+ [3],
+ "Arguments with one numeric value"
+ );
a.deep(t({ 0: "raz", 1: "dwa", length: 2 }), ["raz", "dwa"], "Other");
};
diff --git a/node_modules/es5-ext/test/date/ensure-time-value.js b/node_modules/es5-ext/test/date/ensure-time-value.js
new file mode 100644
index 000000000..39ddc23c4
--- /dev/null
+++ b/node_modules/es5-ext/test/date/ensure-time-value.js
@@ -0,0 +1,14 @@
+"use strict";
+
+module.exports = function (t, a) {
+ a(t(12), 12, "Number in range");
+ a(t(12.23), 12, "Rounds number in range");
+ a(t(-12.63), -12, "Rounds negative number in range");
+ a.throws(
+ function () {
+ t(NaN);
+ },
+ TypeError,
+ "Throws on invalid"
+ );
+};
diff --git a/node_modules/es5-ext/test/date/is-time-value.js b/node_modules/es5-ext/test/date/is-time-value.js
new file mode 100644
index 000000000..a21677c06
--- /dev/null
+++ b/node_modules/es5-ext/test/date/is-time-value.js
@@ -0,0 +1,15 @@
+"use strict";
+
+module.exports = function (t, a) {
+ a(t("arar"), false, "String");
+ a(t(12), true, "Number in range");
+ a(t(true), true, "Boolean");
+ a(t(new Date()), true, "Date");
+ a(t({}), false, "Plain object");
+ a(t(NaN), false, "NaN");
+ a(t(Infinity), false, "Infinity");
+ a(t(8.64e17), false, "Beyond range");
+ a(t(8.64e15), true, "Below range");
+ a(t(-8.64e17), false, "Negative beyond range");
+ a(t(-8.64e15), true, "Negative below range");
+};
diff --git a/node_modules/es5-ext/test/function/#/copy.js b/node_modules/es5-ext/test/function/#/copy.js
index 9948f1183..e7988ce74 100644
--- a/node_modules/es5-ext/test/function/#/copy.js
+++ b/node_modules/es5-ext/test/function/#/copy.js
@@ -3,7 +3,7 @@
module.exports = function (t, a) {
var foo = "raz", bar = "dwa";
// eslint-disable-next-line func-names
- var fn = function marko (a, b) {
+ var fn = function marko(a, b) {
return this + a + b + foo + bar;
};
var result, o = {};
diff --git a/node_modules/es5-ext/test/iterable/is.js b/node_modules/es5-ext/test/iterable/is.js
index 8c3158b22..04d34a83c 100644
--- a/node_modules/es5-ext/test/iterable/is.js
+++ b/node_modules/es5-ext/test/iterable/is.js
@@ -6,9 +6,15 @@ module.exports = function (t, a) {
var x;
a(t([]), true, "Array");
a(t(""), true, "String");
- a(t((function () {
- return arguments;
-}())), true, "Arguments");
+ a(
+ t(
+ (function () {
+ return arguments;
+ })()
+ ),
+ true,
+ "Arguments"
+ );
a(t({ length: 0 }), true, "List object");
a(t(function () {}), false, "Function");
a(t({}), false, "Plain object");
diff --git a/node_modules/es5-ext/test/object/assign-deep.js b/node_modules/es5-ext/test/object/assign-deep.js
new file mode 100644
index 000000000..071eeb739
--- /dev/null
+++ b/node_modules/es5-ext/test/object/assign-deep.js
@@ -0,0 +1,15 @@
+"use strict";
+
+module.exports = function (t, a) {
+ var o1 = { a: 1, b: 2 }, o2 = { b: 3, c: 4 };
+
+ a(t(o1, o2), o1, "Returns self");
+ a.deep(o1, { a: 1, b: 3, c: 4 }, "Single: content");
+
+ a.deep(t({}, o1, o2), { a: 1, b: 3, c: 4 }, "Multi argument");
+
+ var obj1 = { foo: { bar: 3, marko: true } }
+ , obj2 = { foo: { elo: 12, marko: false }, miszka: [23] };
+ a.deep(t({}, obj1, obj2), { foo: { bar: 3, marko: false, elo: 12 }, miszka: [23] });
+ a(t(true), true);
+};
diff --git a/node_modules/es5-ext/test/object/copy-deep.js b/node_modules/es5-ext/test/object/copy-deep.js
index 2dcbc3ab9..93813830f 100644
--- a/node_modules/es5-ext/test/object/copy-deep.js
+++ b/node_modules/es5-ext/test/object/copy-deep.js
@@ -3,19 +3,22 @@
var stringify = JSON.stringify;
module.exports = function (t, a) {
- var o = { 1: "raz", 2: "dwa", 3: "trzy" }
- , no = t(o);
+ var o = { 1: "raz", 2: "dwa", 3: "trzy" }, no = t(o);
a.not(no, o, "Return different object");
a(stringify(no), stringify(o), "Match properties and values");
- o = { foo: "bar",
-raz: { dwa: "dwa",
- trzy: { cztery: "pięć", sześć: "siedem" },
-osiem: {},
- dziewięć: function () { } },
+ o = {
+ foo: "bar",
+ raz: {
+ dwa: "dwa",
+ trzy: { cztery: "pięć", sześć: "siedem" },
+ osiem: {},
+ dziewięć: function () {}
+ },
dziesięć: 10,
-jedenaście: ["raz", ["dwa", "trzy", { elo: "true" }]] };
+ jedenaście: ["raz", ["dwa", "trzy", { elo: "true" }]]
+ };
o.raz.rec = o;
no = t(o);
@@ -28,4 +31,5 @@ jedenaście: ["raz", ["dwa", "trzy", { elo: "true" }]] };
a.not(o["jedenaście"], no["jedenaście"]);
a.not(o["jedenaście"][1], no["jedenaście"][1]);
a.not(o["jedenaście"][1][2], no["jedenaście"][1][2]);
+ a(t(true), true);
};
diff --git a/node_modules/es5-ext/test/object/ensure-array.js b/node_modules/es5-ext/test/object/ensure-array.js
new file mode 100644
index 000000000..fd3c32c97
--- /dev/null
+++ b/node_modules/es5-ext/test/object/ensure-array.js
@@ -0,0 +1,55 @@
+"use strict";
+
+module.exports = function (t, a) {
+ var arr = [];
+ a(t(arr), arr, "Array");
+ a(t(""), "", "String");
+ var args = (function () {
+ return arguments;
+ }());
+ a(t(args), args, "Arguments");
+ var arrayLike = { length: 0 };
+ a(t(arrayLike), arrayLike, "Array like");
+ a.throws(
+ function () {
+ t(function () {});
+ },
+ TypeError,
+ "Function"
+ );
+ a.throws(
+ function () {
+ t({});
+ },
+ TypeError,
+ "Plain object"
+ );
+ a.throws(
+ function () {
+ t(/raz/);
+ },
+ TypeError,
+ "Regexp"
+ );
+ a.throws(
+ function () {
+ t();
+ },
+ TypeError,
+ "No argument"
+ );
+ a.throws(
+ function () {
+ t(null);
+ },
+ TypeError,
+ "Null"
+ );
+ a.throws(
+ function () {
+ t(undefined);
+ },
+ TypeError,
+ "Undefined"
+ );
+};
diff --git a/node_modules/es5-ext/test/object/is-array-like.js b/node_modules/es5-ext/test/object/is-array-like.js
index c50ef1d12..50f5ce596 100644
--- a/node_modules/es5-ext/test/object/is-array-like.js
+++ b/node_modules/es5-ext/test/object/is-array-like.js
@@ -3,9 +3,15 @@
module.exports = function (t, a) {
a(t([]), true, "Array");
a(t(""), true, "String");
- a(t((function () {
- return arguments;
-}())), true, "Arguments");
+ a(
+ t(
+ (function () {
+ return arguments;
+ })()
+ ),
+ true,
+ "Arguments"
+ );
a(t({ length: 0 }), true, "List object");
a(t(function () {}), false, "Function");
a(t({}), false, "Plain object");
diff --git a/node_modules/es5-ext/test/object/is-plain-function.js b/node_modules/es5-ext/test/object/is-plain-function.js
new file mode 100644
index 000000000..9c1f5ed38
--- /dev/null
+++ b/node_modules/es5-ext/test/object/is-plain-function.js
@@ -0,0 +1,42 @@
+"use strict";
+
+var setPrototypeOf = require("../../object/set-prototype-of");
+
+module.exports = function (t, a) {
+ a(t(function () {}), true, "Function");
+ a(t({}), false, "Object");
+ a(t(), false, "Undefined");
+ a(t(null), false, "Null");
+ if (setPrototypeOf) {
+ a(
+ t(Object.setPrototypeOf(function () {}, Object.prototype)),
+ false,
+ "Function with non-function prototype"
+ );
+ }
+ var arrowfn;
+ try {
+ arrowfn = eval("(() => {})");
+ } catch (e) {}
+ if (arrowfn) {
+ a(t(arrowfn), true, "Arrow function");
+ }
+
+ var classFn;
+ try {
+ classFn = eval("(class {})");
+ } catch (e) {}
+ if (classFn) {
+ a(t(classFn), false, "Class");
+ }
+
+ var commentedClassFn;
+ try {
+ // Follows issue reported to ljhard/is-callable project:
+ // https://github.com/ljharb/is-callable/issues/4
+ commentedClassFn = eval("(class/*kkk*/\n//blah\n Bar\n//blah\n {})");
+ } catch (e) {}
+ if (commentedClassFn) {
+ a(t(commentedClassFn, false, "Class"), false, "Class with comments");
+ }
+};
diff --git a/node_modules/es5-ext/test/string/#/repeat/shim.js b/node_modules/es5-ext/test/string/#/repeat/shim.js
index 4d328390a..c5848840c 100644
--- a/node_modules/es5-ext/test/string/#/repeat/shim.js
+++ b/node_modules/es5-ext/test/string/#/repeat/shim.js
@@ -8,4 +8,5 @@ module.exports = function (t, a) {
a(t.call("raz", 3), "razrazraz", "Many chars");
a(t.call("raz", 3), "razrazraz", "Many chars");
a(t.call("razfoobar", 5), "razfoobarrazfoobarrazfoobarrazfoobarrazfoobar", "Many chars");
+ a(t.call("a", 300).length, 300);
};
diff --git a/node_modules/es5-ext/test/string/random.js b/node_modules/es5-ext/test/string/random.js
new file mode 100644
index 000000000..3fa44ca5b
--- /dev/null
+++ b/node_modules/es5-ext/test/string/random.js
@@ -0,0 +1,13 @@
+"use strict";
+
+var isValidFormat = RegExp.prototype.test.bind(/^[a-z0-9]+$/);
+
+module.exports = function (t, a) {
+ a(typeof t(), "string");
+ a.ok(t().length > 7);
+ a.not(t({ isUnique: true }), t({ isUnique: true }));
+ a.ok(isValidFormat(t()));
+ a(t({ length: 1 }).length, 1);
+ a(t({ length: 100 }).length, 100);
+ a(t({ length: 0 }), "");
+};
diff --git a/node_modules/es5-ext/test/to-short-string-representation.js b/node_modules/es5-ext/test/to-short-string-representation.js
new file mode 100644
index 000000000..ea9a06d89
--- /dev/null
+++ b/node_modules/es5-ext/test/to-short-string-representation.js
@@ -0,0 +1,23 @@
+"use strict";
+
+var repeat = require("../string/#/repeat");
+
+module.exports = function (t, a) {
+ a(t(), "undefined");
+ a(t(null), "null");
+ a(t(10), "10");
+ a(t("str"), "str");
+ a(
+ t({
+ toString: function () {
+ return "miszka";
+ }
+ }),
+ "miszka"
+ );
+ // eslint-disable-next-line symbol-description
+ if (typeof Symbol === "function") a(t(Symbol()), "Symbol()");
+ a(t(Object.create(null)), "<non-stringifiable value>");
+ a(t(repeat.call("a", 300)), repeat.call("a", 99) + "…");
+ a(t("mar\ntoo\nfar"), "mar\\ntoo\\nfar");
+};
diff --git a/node_modules/es5-ext/to-short-string-representation.js b/node_modules/es5-ext/to-short-string-representation.js
new file mode 100644
index 000000000..5aede5380
--- /dev/null
+++ b/node_modules/es5-ext/to-short-string-representation.js
@@ -0,0 +1,16 @@
+"use strict";
+
+var safeToString = require("./safe-to-string");
+
+var reNewLine = /[\n\r\u2028\u2029]/g;
+
+module.exports = function (value) {
+ var string = safeToString(value);
+ // Trim if too long
+ if (string.length > 100) string = string.slice(0, 99) + "…";
+ // Replace eventual new lines
+ string = string.replace(reNewLine, function (char) {
+ return JSON.stringify(char).slice(1, -1);
+ });
+ return string;
+};