0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

36
web/node_modules/es5-ext/test/object/_iterate.js generated vendored Normal file
View file

@ -0,0 +1,36 @@
"use strict";
module.exports = function (t, a) {
var o = { raz: 1, dwa: 2, trzy: 3 }, o2 = {}, o3 = {}, arr, i = -1;
t = t("forEach");
t(
o,
function (value, name, self, index) {
o2[name] = value;
a(index, ++i, "Index");
a(self, o, "Self");
a(this, o3, "Scope");
},
o3
);
a.deep(o2, o);
arr = [];
o2 = {};
i = -1;
t(
o,
function (value, name, self, index) {
arr.push(value);
o2[name] = value;
a(index, ++i, "Index");
a(self, o, "Self");
a(this, o3, "Scope");
},
o3,
function (a, b) { return o[b] - o[a]; }
);
a.deep(o2, o, "Sort by Values: Content");
a.deep(arr, [3, 2, 1], "Sort by Values: Order");
};

27
web/node_modules/es5-ext/test/object/assign-deep.js generated vendored Normal file
View file

@ -0,0 +1,27 @@
"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] };
var copyObj1 = JSON.parse(JSON.stringify(obj1)), copyObj2 = JSON.parse(JSON.stringify(obj2));
a.deep(t({}, obj1, obj2), { foo: { bar: 3, marko: false, elo: 12 }, miszka: [23] });
// Ensure it's side effects free
a.deep(obj1, copyObj1);
a.deep(obj2, copyObj2);
obj1 = [{ foo: "bar" }];
var assignedObj = [];
t(assignedObj, obj1);
a.deep(assignedObj, [{ foo: "bar" }]);
// Ensure array items are copied and not passed
a.not(assignedObj[0], obj1[0]);
a(t(true), true);
};

View file

@ -0,0 +1,5 @@
"use strict";
var isImplemented = require("../../../object/assign/is-implemented");
module.exports = function (a) { a(isImplemented(), true); };

3
web/node_modules/es5-ext/test/object/assign/index.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
"use strict";
module.exports = require("./shim");

View file

@ -0,0 +1,3 @@
"use strict";
module.exports = function (t, a) { a(typeof t(), "boolean"); };

10
web/node_modules/es5-ext/test/object/assign/shim.js generated vendored Normal file
View file

@ -0,0 +1,10 @@
"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");
};

13
web/node_modules/es5-ext/test/object/clear.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
"use strict";
var isEmpty = require("../../object/is-empty");
module.exports = function (t, a) {
var x = {};
a(t(x), x, "Empty: Returns same object");
a(isEmpty(x), true, "Empty: Not changed");
x.foo = "raz";
x.bar = "dwa";
a(t(x), x, "Same object");
a(isEmpty(x), true, "Emptied");
};

12
web/node_modules/es5-ext/test/object/compact.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
var x = {}, y = {}, z;
z = t(x);
a.not(z, x, "Returns different object");
a.deep(z, {}, "Empty on empty");
x = { foo: "bar", a: 0, b: false, c: "", d: "0", e: null, bar: y, elo: undefined };
z = t(x);
a.deep(z, { foo: "bar", a: 0, b: false, c: "", d: "0", bar: y }, "Cleared null values");
};

13
web/node_modules/es5-ext/test/object/compare.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
"use strict";
module.exports = function (t, a) {
var d = new Date();
a.ok(t(12, 3) > 0, "Numbers");
a.ok(t(2, 13) < 0, "Numbers #2");
a.ok(t("aaa", "aa") > 0, "Strings");
a.ok(t("aa", "ab") < 0, "Strings #2");
a(t("aa", "aa"), 0, "Strings same");
a(t(d, new Date(d.getTime())), 0, "Same date");
a.ok(t(d, new Date(d.getTime() + 1)) < 0, "Different date");
};

35
web/node_modules/es5-ext/test/object/copy-deep.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
"use strict";
var stringify = JSON.stringify;
module.exports = function (t, a) {
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 () {}
},
dziesięć: 10,
jedenaście: ["raz", ["dwa", "trzy", { elo: "true" }]]
};
o.raz.rec = o;
no = t(o);
a.not(o.raz, no.raz, "Deep");
a.not(o.raz.trzy, no.raz.trzy, "Deep #2");
a(stringify(o.raz.trzy), stringify(no.raz.trzy), "Deep content");
a(no.raz.rec, no, "Recursive");
a.not(o.raz.osiem, no.raz.osiem, "Empty object");
a(o.raz["dziewięć"], no.raz["dziewięć"], "Function");
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);
};

30
web/node_modules/es5-ext/test/object/copy.js generated vendored Normal file
View file

@ -0,0 +1,30 @@
"use strict";
var stringify = JSON.stringify;
module.exports = function (t, a) {
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 () {}
},
dziesięć: 10
};
o.raz.rec = o;
no = t(o);
a(o.raz, no.raz, "Shallow");
a.deep(t(o, ["foo"]), { foo: "bar" });
a.deep(t(Object.create(o), ["foo"]), { foo: "bar" });
a.deep(t(o, ["foo", "habla"]), { foo: "bar" });
a.deep(t(o, ["foo", "habla"], { ensure: true }), { foo: "bar", habla: undefined });
};

