aboutsummaryrefslogtreecommitdiff
path: root/node_modules/es5-ext/math
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/es5-ext/math
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/es5-ext/math')
-rw-r--r--node_modules/es5-ext/math/_decimal-adjust.js29
-rw-r--r--node_modules/es5-ext/math/_pack-ieee754.js88
-rw-r--r--node_modules/es5-ext/math/_unpack-ieee754.js33
-rw-r--r--node_modules/es5-ext/math/acosh/implement.js8
-rw-r--r--node_modules/es5-ext/math/acosh/index.js5
-rw-r--r--node_modules/es5-ext/math/acosh/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/acosh/shim.js12
-rw-r--r--node_modules/es5-ext/math/asinh/implement.js8
-rw-r--r--node_modules/es5-ext/math/asinh/index.js5
-rw-r--r--node_modules/es5-ext/math/asinh/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/asinh/shim.js15
-rw-r--r--node_modules/es5-ext/math/atanh/implement.js8
-rw-r--r--node_modules/es5-ext/math/atanh/index.js5
-rw-r--r--node_modules/es5-ext/math/atanh/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/atanh/shim.js14
-rw-r--r--node_modules/es5-ext/math/cbrt/implement.js8
-rw-r--r--node_modules/es5-ext/math/cbrt/index.js5
-rw-r--r--node_modules/es5-ext/math/cbrt/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/cbrt/shim.js12
-rw-r--r--node_modules/es5-ext/math/ceil-10.js3
-rw-r--r--node_modules/es5-ext/math/clz32/implement.js8
-rw-r--r--node_modules/es5-ext/math/clz32/index.js5
-rw-r--r--node_modules/es5-ext/math/clz32/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/clz32/shim.js7
-rw-r--r--node_modules/es5-ext/math/cosh/implement.js8
-rw-r--r--node_modules/es5-ext/math/cosh/index.js5
-rw-r--r--node_modules/es5-ext/math/cosh/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/cosh/shim.js11
-rw-r--r--node_modules/es5-ext/math/expm1/implement.js8
-rw-r--r--node_modules/es5-ext/math/expm1/index.js5
-rw-r--r--node_modules/es5-ext/math/expm1/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/expm1/shim.js16
-rw-r--r--node_modules/es5-ext/math/floor-10.js3
-rw-r--r--node_modules/es5-ext/math/fround/implement.js8
-rw-r--r--node_modules/es5-ext/math/fround/index.js5
-rw-r--r--node_modules/es5-ext/math/fround/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/fround/shim.js35
-rw-r--r--node_modules/es5-ext/math/hypot/implement.js8
-rw-r--r--node_modules/es5-ext/math/hypot/index.js5
-rw-r--r--node_modules/es5-ext/math/hypot/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/hypot/shim.js43
-rw-r--r--node_modules/es5-ext/math/imul/implement.js8
-rw-r--r--node_modules/es5-ext/math/imul/index.js5
-rw-r--r--node_modules/es5-ext/math/imul/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/imul/shim.js17
-rw-r--r--node_modules/es5-ext/math/index.js24
-rw-r--r--node_modules/es5-ext/math/log10/implement.js8
-rw-r--r--node_modules/es5-ext/math/log10/index.js5
-rw-r--r--node_modules/es5-ext/math/log10/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/log10/shim.js14
-rw-r--r--node_modules/es5-ext/math/log1p/implement.js8
-rw-r--r--node_modules/es5-ext/math/log1p/index.js5
-rw-r--r--node_modules/es5-ext/math/log1p/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/log1p/shim.js17
-rw-r--r--node_modules/es5-ext/math/log2/implement.js8
-rw-r--r--node_modules/es5-ext/math/log2/index.js5
-rw-r--r--node_modules/es5-ext/math/log2/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/log2/shim.js14
-rw-r--r--node_modules/es5-ext/math/round-10.js3
-rw-r--r--node_modules/es5-ext/math/sign/implement.js8
-rw-r--r--node_modules/es5-ext/math/sign/index.js5
-rw-r--r--node_modules/es5-ext/math/sign/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/sign/shim.js7
-rw-r--r--node_modules/es5-ext/math/sinh/implement.js8
-rw-r--r--node_modules/es5-ext/math/sinh/index.js5
-rw-r--r--node_modules/es5-ext/math/sinh/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/sinh/shim.js18
-rw-r--r--node_modules/es5-ext/math/tanh/implement.js8
-rw-r--r--node_modules/es5-ext/math/tanh/index.js5
-rw-r--r--node_modules/es5-ext/math/tanh/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/tanh/shim.js17
-rw-r--r--node_modules/es5-ext/math/trunc/implement.js8
-rw-r--r--node_modules/es5-ext/math/trunc/index.js5
-rw-r--r--node_modules/es5-ext/math/trunc/is-implemented.js7
-rw-r--r--node_modules/es5-ext/math/trunc/shim.js13
75 files changed, 805 insertions, 0 deletions
diff --git a/node_modules/es5-ext/math/_decimal-adjust.js b/node_modules/es5-ext/math/_decimal-adjust.js
new file mode 100644
index 00000000..fd0b0025
--- /dev/null
+++ b/node_modules/es5-ext/math/_decimal-adjust.js
@@ -0,0 +1,29 @@
+// Credit:
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
+// #Decimal_rounding
+
+"use strict";
+
+var isValue = require("../object/is-value")
+ , ensureInteger = require("../object/ensure-integer");
+
+var split = String.prototype.split;
+
+module.exports = function (type) {
+ return function (value/*, exp*/) {
+ value = Number(value);
+ var exp = arguments[1];
+ if (isValue(exp)) exp = ensureInteger(exp);
+ if (!value) return value;
+ if (!exp) return Math[type](value);
+ if (!isFinite(value)) return value;
+
+ // Shift
+ var tokens = split.call(value, "e");
+ value = Math[type](tokens[0] + "e" + ((tokens[1] || 0) - exp));
+
+ // Shift back
+ tokens = value.toString().split("e");
+ return Number(tokens[0] + "e" + (Number(tokens[1] || 0) + exp));
+ };
+};
diff --git a/node_modules/es5-ext/math/_pack-ieee754.js b/node_modules/es5-ext/math/_pack-ieee754.js
new file mode 100644
index 00000000..b77bc8d4
--- /dev/null
+++ b/node_modules/es5-ext/math/_pack-ieee754.js
@@ -0,0 +1,88 @@
+/* eslint no-bitwise: "off" */
+// Credit: https://github.com/paulmillr/es6-shim/
+
+"use strict";
+
+var abs = Math.abs
+ , floor = Math.floor
+ , log = Math.log
+ , min = Math.min
+ , pow = Math.pow
+ , LN2 = Math.LN2
+ , roundToEven;
+
+roundToEven = function (num) {
+ var whole = floor(num), fraction = num - whole;
+ if (fraction < 0.5) return whole;
+ if (fraction > 0.5) return whole + 1;
+ return whole % 2 ? whole + 1 : whole;
+};
+
+// eslint-disable-next-line max-statements
+module.exports = function (value, ebits, fbits) {
+ var bias = (1 << (ebits - 1)) - 1, sign, e, fraction, i, bits, str, bytes;
+
+ // Compute sign, exponent, fraction
+ if (isNaN(value)) {
+ // NaN
+ // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping
+ e = (1 << ebits) - 1;
+ fraction = pow(2, fbits - 1);
+ sign = 0;
+ } else if (value === Infinity || value === -Infinity) {
+ e = (1 << ebits) - 1;
+ fraction = 0;
+ sign = value < 0 ? 1 : 0;
+ } else if (value === 0) {
+ e = 0;
+ fraction = 0;
+ sign = 1 / value === -Infinity ? 1 : 0;
+ } else {
+ sign = value < 0;
+ value = abs(value);
+
+ if (value >= pow(2, 1 - bias)) {
+ e = min(floor(log(value) / LN2), 1023);
+ fraction = roundToEven(value / pow(2, e) * pow(2, fbits));
+ if (fraction / pow(2, fbits) >= 2) {
+ e += 1;
+ fraction = 1;
+ }
+ if (e > bias) {
+ // Overflow
+ e = (1 << ebits) - 1;
+ fraction = 0;
+ } else {
+ // Normal
+ e += bias;
+ fraction -= pow(2, fbits);
+ }
+ } else {
+ // Subnormal
+ e = 0;
+ fraction = roundToEven(value / pow(2, 1 - bias - fbits));
+ }
+ }
+
+ // Pack sign, exponent, fraction
+ bits = [];
+ for (i = fbits; i; i -= 1) {
+ bits.push(fraction % 2 ? 1 : 0);
+ fraction = floor(fraction / 2);
+ }
+ for (i = ebits; i; i -= 1) {
+ bits.push(e % 2 ? 1 : 0);
+ e = floor(e / 2);
+ }
+ bits.push(sign ? 1 : 0);
+ bits.reverse();
+ str = bits.join("");
+
+ // Bits to bytes
+ bytes = [];
+ while (str.length) {
+ bytes.push(parseInt(str.substring(0, 8), 2));
+ str = str.substring(8);
+ }
+ return bytes;
+};
diff --git a/node_modules/es5-ext/math/_unpack-ieee754.js b/node_modules/es5-ext/math/_unpack-ieee754.js
new file mode 100644
index 00000000..83fa9475
--- /dev/null
+++ b/node_modules/es5-ext/math/_unpack-ieee754.js
@@ -0,0 +1,33 @@
+/* eslint no-bitwise: "off" */
+// Credit: https://github.com/paulmillr/es6-shim/
+
+"use strict";
+
+var pow = Math.pow;
+
+module.exports = function (bytes, ebits, fbits) {
+ // Bytes to bits
+ var bits = [], i, j, bit, str, bias, sign, e, fraction;
+
+ for (i = bytes.length; i; i -= 1) {
+ bit = bytes[i - 1];
+ for (j = 8; j; j -= 1) {
+ bits.push(bit % 2 ? 1 : 0);
+ bit >>= 1;
+ }
+ }
+ bits.reverse();
+ str = bits.join("");
+
+ // Unpack sign, exponent, fraction
+ bias = (1 << (ebits - 1)) - 1;
+ sign = parseInt(str.substring(0, 1), 2) ? -1 : 1;
+ e = parseInt(str.substring(1, 1 + ebits), 2);
+ fraction = parseInt(str.substring(1 + ebits), 2);
+
+ // Produce number
+ if (e === (1 << ebits) - 1) return fraction === 0 ? sign * Infinity : NaN;
+ if (e > 0) return sign * pow(2, e - bias) * (1 + fraction / pow(2, fbits));
+ if (fraction !== 0) return sign * pow(2, -(bias - 1)) * (fraction / pow(2, fbits));
+ return sign < 0 ? -0 : 0;
+};
diff --git a/node_modules/es5-ext/math/acosh/implement.js b/node_modules/es5-ext/math/acosh/implement.js
new file mode 100644
index 00000000..ea75c7d1
--- /dev/null
+++ b/node_modules/es5-ext/math/acosh/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "acosh", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/acosh/index.js b/node_modules/es5-ext/math/acosh/index.js
new file mode 100644
index 00000000..160f6b99
--- /dev/null
+++ b/node_modules/es5-ext/math/acosh/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.acosh
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/acosh/is-implemented.js b/node_modules/es5-ext/math/acosh/is-implemented.js
new file mode 100644
index 00000000..2e973013
--- /dev/null
+++ b/node_modules/es5-ext/math/acosh/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var acosh = Math.acosh;
+ if (typeof acosh !== "function") return false;
+ return acosh(2) === 1.3169578969248166;
+};
diff --git a/node_modules/es5-ext/math/acosh/shim.js b/node_modules/es5-ext/math/acosh/shim.js
new file mode 100644
index 00000000..3e632ffb
--- /dev/null
+++ b/node_modules/es5-ext/math/acosh/shim.js
@@ -0,0 +1,12 @@
+"use strict";
+
+var log = Math.log, sqrt = Math.sqrt;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value < 1) return NaN;
+ if (value === 1) return 0;
+ if (value === Infinity) return value;
+ return log(value + sqrt(value * value - 1));
+};
diff --git a/node_modules/es5-ext/math/asinh/implement.js b/node_modules/es5-ext/math/asinh/implement.js
new file mode 100644
index 00000000..efa6704e
--- /dev/null
+++ b/node_modules/es5-ext/math/asinh/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "asinh", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/asinh/index.js b/node_modules/es5-ext/math/asinh/index.js
new file mode 100644
index 00000000..b5fb120f
--- /dev/null
+++ b/node_modules/es5-ext/math/asinh/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.asinh
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/asinh/is-implemented.js b/node_modules/es5-ext/math/asinh/is-implemented.js
new file mode 100644
index 00000000..a7e0f20f
--- /dev/null
+++ b/node_modules/es5-ext/math/asinh/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var asinh = Math.asinh;
+ if (typeof asinh !== "function") return false;
+ return asinh(2) === 1.4436354751788103;
+};
diff --git a/node_modules/es5-ext/math/asinh/shim.js b/node_modules/es5-ext/math/asinh/shim.js
new file mode 100644
index 00000000..30ce2e4d
--- /dev/null
+++ b/node_modules/es5-ext/math/asinh/shim.js
@@ -0,0 +1,15 @@
+"use strict";
+
+var log = Math.log, sqrt = Math.sqrt;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return value;
+ if (!isFinite(value)) return value;
+ if (value < 0) {
+ value = -value;
+ return -log(value + sqrt(value * value + 1));
+ }
+ return log(value + sqrt(value * value + 1));
+};
diff --git a/node_modules/es5-ext/math/atanh/implement.js b/node_modules/es5-ext/math/atanh/implement.js
new file mode 100644
index 00000000..47d5cc22
--- /dev/null
+++ b/node_modules/es5-ext/math/atanh/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "atanh", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/atanh/index.js b/node_modules/es5-ext/math/atanh/index.js
new file mode 100644
index 00000000..51fbcd66
--- /dev/null
+++ b/node_modules/es5-ext/math/atanh/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.atanh
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/atanh/is-implemented.js b/node_modules/es5-ext/math/atanh/is-implemented.js
new file mode 100644
index 00000000..4787c4fa
--- /dev/null
+++ b/node_modules/es5-ext/math/atanh/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var atanh = Math.atanh;
+ if (typeof atanh !== "function") return false;
+ return Math.round(atanh(0.5) * 1e15) === 549306144334055;
+};
diff --git a/node_modules/es5-ext/math/atanh/shim.js b/node_modules/es5-ext/math/atanh/shim.js
new file mode 100644
index 00000000..9383e971
--- /dev/null
+++ b/node_modules/es5-ext/math/atanh/shim.js
@@ -0,0 +1,14 @@
+"use strict";
+
+var log = Math.log;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value < -1) return NaN;
+ if (value > 1) return NaN;
+ if (value === -1) return -Infinity;
+ if (value === 1) return Infinity;
+ if (value === 0) return value;
+ return 0.5 * log((1 + value) / (1 - value));
+};
diff --git a/node_modules/es5-ext/math/cbrt/implement.js b/node_modules/es5-ext/math/cbrt/implement.js
new file mode 100644
index 00000000..f5adbab0
--- /dev/null
+++ b/node_modules/es5-ext/math/cbrt/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "cbrt", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/cbrt/index.js b/node_modules/es5-ext/math/cbrt/index.js
new file mode 100644
index 00000000..47806407
--- /dev/null
+++ b/node_modules/es5-ext/math/cbrt/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.cbrt
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/cbrt/is-implemented.js b/node_modules/es5-ext/math/cbrt/is-implemented.js
new file mode 100644
index 00000000..a8ac0db2
--- /dev/null
+++ b/node_modules/es5-ext/math/cbrt/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var cbrt = Math.cbrt;
+ if (typeof cbrt !== "function") return false;
+ return cbrt(2) === 1.2599210498948732;
+};
diff --git a/node_modules/es5-ext/math/cbrt/shim.js b/node_modules/es5-ext/math/cbrt/shim.js
new file mode 100644
index 00000000..8871c552
--- /dev/null
+++ b/node_modules/es5-ext/math/cbrt/shim.js
@@ -0,0 +1,12 @@
+"use strict";
+
+var pow = Math.pow;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return value;
+ if (!isFinite(value)) return value;
+ if (value < 0) return -pow(-value, 1 / 3);
+ return pow(value, 1 / 3);
+};
diff --git a/node_modules/es5-ext/math/ceil-10.js b/node_modules/es5-ext/math/ceil-10.js
new file mode 100644
index 00000000..351221f6
--- /dev/null
+++ b/node_modules/es5-ext/math/ceil-10.js
@@ -0,0 +1,3 @@
+"use strict";
+
+module.exports = require("./_decimal-adjust")("ceil");
diff --git a/node_modules/es5-ext/math/clz32/implement.js b/node_modules/es5-ext/math/clz32/implement.js
new file mode 100644
index 00000000..10b4a41d
--- /dev/null
+++ b/node_modules/es5-ext/math/clz32/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "clz32", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/clz32/index.js b/node_modules/es5-ext/math/clz32/index.js
new file mode 100644
index 00000000..a16ee33a
--- /dev/null
+++ b/node_modules/es5-ext/math/clz32/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.clz32
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/clz32/is-implemented.js b/node_modules/es5-ext/math/clz32/is-implemented.js
new file mode 100644
index 00000000..ee6d8828
--- /dev/null
+++ b/node_modules/es5-ext/math/clz32/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var clz32 = Math.clz32;
+ if (typeof clz32 !== "function") return false;
+ return clz32(1000) === 22;
+};
diff --git a/node_modules/es5-ext/math/clz32/shim.js b/node_modules/es5-ext/math/clz32/shim.js
new file mode 100644
index 00000000..2b526c2c
--- /dev/null
+++ b/node_modules/es5-ext/math/clz32/shim.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function (value) {
+ // eslint-disable-next-line no-bitwise
+ value >>>= 0;
+ return value ? 32 - value.toString(2).length : 32;
+};
diff --git a/node_modules/es5-ext/math/cosh/implement.js b/node_modules/es5-ext/math/cosh/implement.js
new file mode 100644
index 00000000..6f42b387
--- /dev/null
+++ b/node_modules/es5-ext/math/cosh/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "cosh", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/cosh/index.js b/node_modules/es5-ext/math/cosh/index.js
new file mode 100644
index 00000000..5ed349af
--- /dev/null
+++ b/node_modules/es5-ext/math/cosh/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.cosh
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/cosh/is-implemented.js b/node_modules/es5-ext/math/cosh/is-implemented.js
new file mode 100644
index 00000000..7173054c
--- /dev/null
+++ b/node_modules/es5-ext/math/cosh/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var cosh = Math.cosh;
+ if (typeof cosh !== "function") return false;
+ return cosh(1) === 1.5430806348152437;
+};
diff --git a/node_modules/es5-ext/math/cosh/shim.js b/node_modules/es5-ext/math/cosh/shim.js
new file mode 100644
index 00000000..c762c84d
--- /dev/null
+++ b/node_modules/es5-ext/math/cosh/shim.js
@@ -0,0 +1,11 @@
+"use strict";
+
+var exp = Math.exp;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return 1;
+ if (!isFinite(value)) return Infinity;
+ return (exp(value) + exp(-value)) / 2;
+};
diff --git a/node_modules/es5-ext/math/expm1/implement.js b/node_modules/es5-ext/math/expm1/implement.js
new file mode 100644
index 00000000..8c9d8111
--- /dev/null
+++ b/node_modules/es5-ext/math/expm1/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "expm1", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/expm1/index.js b/node_modules/es5-ext/math/expm1/index.js
new file mode 100644
index 00000000..5b5dff6b
--- /dev/null
+++ b/node_modules/es5-ext/math/expm1/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.expm1
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/expm1/is-implemented.js b/node_modules/es5-ext/math/expm1/is-implemented.js
new file mode 100644
index 00000000..dfd056e0
--- /dev/null
+++ b/node_modules/es5-ext/math/expm1/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var expm1 = Math.expm1;
+ if (typeof expm1 !== "function") return false;
+ return expm1(1).toFixed(15) === "1.718281828459045";
+};
diff --git a/node_modules/es5-ext/math/expm1/shim.js b/node_modules/es5-ext/math/expm1/shim.js
new file mode 100644
index 00000000..ce737b3b
--- /dev/null
+++ b/node_modules/es5-ext/math/expm1/shim.js
@@ -0,0 +1,16 @@
+// Thanks: https://github.com/monolithed/ECMAScript-6
+
+"use strict";
+
+var exp = Math.exp;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return value;
+ if (value === Infinity) return Infinity;
+ if (value === -Infinity) return -1;
+
+ if (value > -1.0e-6 && value < 1.0e-6) return value + value * value / 2;
+ return exp(value) - 1;
+};
diff --git a/node_modules/es5-ext/math/floor-10.js b/node_modules/es5-ext/math/floor-10.js
new file mode 100644
index 00000000..3cb0c119
--- /dev/null
+++ b/node_modules/es5-ext/math/floor-10.js
@@ -0,0 +1,3 @@
+"use strict";
+
+module.exports = require("./_decimal-adjust")("floor");
diff --git a/node_modules/es5-ext/math/fround/implement.js b/node_modules/es5-ext/math/fround/implement.js
new file mode 100644
index 00000000..b54d2fca
--- /dev/null
+++ b/node_modules/es5-ext/math/fround/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "fround", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/fround/index.js b/node_modules/es5-ext/math/fround/index.js
new file mode 100644
index 00000000..db409e83
--- /dev/null
+++ b/node_modules/es5-ext/math/fround/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.fround
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/fround/is-implemented.js b/node_modules/es5-ext/math/fround/is-implemented.js
new file mode 100644
index 00000000..ad2b705d
--- /dev/null
+++ b/node_modules/es5-ext/math/fround/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var fround = Math.fround;
+ if (typeof fround !== "function") return false;
+ return fround(1.337) === 1.3370000123977661;
+};
diff --git a/node_modules/es5-ext/math/fround/shim.js b/node_modules/es5-ext/math/fround/shim.js
new file mode 100644
index 00000000..bfbc54c6
--- /dev/null
+++ b/node_modules/es5-ext/math/fround/shim.js
@@ -0,0 +1,35 @@
+/* global Float32Array */
+
+// Credit: https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js
+
+"use strict";
+
+var toFloat32;
+
+if (typeof Float32Array === "undefined") {
+ toFloat32 = (function () {
+ var pack = require("../_pack-ieee754")
+ , unpack = require("../_unpack-ieee754");
+
+ return function (value) {
+ return unpack(pack(value, 8, 23), 8, 23);
+ };
+ }());
+} else {
+ toFloat32 = (function () {
+ var float32Array = new Float32Array(1);
+ return function (num) {
+ float32Array[0] = num;
+ return float32Array[0];
+ };
+ }());
+}
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return value;
+ if (!isFinite(value)) return value;
+
+ return toFloat32(value);
+};
diff --git a/node_modules/es5-ext/math/hypot/implement.js b/node_modules/es5-ext/math/hypot/implement.js
new file mode 100644
index 00000000..e2b3928b
--- /dev/null
+++ b/node_modules/es5-ext/math/hypot/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "hypot", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/hypot/index.js b/node_modules/es5-ext/math/hypot/index.js
new file mode 100644
index 00000000..a030a419
--- /dev/null
+++ b/node_modules/es5-ext/math/hypot/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.hypot
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/hypot/is-implemented.js b/node_modules/es5-ext/math/hypot/is-implemented.js
new file mode 100644
index 00000000..d317bc7e
--- /dev/null
+++ b/node_modules/es5-ext/math/hypot/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var hypot = Math.hypot;
+ if (typeof hypot !== "function") return false;
+ return hypot(3, 4) === 5;
+};
diff --git a/node_modules/es5-ext/math/hypot/shim.js b/node_modules/es5-ext/math/hypot/shim.js
new file mode 100644
index 00000000..2a92b171
--- /dev/null
+++ b/node_modules/es5-ext/math/hypot/shim.js
@@ -0,0 +1,43 @@
+// Thanks for hints: https://github.com/paulmillr/es6-shim
+
+"use strict";
+
+var some = Array.prototype.some
+ , abs = Math.abs
+ , sqrt = Math.sqrt
+ , compare = function (val1, val2) {
+ return val2 - val1;
+}
+ , divide = function (value) {
+ return value / this;
+}
+ , add = function (sum, number) {
+ return sum + number * number;
+};
+
+// eslint-disable-next-line no-unused-vars
+module.exports = function (val1, val2 /*, …valn*/) {
+ var result, numbers;
+ if (!arguments.length) return 0;
+ some.call(arguments, function (val) {
+ if (isNaN(val)) {
+ result = NaN;
+ return false;
+ }
+ if (!isFinite(val)) {
+ result = Infinity;
+ return true;
+ }
+ if (result !== undefined) return false;
+ val = Number(val);
+ if (val === 0) return false;
+ if (numbers) numbers.push(abs(val));
+ else numbers = [abs(val)];
+ return false;
+ });
+ if (result !== undefined) return result;
+ if (!numbers) return 0;
+
+ numbers.sort(compare);
+ return numbers[0] * sqrt(numbers.map(divide, numbers[0]).reduce(add, 0));
+};
diff --git a/node_modules/es5-ext/math/imul/implement.js b/node_modules/es5-ext/math/imul/implement.js
new file mode 100644
index 00000000..bff57735
--- /dev/null
+++ b/node_modules/es5-ext/math/imul/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "imul", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/imul/index.js b/node_modules/es5-ext/math/imul/index.js
new file mode 100644
index 00000000..a756d594
--- /dev/null
+++ b/node_modules/es5-ext/math/imul/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.imul
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/imul/is-implemented.js b/node_modules/es5-ext/math/imul/is-implemented.js
new file mode 100644
index 00000000..0f329198
--- /dev/null
+++ b/node_modules/es5-ext/math/imul/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var imul = Math.imul;
+ if (typeof imul !== "function") return false;
+ return imul(-1, 8) === -8;
+};
diff --git a/node_modules/es5-ext/math/imul/shim.js b/node_modules/es5-ext/math/imul/shim.js
new file mode 100644
index 00000000..a14e5895
--- /dev/null
+++ b/node_modules/es5-ext/math/imul/shim.js
@@ -0,0 +1,17 @@
+/* eslint no-bitwise: "off" */
+
+// Thanks: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
+// /Global_Objects/Math/imul
+
+"use strict";
+
+module.exports = function (val1, val2) {
+ var xh = (val1 >>> 16) & 0xffff
+ , xl = val1 & 0xffff
+ , yh = (val2 >>> 16) & 0xffff
+ , yl = val2 & 0xffff;
+
+ // The shift by 0 fixes the sign on the high part
+ // the final |0 converts the unsigned value into a signed value
+ return (xl * yl + ((xh * yl + xl * yh) << 16 >>> 0)) | 0;
+};
diff --git a/node_modules/es5-ext/math/index.js b/node_modules/es5-ext/math/index.js
new file mode 100644
index 00000000..a59269cc
--- /dev/null
+++ b/node_modules/es5-ext/math/index.js
@@ -0,0 +1,24 @@
+"use strict";
+
+module.exports = {
+ acosh: require("./acosh"),
+ asinh: require("./asinh"),
+ atanh: require("./atanh"),
+ cbrt: require("./cbrt"),
+ ceil10: require("./ceil-10"),
+ clz32: require("./clz32"),
+ cosh: require("./cosh"),
+ expm1: require("./expm1"),
+ floor10: require("./floor-10"),
+ fround: require("./fround"),
+ hypot: require("./hypot"),
+ imul: require("./imul"),
+ log10: require("./log10"),
+ log2: require("./log2"),
+ log1p: require("./log1p"),
+ round10: require("./round-10"),
+ sign: require("./sign"),
+ sinh: require("./sinh"),
+ tanh: require("./tanh"),
+ trunc: require("./trunc")
+};
diff --git a/node_modules/es5-ext/math/log10/implement.js b/node_modules/es5-ext/math/log10/implement.js
new file mode 100644
index 00000000..669cee88
--- /dev/null
+++ b/node_modules/es5-ext/math/log10/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "log10", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/log10/index.js b/node_modules/es5-ext/math/log10/index.js
new file mode 100644
index 00000000..bc2ec481
--- /dev/null
+++ b/node_modules/es5-ext/math/log10/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.log10
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/log10/is-implemented.js b/node_modules/es5-ext/math/log10/is-implemented.js
new file mode 100644
index 00000000..f2217597
--- /dev/null
+++ b/node_modules/es5-ext/math/log10/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var log10 = Math.log10;
+ if (typeof log10 !== "function") return false;
+ return log10(2) === 0.3010299956639812;
+};
diff --git a/node_modules/es5-ext/math/log10/shim.js b/node_modules/es5-ext/math/log10/shim.js
new file mode 100644
index 00000000..e8599a26
--- /dev/null
+++ b/node_modules/es5-ext/math/log10/shim.js
@@ -0,0 +1,14 @@
+"use strict";
+
+var log = Math.log, LOG10E = Math.LOG10E;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value < 0) return NaN;
+ if (value === 0) return -Infinity;
+ if (value === 1) return 0;
+ if (value === Infinity) return Infinity;
+
+ return log(value) * LOG10E;
+};
diff --git a/node_modules/es5-ext/math/log1p/implement.js b/node_modules/es5-ext/math/log1p/implement.js
new file mode 100644
index 00000000..36fcee61
--- /dev/null
+++ b/node_modules/es5-ext/math/log1p/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "log1p", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/log1p/index.js b/node_modules/es5-ext/math/log1p/index.js
new file mode 100644
index 00000000..41c67364
--- /dev/null
+++ b/node_modules/es5-ext/math/log1p/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.log1p
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/log1p/is-implemented.js b/node_modules/es5-ext/math/log1p/is-implemented.js
new file mode 100644
index 00000000..7626ab47
--- /dev/null
+++ b/node_modules/es5-ext/math/log1p/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var log1p = Math.log1p;
+ if (typeof log1p !== "function") return false;
+ return log1p(1) === 0.6931471805599453;
+};
diff --git a/node_modules/es5-ext/math/log1p/shim.js b/node_modules/es5-ext/math/log1p/shim.js
new file mode 100644
index 00000000..7c6f2273
--- /dev/null
+++ b/node_modules/es5-ext/math/log1p/shim.js
@@ -0,0 +1,17 @@
+// Thanks: https://github.com/monolithed/ECMAScript-6/blob/master/ES6.js
+
+"use strict";
+
+var log = Math.log;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value < -1) return NaN;
+ if (value === -1) return -Infinity;
+ if (value === 0) return value;
+ if (value === Infinity) return Infinity;
+
+ if (value > -1.0e-8 && value < 1.0e-8) return value - value * value / 2;
+ return log(1 + value);
+};
diff --git a/node_modules/es5-ext/math/log2/implement.js b/node_modules/es5-ext/math/log2/implement.js
new file mode 100644
index 00000000..f1c04e09
--- /dev/null
+++ b/node_modules/es5-ext/math/log2/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "log2", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/log2/index.js b/node_modules/es5-ext/math/log2/index.js
new file mode 100644
index 00000000..d319caec
--- /dev/null
+++ b/node_modules/es5-ext/math/log2/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.log2
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/log2/is-implemented.js b/node_modules/es5-ext/math/log2/is-implemented.js
new file mode 100644
index 00000000..c70963f6
--- /dev/null
+++ b/node_modules/es5-ext/math/log2/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var log2 = Math.log2;
+ if (typeof log2 !== "function") return false;
+ return log2(3).toFixed(15) === "1.584962500721156";
+};
diff --git a/node_modules/es5-ext/math/log2/shim.js b/node_modules/es5-ext/math/log2/shim.js
new file mode 100644
index 00000000..51fcdae9
--- /dev/null
+++ b/node_modules/es5-ext/math/log2/shim.js
@@ -0,0 +1,14 @@
+"use strict";
+
+var log = Math.log, LOG2E = Math.LOG2E;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value < 0) return NaN;
+ if (value === 0) return -Infinity;
+ if (value === 1) return 0;
+ if (value === Infinity) return Infinity;
+
+ return log(value) * LOG2E;
+};
diff --git a/node_modules/es5-ext/math/round-10.js b/node_modules/es5-ext/math/round-10.js
new file mode 100644
index 00000000..228c2351
--- /dev/null
+++ b/node_modules/es5-ext/math/round-10.js
@@ -0,0 +1,3 @@
+"use strict";
+
+module.exports = require("./_decimal-adjust")("round");
diff --git a/node_modules/es5-ext/math/sign/implement.js b/node_modules/es5-ext/math/sign/implement.js
new file mode 100644
index 00000000..bc7da14d
--- /dev/null
+++ b/node_modules/es5-ext/math/sign/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "sign", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/sign/index.js b/node_modules/es5-ext/math/sign/index.js
new file mode 100644
index 00000000..9f286564
--- /dev/null
+++ b/node_modules/es5-ext/math/sign/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.sign
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/sign/is-implemented.js b/node_modules/es5-ext/math/sign/is-implemented.js
new file mode 100644
index 00000000..23ff83a6
--- /dev/null
+++ b/node_modules/es5-ext/math/sign/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var sign = Math.sign;
+ if (typeof sign !== "function") return false;
+ return (sign(10) === 1) && (sign(-20) === -1);
+};
diff --git a/node_modules/es5-ext/math/sign/shim.js b/node_modules/es5-ext/math/sign/shim.js
new file mode 100644
index 00000000..760c69d1
--- /dev/null
+++ b/node_modules/es5-ext/math/sign/shim.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function (value) {
+ value = Number(value);
+ if (isNaN(value) || (value === 0)) return value;
+ return value > 0 ? 1 : -1;
+};
diff --git a/node_modules/es5-ext/math/sinh/implement.js b/node_modules/es5-ext/math/sinh/implement.js
new file mode 100644
index 00000000..cc4c40bc
--- /dev/null
+++ b/node_modules/es5-ext/math/sinh/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "sinh", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/sinh/index.js b/node_modules/es5-ext/math/sinh/index.js
new file mode 100644
index 00000000..2c43dce1
--- /dev/null
+++ b/node_modules/es5-ext/math/sinh/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.sinh
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/sinh/is-implemented.js b/node_modules/es5-ext/math/sinh/is-implemented.js
new file mode 100644
index 00000000..5e4ee40c
--- /dev/null
+++ b/node_modules/es5-ext/math/sinh/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var sinh = Math.sinh;
+ if (typeof sinh !== "function") return false;
+ return (sinh(1) === 1.1752011936438014) && (sinh(Number.MIN_VALUE) === 5e-324);
+};
diff --git a/node_modules/es5-ext/math/sinh/shim.js b/node_modules/es5-ext/math/sinh/shim.js
new file mode 100644
index 00000000..fc6a0477
--- /dev/null
+++ b/node_modules/es5-ext/math/sinh/shim.js
@@ -0,0 +1,18 @@
+// Parts of implementation taken from es6-shim project
+// See: https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js
+
+"use strict";
+
+var expm1 = require("../expm1")
+ , abs = Math.abs
+ , exp = Math.exp
+ , e = Math.E;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return value;
+ if (!isFinite(value)) return value;
+ if (abs(value) < 1) return (expm1(value) - expm1(-value)) / 2;
+ return (exp(value - 1) - exp(-value - 1)) * e / 2;
+};
diff --git a/node_modules/es5-ext/math/tanh/implement.js b/node_modules/es5-ext/math/tanh/implement.js
new file mode 100644
index 00000000..9e30d10d
--- /dev/null
+++ b/node_modules/es5-ext/math/tanh/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "tanh", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/tanh/index.js b/node_modules/es5-ext/math/tanh/index.js
new file mode 100644
index 00000000..7c45d988
--- /dev/null
+++ b/node_modules/es5-ext/math/tanh/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.tanh
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/tanh/is-implemented.js b/node_modules/es5-ext/math/tanh/is-implemented.js
new file mode 100644
index 00000000..b17a1bc4
--- /dev/null
+++ b/node_modules/es5-ext/math/tanh/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var tanh = Math.tanh;
+ if (typeof tanh !== "function") return false;
+ return (tanh(1) === 0.7615941559557649) && (tanh(Number.MAX_VALUE) === 1);
+};
diff --git a/node_modules/es5-ext/math/tanh/shim.js b/node_modules/es5-ext/math/tanh/shim.js
new file mode 100644
index 00000000..974dd7cd
--- /dev/null
+++ b/node_modules/es5-ext/math/tanh/shim.js
@@ -0,0 +1,17 @@
+"use strict";
+
+var exp = Math.exp;
+
+module.exports = function (value) {
+ var num1, num2;
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return value;
+ if (value === Infinity) return 1;
+ if (value === -Infinity) return -1;
+ num1 = exp(value);
+ if (num1 === Infinity) return 1;
+ num2 = exp(-value);
+ if (num2 === Infinity) return -1;
+ return (num1 - num2) / (num1 + num2);
+};
diff --git a/node_modules/es5-ext/math/trunc/implement.js b/node_modules/es5-ext/math/trunc/implement.js
new file mode 100644
index 00000000..1ecc124c
--- /dev/null
+++ b/node_modules/es5-ext/math/trunc/implement.js
@@ -0,0 +1,8 @@
+"use strict";
+
+if (!require("./is-implemented")()) {
+ Object.defineProperty(Math, "trunc", { value: require("./shim"),
+ configurable: true,
+enumerable: false,
+writable: true });
+}
diff --git a/node_modules/es5-ext/math/trunc/index.js b/node_modules/es5-ext/math/trunc/index.js
new file mode 100644
index 00000000..94c02691
--- /dev/null
+++ b/node_modules/es5-ext/math/trunc/index.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = require("./is-implemented")()
+ ? Math.trunc
+ : require("./shim");
diff --git a/node_modules/es5-ext/math/trunc/is-implemented.js b/node_modules/es5-ext/math/trunc/is-implemented.js
new file mode 100644
index 00000000..b1507352
--- /dev/null
+++ b/node_modules/es5-ext/math/trunc/is-implemented.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = function () {
+ var trunc = Math.trunc;
+ if (typeof trunc !== "function") return false;
+ return (trunc(13.67) === 13) && (trunc(-13.67) === -13);
+};
diff --git a/node_modules/es5-ext/math/trunc/shim.js b/node_modules/es5-ext/math/trunc/shim.js
new file mode 100644
index 00000000..bf6ac8cc
--- /dev/null
+++ b/node_modules/es5-ext/math/trunc/shim.js
@@ -0,0 +1,13 @@
+"use strict";
+
+var floor = Math.floor;
+
+module.exports = function (value) {
+ if (isNaN(value)) return NaN;
+ value = Number(value);
+ if (value === 0) return value;
+ if (value === Infinity) return Infinity;
+ if (value === -Infinity) return -Infinity;
+ if (value > 0) return floor(value);
+ return -floor(-value);
+};