14
web/node_modules/es5-ext/test/object/count.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
module.exports = function (t, a) {
a(t({}), 0, "Empty");
a(t({ raz: 1, dwa: null, trzy: undefined, cztery: 0 }), 4, "Some properties");
a(
t(
Object.defineProperties(
{}, { raz: { value: "raz" }, dwa: { value: "dwa", enumerable: true } }
)
),
1, "Some properties hidden"
);
};

22
web/node_modules/es5-ext/test/object/create.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
"use strict";
var setPrototypeOf = require("../../object/set-prototype-of")
, getPrototypeOf = Object.getPrototypeOf;
module.exports = function (t, a) {
var x = {}, obj;
a(getPrototypeOf(t(x)), x, "Normal object");
a(getPrototypeOf(t(null)), (setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Null");
a.h1("Properties");
a.h2("Normal object");
a(getPrototypeOf((obj = t(x, { foo: { value: "bar" } }))), x, "Prototype");
a(obj.foo, "bar", "Property");
a.h2("Null");
a(
getPrototypeOf((obj = t(null, { foo: { value: "bar2" } }))),
(setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Prototype"
);
a(obj.foo, "bar2", "Property");
};

23
web/node_modules/es5-ext/test/object/ensure-array.js generated vendored Normal file
View file

@ -0,0 +1,23 @@
"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");
};

View file

@ -0,0 +1,18 @@
"use strict";
module.exports = function (t, a) {
a.throws(function () { t(undefined); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "Null");
a(t(0), 0, "Zero");
a.throws(function () { t(NaN); }, TypeError, "NaN");
a.throws(function () { t(Infinity); }, TypeError, "Infinity");
a(t(12), 12, "Number");
a(t(false), 0, "Boolean");
a(t(new Date(1000000)), 1000000, "Date");
a(t(new Number(2)), 2, "Number object");
a.throws(function () { t("asdfaf"); }, TypeError, "String");
a(t(""), 0, "Empty String");
if (typeof Symbol === "function") {
a.throws(function () { t(Symbol("test")); }, TypeError, "Symbol");
}
};

12
web/node_modules/es5-ext/test/object/ensure-integer.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
a.throws(function () { t(undefined); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "Null");
a(t(2), 2, "Number");
a(t(-2), -2, "Negative");
a.throws(function () { t(2.34); }, TypeError, "Float");
a(t("23"), 23, "Numeric string");
a.throws(function () { t(NaN); }, TypeError, "NaN");
a.throws(function () { t(Infinity); }, TypeError, "Infinity");
};

View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
a.throws(function () { t(undefined); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "Null");
a(t(2), 2, "Number");
a.throws(function () { t(-2); }, TypeError, "Negative");
a.throws(function () { t(2.34); }, TypeError, "Float");
a(t("23"), 23, "Numeric string");
a.throws(function () { t(NaN); }, TypeError, "NaN");
a.throws(function () { t(Infinity); }, TypeError, "Infinity");
};

View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
a.throws(function () { t(undefined); }, TypeError, "Undefined");
a(t(null), 0, "Null");
a(t(2), 2, "Number");
a.throws(function () { t(-2); }, TypeError, "Negative");
a.throws(function () { t(2.34); }, TypeError, "Float");
a(t("23"), 23, "Numeric string");
a.throws(function () { t(NaN); }, TypeError, "NaN");
a.throws(function () { t(Infinity); }, TypeError, "Infinity");
};

View file

@ -0,0 +1,8 @@
"use strict";
module.exports = function (t, a) {
// Just sanity checks, as logic is tested at isPlainFunction
var fn = function () {};
a(t(fn), fn, "Function");
a.throws(function () { t({}); }, TypeError, "Error");
};

View file

@ -0,0 +1,16 @@
"use strict";
module.exports = function (t, a) {
// Just sanity checks, as logic is tested at isPlainFunction
var obj = {};
a(t(obj), obj, "Reguar object instance");
obj = Object.create(null);
a(t(obj), obj, "Null prototype");
a.throws(
function () {
t(function () {});
},
TypeError,
"Error"
);
};

20
web/node_modules/es5-ext/test/object/ensure-promise.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
"use strict";
module.exports = function (t, a) {
var promise;
a.throws(function () { t(); }, TypeError);
a.throws(function () { t(null); }, TypeError);
a.throws(function () { t("promise"); }, TypeError);
a.throws(function () { t({}); }, TypeError);
a.throws(function () {
t(function () {});
}, TypeError);
a.throws(function () { t({ then: {} }); }, TypeError);
promise = { then: function () {} };
a(t(promise), promise);
promise = function () {};
promise.then = {};
a.throws(function () { t(promise); }, TypeError);
promise.then = function () {};
a(t(promise), promise);
};

View file

@ -0,0 +1,9 @@
"use strict";
module.exports = function (t, a) {
// Just sanity checks as proper tests are at isThenable
var thenable = { then: function () {} };
a.throws(function () { t({}); }, TypeError);
a(t(thenable), thenable);
};

View file

@ -0,0 +1,5 @@
"use strict";
var isImplemented = require("../../../object/entries/is-implemented");
module.exports = function (a) { a(isImplemented(), true); };

View file

@ -0,0 +1,3 @@
"use strict";
module.exports = require("./shim");

View file

@ -0,0 +1,3 @@
"use strict";
module.exports = function (t, a) { a(typeof t(), "boolean"); };

8
web/node_modules/es5-ext/test/object/entries/shim.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
"use strict";
module.exports = function (t, a) {
a.deep(t({ foo: "bar" }), [["foo", "bar"]], "Object");
a.deep(t("raz"), [["0", "r"], ["1", "a"], ["2", "z"]], "Primitive");
a.throws(function () { t(); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "Undefined");
};

12
web/node_modules/es5-ext/test/object/eq.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
var o = {};
a(t(o, {}), false, "Different objects");
a(t(o, o), true, "Same objects");
a(t("1", "1"), true, "Same primitive");
a(t("1", 1), false, "Different primitive types");
a(t(NaN, NaN), true, "NaN");
a(t(0, 0), true, "0,0");
a(t(0, -0), true, "0,-0");
};

16
web/node_modules/es5-ext/test/object/every.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
"use strict";
var o = { 1: 1, 2: 2, 3: 3 };
module.exports = function (t, a) {
var o2 = {};
t(o, function (value, name) {
o2[name] = value;
return true;
});
a(JSON.stringify(o2), JSON.stringify(o), "Iterates");
a(t(o, function () { return true; }), true, "Succeeds");
a(t(o, function () { return false; }), false, "Fails");
};

8
web/node_modules/es5-ext/test/object/filter.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
"use strict";
module.exports = function (t, a) {
a.deep(t({ 1: 1, 2: 2, 3: 3, 4: 4 }, function (value) { return Boolean(value % 2); }), {
1: 1,
3: 3
});
};

24
web/node_modules/es5-ext/test/object/find-key.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
"use strict";
var o = { 1: 1, 2: 2, 3: 3 };
module.exports = function (t, a) {
var o2 = {}, i = 0;
t(o, function (value, name) {
o2[name] = value;
return false;
});
a(JSON.stringify(o2), JSON.stringify(o), "Iterates");
a(
t(o, function () {
++i;
return true;
}),
"1",
"Finds"
);
a(i, 1, "Stops iteration after condition is met");
a(t(o, function () { return false; }), undefined, "Fails");
};

24
web/node_modules/es5-ext/test/object/find.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
"use strict";
var o = { 1: 1, 2: 2, 3: 3 };
module.exports = function (t, a) {
var o2 = {}, i = 0;
t(o, function (value, name) {
o2[name] = value;
return false;
});
a(JSON.stringify(o2), JSON.stringify(o), "Iterates");
a(
t(o, function () {
++i;
return true;
}),
1,
"Finds"
);
a(i, 1, "Stops iteration after condition is met");
a(t(o, function () { return false; }), undefined, "Fails");
};

13
web/node_modules/es5-ext/test/object/first-key.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
"use strict";
module.exports = function (t, a) {
var x = {}, y = Object.create(null);
a(t(x), null, "Normal: Empty");
a(t(y), null, "Null extension: Empty");
x.foo = "raz";
x.bar = 343;
a(["foo", "bar"].indexOf(t(x)) !== -1, true, "Normal");
y.elo = "foo";
y.mar = "wew";
a(["elo", "mar"].indexOf(t(y)) !== -1, true, "Null extension");
};

5
web/node_modules/es5-ext/test/object/flatten.js generated vendored Normal file
View file

@ -0,0 +1,5 @@
"use strict";
module.exports = function (t, a) {
a.deep(t({ a: { aa: 1, ab: 2 }, b: { ba: 3, bb: 4 } }), { aa: 1, ab: 2, ba: 3, bb: 4 });
};

7
web/node_modules/es5-ext/test/object/for-each.js generated vendored Normal file
View file

@ -0,0 +1,7 @@
"use strict";
module.exports = function (t, a) {
var o = { raz: 1, dwa: 2, trzy: 3 }, o2 = {};
a(t(o, function (value, name) { o2[name] = value; }), undefined, "Return");
a.deep(o2, o);
};

View file

@ -0,0 +1,17 @@
"use strict";
module.exports = function (t, a) {
var o = { first: 1, second: 4 }, r1, r2;
o = Object.create(o, { third: { value: null } });
o.first = 2;
o = Object.create(o);
o.fourth = 3;
r1 = t(o);
r1.sort();
r2 = ["first", "second", "third", "fourth"].concat(
Object.getOwnPropertyNames(Object.prototype)
);
r2.sort();
a.deep(r1, r2);
};

14
web/node_modules/es5-ext/test/object/is-array-like.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
module.exports = function (t, a) {
a(t([]), true, "Array");
a(t(""), true, "String");
a(t((function () { return arguments; })()), true, "Arguments");
a(t({ length: 0 }), true, "List object");
a(t(function () {}), false, "Function");
a(t({}), false, "Plain object");
a(t(/raz/), false, "Regexp");
a(t(), false, "No argument");
a(t(null), false, "Null");
a(t(undefined), false, "Undefined");
};

8
web/node_modules/es5-ext/test/object/is-callable.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
"use strict";
module.exports = function (t, a) {
a(t(function () {}), true, "Function");
a(t({}), false, "Object");
a(t(), false, "Undefined");
a(t(null), false, "Null");
};

42
web/node_modules/es5-ext/test/object/is-copy-deep.js generated vendored Normal file
View file

@ -0,0 +1,42 @@
"use strict";
module.exports = function (t, a) {
var x, y;
a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 3 }), true, "Same");
a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 4 }), false, "Different property value");
a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2 }), false, "Property only in source");
a(t({ 1: 1, 2: 2 }, { 1: 1, 2: 2, 3: 4 }), false, "Property only in target");
a(t("raz", "dwa"), false, "String: diff");
a(t("raz", "raz"), true, "String: same");
a(t("32", 32), false, "String & Number");
a(t([1, "raz", true], [1, "raz", true]), true, "Array: same");
a(t([1, "raz", undefined], [1, "raz"]), false, "Array: diff");
a(t(["foo"], ["one"]), false, "Array: One value comparision");
x = { foo: { bar: { mar: {} } } };
y = { foo: { bar: { mar: {} } } };
a(t(x, y), true, "Deep");
a(t({ foo: { bar: { mar: "foo" } } }, { foo: { bar: { mar: {} } } }), false, "Deep: false");
x = { foo: { bar: { mar: {} } } };
x.rec = { foo: x };
y = { foo: { bar: { mar: {} } } };
y.rec = { foo: x };
a(t(x, y), true, "Object: Infinite Recursion: Same #1");
x.rec.foo = y;
a(t(x, y), true, "Object: Infinite Recursion: Same #2");
x.rec.foo = x;
y.rec.foo = y;
a(t(x, y), true, "Object: Infinite Recursion: Same #3");
y.foo.bar.mar = "raz";
a(t(x, y), false, "Object: Infinite Recursion: Diff");
};

15
web/node_modules/es5-ext/test/object/is-copy.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
"use strict";
module.exports = function (t, a) {
a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 3 }), true, "Same");
a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 4 }), false, "Different property value");
a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2 }), false, "Property only in source");
a(t({ 1: 1, 2: 2 }, { 1: 1, 2: 2, 3: 4 }), false, "Property only in target");
a(t("raz", "dwa"), false, "String: diff");
a(t("raz", "raz"), true, "String: same");
a(t("32", 32), false, "String & Number");
a(t([1, "raz", true], [1, "raz", true]), true, "Array: same");
a(t([1, "raz", undefined], [1, "raz"]), false, "Array: diff");
};

6
web/node_modules/es5-ext/test/object/is-empty.js generated vendored Normal file
View file

@ -0,0 +1,6 @@
"use strict";
module.exports = function (t, a) {
a(t({}), true, "Empty");
a(t({ 1: 1 }), false, "Not empty");
};

View file

@ -0,0 +1,18 @@
"use strict";
module.exports = function (t, a) {
a(t(undefined), false, "Undefined");
a(t(null), false, "Null");
a(t(0), true, "Zero");
a(t(NaN), false, "NaN");
a(t(Infinity), false, "Infinity");
a(t(12), true, "Number");
a(t(false), true, "Boolean");
a(t(new Date()), true, "Date");
a(t(new Number(2)), true, "Number object");
a(t("asdfaf"), false, "String");
a(t(""), true, "Empty String");
if (typeof Symbol === "function") {
a(t(Symbol("test")), false, "Symbol");
}
};

12
web/node_modules/es5-ext/test/object/is-integer.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
a(t(undefined), false, "Undefined");
a(t(null), false, "Null");
a(t(2), true, "Number");
a(t(-2), true, "Negative");
a(t(2.34), false, "Float");
a(t("23"), true, "Numeric string");
a(t(NaN), false, "NaN");
a(t(Infinity), false, "Infinity");
};

View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
a(t(undefined), false, "Undefined");
a(t(null), false, "Null");
a(t(2), true, "Number");
a(t(-2), false, "Negative");
a(t(2.34), false, "Float");
a(t("23"), true, "Numeric string");
a(t(NaN), false, "NaN");
a(t(Infinity), false, "Infinity");
};

View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
a(t(undefined), false, "Undefined");
a(t(null), true, "Null");
a(t(2), true, "Number");
a(t(-2), false, "Negative");
a(t(2.34), false, "Float");
a(t("23"), true, "Numeric string");
a(t(NaN), false, "NaN");
a(t(Infinity), false, "Infinity");
};

View file

@ -0,0 +1,18 @@
"use strict";
module.exports = function (t, a) {
a(t(undefined), false, "Undefined");
a(t(null), false, "Null");
a(t(0), true, "Zero");
a(t(NaN), false, "NaN");
a(t(Infinity), true, "Infinity");
a(t(12), true, "Number");
a(t(false), true, "Boolean");
a(t(new Date()), true, "Date");
a(t(new Number(2)), true, "Number object");
a(t("asdfaf"), false, "String");
a(t(""), true, "Empty String");
if (typeof Symbol === "function") {
a(t(Symbol("test")), false, "Symbol");
}
};

13
web/node_modules/es5-ext/test/object/is-object.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
"use strict";
module.exports = function (t, a) {
a(t("arar"), false, "String");
a(t(12), false, "Number");
a(t(true), false, "Boolean");
a(t(null), false, "Null");
a(t(new Date()), true, "Date");
a(t(new String("raz")), true, "String object");
a(t({}), true, "Plain object");
a(t(/a/), true, "Regular expression");
a(t(function () {}), true, "Function");
};

View file

@ -0,0 +1,39 @@
"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");
}
};

View file

@ -0,0 +1,23 @@
"use strict";
module.exports = function (t, a) {
a(t({}), true, "Empty {} is plain object");
a(t({ a: true }), true, "{} with property is plain object");
a(
t({ prototype: 1, constructor: 2, __proto__: 3 }), true,
"{} with any property keys is plain object"
);
a(t(null), false, "Null is not plain object");
a(t("string"), false, "Primitive is not plain object");
a(t(function () {}), false, "Function is not plain object");
a(
t(Object.create({})), false,
"Object whose prototype is not Object.prototype is not plain object"
);
a(
t(Object.create(Object.prototype)), true,
"Object whose prototype is Object.prototype is plain object"
);
a(t(Object.create(null)), true, "Object whose prototype is null is plain object");
a(t(Object.prototype), false, "Object.prototype");
};

17
web/node_modules/es5-ext/test/object/is-promise.js generated vendored Normal file
View file

@ -0,0 +1,17 @@
"use strict";
module.exports = function (t, a) {
var promise;
a(t(), false);
a(t(null), false);
a(t("promise"), false);
a(t({}), false);
a(t(function () {}), false);
a(t({ then: {} }), false);
a(t({ then: function () {} }), true);
promise = function () {};
promise.then = {};
a(t(promise), false);
promise.then = function () {};
a(t(promise), true);
};

17
web/node_modules/es5-ext/test/object/is-thenable.js generated vendored Normal file
View file

@ -0,0 +1,17 @@
"use strict";
module.exports = function (t, a) {
var promise;
a(t(), false);
a(t(null), false);
a(t("promise"), false);
a(t({}), false);
a(t(function () {}), false);
a(t({ then: {} }), false);
a(t({ then: function () {} }), true);
promise = function () {};
promise.then = {};
a(t(promise), false);
promise.then = function () {};
a(t(promise), true);
};

14
web/node_modules/es5-ext/test/object/is-value.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
module.exports = function (t, a) {
a(t(), false);
a(t(undefined), false);
a(t(null), false);
a(t(NaN), true);
a(t(0), true);
a(t(false), true);
a(t("null"), true);
a(t(""), true);
a(t({}), true);
a(t(Object.prototype), true);
};

12
web/node_modules/es5-ext/test/object/is.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
var o = {};
a(t(o, {}), false, "Different objects");
a(t(o, o), true, "Same objects");
a(t("1", "1"), true, "Same primitive");
a(t("1", 1), false, "Different primitive types");
a(t(NaN, NaN), true, "NaN");
a(t(0, 0), true, "0,0");
a(t(0, -0), false, "0,-0");
};

11
web/node_modules/es5-ext/test/object/key-of.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
"use strict";
module.exports = function (t, a) {
var x = {}, y = {}, o = { foo: "bar", raz: x, trzy: "cztery", five: "6" };
a(t(o, "bar"), "foo", "First property");
a(t(o, 6), null, "Primitive that's not there");
a(t(o, x), "raz", "Object");
a(t(o, y), null, "Object that's not there");
a(t(o, "6"), "five", "Last property");
};

View file

@ -0,0 +1,5 @@
"use strict";
var isImplemented = require("../../../object/keys/is-implemented");
module.exports = function (a) { a(isImplemented(), true); };

3
web/node_modules/es5-ext/test/object/keys/index.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
"use strict";
module.exports = require("./shim");

View file

@ -0,0 +1,3 @@
"use strict";
module.exports = function (t, a) { a(typeof t(), "boolean"); };

8
web/node_modules/es5-ext/test/object/keys/shim.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
"use strict";
module.exports = function (t, a) {
a.deep(t({ foo: "bar" }), ["foo"], "Object");
a.deep(t("raz"), ["0", "1", "2"], "Primitive");
a.throws(function () { t(); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "Undefined");
};

9
web/node_modules/es5-ext/test/object/map-keys.js generated vendored Normal file
View file

@ -0,0 +1,9 @@
"use strict";
module.exports = function (t, a) {
a.deep(t({ 1: 1, 2: 2, 3: 3 }, function (key, value) { return "x" + (key + value); }), {
x11: 1,
x22: 2,
x33: 3
});
};

12
web/node_modules/es5-ext/test/object/map.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
"use strict";
module.exports = function (t, a) {
var obj = { 1: 1, 2: 2, 3: 3 };
a.deep(
t(obj, function (value, key, context) {
a(context, obj, "Context argument");
return value + 1 + key;
}),
{ 1: "21", 2: "32", 3: "43" }
);
};

View file

@ -0,0 +1,68 @@
"use strict";
module.exports = function (t, a) {
var o, o1, o2, x, y = {}, z = {};
o = { inherited: true, visible: 23 };
o1 = Object.create(o);
o1.visible = z;
o1.nonremovable = "raz";
Object.defineProperty(o1, "hidden", { value: "hidden" });
o2 = Object.defineProperties({}, { nonremovable: { value: y } });
o2.other = "other";
try { t(o2, o1); }
catch (ignore) {}
a(o2.visible, z, "Enumerable");
a(o1.hidden, "hidden", "Not Enumerable");
a(o2.propertyIsEnumerable("visible"), true, "Enumerable is enumerable");
a(o2.propertyIsEnumerable("hidden"), false, "Not enumerable is not enumerable");
a(o2.inherited, true, "Extend deep");
a(o2.nonremovable, y, "Do not overwrite non configurable");
a(o2.other, "other", "Own kept");
x = {};
t(x, o2);
try { t(x, o1); }
catch (ignore) {}
a(x.visible, z, "Enumerable");
a(x.hidden, "hidden", "Not Enumerable");
a(x.propertyIsEnumerable("visible"), true, "Enumerable is enumerable");
a(x.propertyIsEnumerable("hidden"), false, "Not enumerable is not enumerable");
a(x.inherited, true, "Extend deep");
a(x.nonremovable, y, "Ignored non configurable");
a(x.other, "other", "Other");
x.visible = 3;
a(x.visible, 3, "Writable is writable");
x = {};
t(x, o1);
a.throws(function () { x.hidden = 3; }, "Not writable is not writable");
x = {};
t(x, o1);
delete x.visible;
a.ok(!x.hasOwnProperty("visible"), "Configurable is configurable");
x = {};
t(x, o1);
a.throws(function () { delete x.hidden; }, "Not configurable is not configurable");
x = Object.defineProperty({}, "foo", {
configurable: false,
writable: true,
enumerable: false,
value: "bar"
});
try { t(x, { foo: "lorem" }); }
catch (ignore) {}
a(x.foo, "bar", "Writable, not enumerable");
};

70
web/node_modules/es5-ext/test/object/mixin.js generated vendored Normal file
View file

@ -0,0 +1,70 @@
"use strict";
module.exports = function (t, a) {
var o, o1, o2, x, y = {}, z = {};
o = { inherited: true };
o1 = Object.create(o);
o1.visible = z;
o1.nonremovable = "raz";
Object.defineProperty(o1, "hidden", { value: "hidden" });
o2 = Object.defineProperties({}, { nonremovable: { value: y } });
o2.other = "other";
try { t(o2, o1); }
catch (ignore) {}
a(o2.visible, z, "Enumerable");
a(o1.hidden, "hidden", "Not Enumerable");
a(o2.propertyIsEnumerable("visible"), true, "Enumerable is enumerable");
a(o2.propertyIsEnumerable("hidden"), false, "Not enumerable is not enumerable");
a(o2.hasOwnProperty("inherited"), false, "Extend only own");
a(o2.inherited, undefined, "Extend ony own: value");
a(o2.nonremovable, y, "Do not overwrite non configurable");
a(o2.other, "other", "Own kept");
x = {};
t(x, o2);
try { t(x, o1); }
catch (ignore) {}
a(x.visible, z, "Enumerable");
a(x.hidden, "hidden", "Not Enumerable");
a(x.propertyIsEnumerable("visible"), true, "Enumerable is enumerable");
a(x.propertyIsEnumerable("hidden"), false, "Not enumerable is not enumerable");
a(x.hasOwnProperty("inherited"), false, "Extend only own");
a(x.inherited, undefined, "Extend ony own: value");
a(x.nonremovable, y, "Ignored non configurable");
a(x.other, "other", "Other");
x.visible = 3;
a(x.visible, 3, "Writable is writable");
x = {};
t(x, o1);
a.throws(function () { x.hidden = 3; }, "Not writable is not writable");
x = {};
t(x, o1);
delete x.visible;
a.ok(!x.hasOwnProperty("visible"), "Configurable is configurable");
x = {};
t(x, o1);
a.throws(function () { delete x.hidden; }, "Not configurable is not configurable");
x = Object.defineProperty({}, "foo", {
configurable: false,
writable: true,
enumerable: false,
value: "bar"
});
try { t(x, { foo: "lorem" }); }
catch (ignore) {}
a(x.foo, "bar", "Writable, not enumerable");
};

View file

@ -0,0 +1,55 @@
"use strict";
var create = Object.create, defineProperty = Object.defineProperty;
module.exports = function (t, a) {
var x = { foo: "raz", bar: "dwa" }, y;
y = t(x);
a.not(y, x, "Returns copy");
a.deep(y, x, "Plain");
x = { raz: "one", dwa: "two" };
defineProperty(x, "get", {
configurable: true,
enumerable: true,
get: function () { return this.dwa; }
});
x = create(x);
x.trzy = "three";
x.cztery = "four";
x = create(x);
x.dwa = "two!";
x.trzy = "three!";
x.piec = "five";
x.szesc = "six";
a.deep(
t(x),
{
raz: "one",
dwa: "two!",
trzy: "three!",
cztery: "four",
piec: "five",
szesc: "six",
get: "two!"
},
"Deep object"
);
a.deep(
t({ marko: "raz", raz: "foo" }, x, { szesc: "elo", siedem: "bibg" }),
{
marko: "raz",
raz: "one",
dwa: "two!",
trzy: "three!",
cztery: "four",
piec: "five",
szesc: "elo",
siedem: "bibg",
get: "two!"
},
"Multiple options"
);
};

14
web/node_modules/es5-ext/test/object/primitive-set.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
var getPropertyNames = require("../../object/get-property-names")
, isPlainObject = require("../../object/is-plain-object");
module.exports = function (t, a) {
var x = t();
a(isPlainObject(x), true, "Plain object");
a.deep(getPropertyNames(x), [], "No properties");
x.foo = "bar";
a.deep(getPropertyNames(x), ["foo"], "Extensible");
a.deep(t("raz", "dwa", 3), { raz: true, dwa: true, 3: true }, "Arguments handling");
};

15
web/node_modules/es5-ext/test/object/safe-traverse.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
"use strict";
module.exports = function (t, a) {
var obj = { foo: { bar: { lorem: 12 } } };
a(t(obj), obj, "No props");
a(t(obj, "foo"), obj.foo, "One");
a(t(obj, "raz"), undefined, "One: Fail");
a(t(obj, "foo", "bar"), obj.foo.bar, "Two");
a(t(obj, "dsd", "raz"), undefined, "Two: Fail #1");
a(t(obj, "foo", "raz"), undefined, "Two: Fail #2");
a(t(obj, "foo", "bar", "lorem"), obj.foo.bar.lorem, "Three");
a(t(obj, "dsd", "raz", "fef"), undefined, "Three: Fail #1");
a(t(obj, "foo", "raz", "asdf"), undefined, "Three: Fail #2");
a(t(obj, "foo", "bar", "asd"), undefined, "Three: Fail #3");
};

43
web/node_modules/es5-ext/test/object/serialize.js generated vendored Normal file
View file

@ -0,0 +1,43 @@
"use strict";
module.exports = function (t, a) {
var fn = function (raz, dwa) { return raz + dwa; };
a(t(), "undefined", "Undefined");
a(t(null), "null", "Null");
a(t(null), "null", "Null");
a(t("raz"), "\"raz\"", "String");
a(t("raz\"ddwa\ntrzy"), "\"raz\\\"ddwa\\ntrzy\"", "String with escape");
a(t(false), "false", "Booelean");
a(t(fn), String(fn), "Function");
a(t(/raz-dwa/g), "/raz-dwa/g", "RegExp");
a(t(new Date(1234567)), "new Date(1234567)", "Date");
a(t([]), "[]", "Empty array");
a(
t([undefined, false, null, "raz\"ddwa\ntrzy", fn, /raz/g, new Date(1234567), ["foo"]]),
"[undefined,false,null,\"raz\\\"ddwa\\ntrzy\"," +
String(fn) +
",/raz/g,new Date(1234567),[\"foo\"]]",
"Rich Array"
);
a(t({}), "{}", "Empty object");
a(
t({
raz: undefined,
dwa: false,
trzy: null,
cztery: "raz\"ddwa\ntrzy",
piec: fn,
szesc: /raz/g,
siedem: new Date(1234567),
osiem: ["foo", 32],
dziewiec: { foo: "bar", dwa: 343 }
}),
"{\"raz\":undefined,\"dwa\":false,\"trzy\":null,\"cztery\":\"raz\\\"ddwa\\ntrzy\"," +
"\"piec\":" +
String(fn) +
",\"szesc\":/raz/g,\"siedem\":new Date(1234567),\"osiem\":[\"foo\",32]," +
"\"dziewiec\":{\"foo\":\"bar\",\"dwa\":343}}",
"Rich object"
);
};

View file

@ -0,0 +1,6 @@
"use strict";
var create = require("../../../object/create")
, isImplemented = require("../../../object/set-prototype-of/is-implemented");
module.exports = function (a) { a(isImplemented(create), true); };

View file

@ -0,0 +1,22 @@
"use strict";
var create = require("../../../object/create")
, getPrototypeOf = Object.getPrototypeOf;
module.exports = function (t, a) {
var x = {}, y = {};
if (t === null) return;
a(t(x, y), x, "Return self object");
a(getPrototypeOf(x), y, "Object");
a.throws(function () { t(x); }, TypeError, "Undefined");
a.throws(function () { t("foo"); }, TypeError, "Primitive");
a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null");
x = create(null);
a.h1("Change null prototype");
a(t(x, y), x, "Result");
a(getPrototypeOf(x), y, "Prototype");
a.h1("Set null prototype");
a(t(y, null), y, "Result");
a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype");
};

View file

@ -0,0 +1,3 @@
"use strict";
module.exports = function (t, a) { a(typeof t(), "boolean"); };

View file

@ -0,0 +1,22 @@
"use strict";
var create = require("../../../object/create")
, getPrototypeOf = Object.getPrototypeOf;
module.exports = function (t, a) {
var x = {}, y = {};
if (t === null) return;
a(t(x, y), x, "Return self object");
a(getPrototypeOf(x), y, "Object");
a.throws(function () { t(x); }, TypeError, "Undefined");
a.throws(function () { t("foo"); }, TypeError, "Primitive");
a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null");
x = create(null);
a.h1("Change null prototype");
a(t(x, y), x, "Result");
a(getPrototypeOf(x), y, "Prototype");
a.h1("Set null prototype");
a(t(y, null), y, "Result");
a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype");
};

24
web/node_modules/es5-ext/test/object/some.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
"use strict";
var o = { 1: 1, 2: 2, 3: 3 };
module.exports = function (t, a) {
var o2 = {}, i = 0;
t(o, function (value, name) {
o2[name] = value;
return false;
});
a(JSON.stringify(o2), JSON.stringify(o), "Iterates");
a(
t(o, function () {
++i;
return true;
}),
true,
"Succeeds"
);
a(i, 1, "Stops iteration after condition is met");
a(t(o, function () { return false; }), false, "Fails");
};

18
web/node_modules/es5-ext/test/object/to-array.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
"use strict";
module.exports = function (t, a) {
var o = { 1: 1, 2: 2, 3: 3 }
, o1 = {}
, o2 = t(
o,
function (value, name, self) {
a(self, o, "Self");
a(this, o1, "Scope");
return value + Number(name);
},
o1
);
a.deep(o2, [2, 4, 6]);
t(o).sort().forEach(function (item) { a.deep(item, [item[0], o[item[0]]], "Default"); });
};

39
web/node_modules/es5-ext/test/object/unserialize.js generated vendored Normal file
View file

@ -0,0 +1,39 @@
"use strict";
module.exports = function (t, a) {
var fn = function (raz, dwa) { return raz + dwa; };
a(t("undefined"), undefined, "Undefined");
a(t("null"), null, "Null");
a(t("\"raz\""), "raz", "String");
a(t("\"raz\\\"ddwa\\ntrzy\""), "raz\"ddwa\ntrzy", "String with escape");
a(t("false"), false, "Booelean");
a(String(t(String(fn))), String(fn), "Function");
a.deep(t("/raz-dwa/g"), /raz-dwa/g, "RegExp");
a.deep(t("new Date(1234567)"), new Date(1234567), "Date");
a.deep(t("[]"), [], "Empty array");
a.deep(
t("[undefined,false,null,\"raz\\\"ddwa\\ntrzy\",/raz/g,new Date(1234567),[\"foo\"]]"),
[undefined, false, null, "raz\"ddwa\ntrzy", /raz/g, new Date(1234567), ["foo"]],
"Rich Array"
);
a.deep(t("{}"), {}, "Empty object");
a.deep(
t(
"{\"raz\":undefined,\"dwa\":false,\"trzy\":null,\"cztery\":\"raz\\\"ddwa\\ntrzy\"," +
"\"szesc\":/raz/g,\"siedem\":new Date(1234567),\"osiem\":[\"foo\",32]," +
"\"dziewiec\":{\"foo\":\"bar\",\"dwa\":343}}"
),
{
raz: undefined,
dwa: false,
trzy: null,
cztery: "raz\"ddwa\ntrzy",
szesc: /raz/g,
siedem: new Date(1234567),
osiem: ["foo", 32],
dziewiec: { foo: "bar", dwa: 343 }
},
"Rich object"
);
};

View file

@ -0,0 +1,7 @@
"use strict";
module.exports = function (t, a) {
var f = function () {};
a(t(f), f, "Function");
a.throws(function () { t({}); }, "Not Function");
};

15
web/node_modules/es5-ext/test/object/valid-object.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
"use strict";
module.exports = function (t, a) {
var x;
a.throws(function () { t(0); }, TypeError, "0");
a.throws(function () { t(false); }, TypeError, "false");
a.throws(function () { t(""); }, TypeError, "''");
a(t((x = {})), x, "Object");
a(t((x = function () {})), x, "Function");
a(t((x = new String("raz"))), x, "String object"); // Jslint: ignore
a(t((x = new Date())), x, "Date");
a.throws(function () { t(); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "null");
};

15
web/node_modules/es5-ext/test/object/valid-value.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
"use strict";
var numIsNaN = require("../../number/is-nan");
module.exports = function (t, a) {
var x;
a(t(0), 0, "0");
a(t(false), false, "false");
a(t(""), "", "''");
a(numIsNaN(t(NaN)), true, "NaN");
a(t((x = {})), x, "{}");
a.throws(function () { t(); }, "Undefined");
a.throws(function () { t(null); }, "null");
};

View file

@ -0,0 +1,21 @@
"use strict";
module.exports = function (t, a) {
var x;
a.throws(function () { t(0); }, TypeError, "0");
a.throws(function () { t(false); }, TypeError, "false");
a.throws(function () { t(""); }, TypeError, "String");
a.throws(function () { t({}); }, TypeError, "Plain Object");
a.throws(
function () {
t(function () {});
},
TypeError,
"Function"
);
a(t((x = new String("raz"))), x, "String object"); // Jslint: ignore
a(t((x = { length: 1 })), x, "Array like");
a.throws(function () { t(); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "null");
};

View file

@ -0,0 +1,21 @@
"use strict";
module.exports = function (t, a) {
var x;
a.throws(function () { t(0); }, TypeError, "0");
a.throws(function () { t(false); }, TypeError, "false");
a(t(""), "", "''");
a.throws(function () { t({}); }, TypeError, "Plain Object");
a.throws(
function () {
t(function () {});
},
TypeError,
"Function"
);
a(t((x = new String("raz"))), x, "String object"); // Jslint: ignore
a(t((x = { length: 1 })), x, "Array like");
a.throws(function () { t(); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "null");
};

View file

@ -0,0 +1,16 @@
"use strict";
module.exports = function (t, a) {
var x;
a.throws(function () { t(); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "Null");
a(t(0), "0");
a(t(false), "false");
a(t(""), "");
a(t({}), String({}), "Object");
a(t((x = function () {})), String(x), "Function");
a(t((x = new String("raz"))), String(x), "String object"); // Jslint: ignore
a(t((x = new Date())), String(x), "Date");
a.throws(function () { t(Object.create(null)); }, TypeError, "Null prototype object");
};

View file

@ -0,0 +1,16 @@
"use strict";
module.exports = function (t, a) {
var x;
a(t(), "undefined", "Undefined");
a(t(null), "null", "Null");
a(t(0), "0");
a(t(false), "false");
a(t(""), "");
a(t({}), String({}), "Object");
a(t((x = function () {})), String(x), "Function");
a(t((x = new String("raz"))), String(x), "String object"); // Jslint: ignore
a(t((x = new Date())), String(x), "Date");
a.throws(function () { t(Object.create(null)); }, TypeError, "Null prototype object");
};