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

View file

@ -0,0 +1,14 @@
declare global {
class Set<T> {
constructor(items?: T[]);
add(value: T): this;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: unknown): void;
has(value: T): boolean;
readonly size: number;
}
}
declare const _default: typeof Set;
export default _default;
//# sourceMappingURL=SetLike.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"SetLike.d.ts","sourceRoot":"","sources":["../../sources/polyfills/SetLike.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACd,MAAM,GAAG,CAAC,CAAC;oBAEE,KAAK,CAAC,EAAE,CAAC,EAAE;QACvB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;QACnB,KAAK,IAAI,IAAI;QACb,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;QACzB,OAAO,CACN,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,EACtD,OAAO,CAAC,EAAE,OAAO,GACf,IAAI;QACP,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;QACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KAItB;CACD;;AAuCD,wBAA0D"}

View file

@ -0,0 +1,76 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// for environments without Set we fallback to arrays with unique members
var SetLike = /*#__PURE__*/function () {
function SetLike() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, SetLike);
_defineProperty(this, "items", void 0);
this.items = items;
}
_createClass(SetLike, [{
key: "add",
value: function add(value) {
if (this.has(value) === false) {
this.items.push(value);
}
return this;
}
}, {
key: "clear",
value: function clear() {
this.items = [];
}
}, {
key: "delete",
value: function _delete(value) {
var previousLength = this.items.length;
this.items = this.items.filter(function (item) {
return item !== value;
});
return previousLength !== this.items.length;
}
}, {
key: "forEach",
value: function forEach(callbackfn) {
var _this = this;
this.items.forEach(function (item) {
callbackfn(item, item, _this);
});
}
}, {
key: "has",
value: function has(value) {
return this.items.indexOf(value) !== -1;
}
}, {
key: "size",
get: function get() {
return this.items.length;
}
}]);
return SetLike;
}();
var _default = typeof Set === "undefined" ? Set : SetLike;
exports.default = _default;
//# sourceMappingURL=SetLike.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../sources/polyfills/SetLike.ts"],"names":["SetLike","items","value","has","push","previousLength","length","filter","item","callbackfn","forEach","indexOf","Set"],"mappings":";;;;;;;;;;;;;AAmBA;IACMA,O;AAGL,qBAA6B;AAAA,QAAjBC,KAAiB,uEAAJ,EAAI;;AAAA;;AAAA;;AAC5B,SAAKA,KAAL,GAAaA,KAAb;AACA;;;;WAED,aAAIC,KAAJ,EAAoB;AACnB,UAAI,KAAKC,GAAL,CAASD,KAAT,MAAoB,KAAxB,EAA+B;AAC9B,aAAKD,KAAL,CAAWG,IAAX,CAAgBF,KAAhB;AACA;;AACD,aAAO,IAAP;AACA;;;WACD,iBAAc;AACb,WAAKD,KAAL,GAAa,EAAb;AACA;;;WACD,iBAAOC,KAAP,EAA0B;AACzB,UAAMG,cAAc,GAAG,KAAKJ,KAAL,CAAWK,MAAlC;AACA,WAAKL,KAAL,GAAa,KAAKA,KAAL,CAAWM,MAAX,CAAkB,UAACC,IAAD;AAAA,eAAUA,IAAI,KAAKN,KAAnB;AAAA,OAAlB,CAAb;AAEA,aAAOG,cAAc,KAAK,KAAKJ,KAAL,CAAWK,MAArC;AACA;;;WACD,iBAAQG,UAAR,EAAsE;AAAA;;AACrE,WAAKR,KAAL,CAAWS,OAAX,CAAmB,UAACF,IAAD,EAAU;AAC5BC,QAAAA,UAAU,CAACD,IAAD,EAAOA,IAAP,EAAa,KAAb,CAAV;AACA,OAFD;AAGA;;;WACD,aAAIN,KAAJ,EAAuB;AACtB,aAAO,KAAKD,KAAL,CAAWU,OAAX,CAAmBT,KAAnB,MAA8B,CAAC,CAAtC;AACA;;;SAED,eAAmB;AAClB,aAAO,KAAKD,KAAL,CAAWK,MAAlB;AACA;;;;;;eAGa,OAAOM,GAAP,KAAe,WAAf,GAA6BA,GAA7B,GAAmCZ,O","sourcesContent":["declare global {\n\tclass Set<T> {\n\t\t// es2015.collection.d.ts\n\t\tconstructor(items?: T[]);\n\t\tadd(value: T): this;\n\t\tclear(): void;\n\t\tdelete(value: T): boolean;\n\t\tforEach(\n\t\t\tcallbackfn: (value: T, value2: T, set: Set<T>) => void,\n\t\t\tthisArg?: unknown\n\t\t): void;\n\t\thas(value: T): boolean;\n\t\treadonly size: number;\n\n\t\t// es2015.iterable.d.ts\n\t\t// no implemennted\n\t}\n}\n\n// for environments without Set we fallback to arrays with unique members\nclass SetLike<T> implements Set<T> {\n\tprivate items: T[];\n\n\tconstructor(items: T[] = []) {\n\t\tthis.items = items;\n\t}\n\n\tadd(value: T): this {\n\t\tif (this.has(value) === false) {\n\t\t\tthis.items.push(value);\n\t\t}\n\t\treturn this;\n\t}\n\tclear(): void {\n\t\tthis.items = [];\n\t}\n\tdelete(value: T): boolean {\n\t\tconst previousLength = this.items.length;\n\t\tthis.items = this.items.filter((item) => item !== value);\n\n\t\treturn previousLength !== this.items.length;\n\t}\n\tforEach(callbackfn: (value: T, value2: T, set: Set<T>) => void): void {\n\t\tthis.items.forEach((item) => {\n\t\t\tcallbackfn(item, item, this);\n\t\t});\n\t}\n\thas(value: T): boolean {\n\t\treturn this.items.indexOf(value) !== -1;\n\t}\n\n\tget size(): number {\n\t\treturn this.items.length;\n\t}\n}\n\nexport default typeof Set === \"undefined\" ? Set : SetLike;\n"],"file":"SetLike.js"}

View file

@ -0,0 +1,69 @@
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// for environments without Set we fallback to arrays with unique members
var SetLike = /*#__PURE__*/function () {
function SetLike() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, SetLike);
_defineProperty(this, "items", void 0);
this.items = items;
}
_createClass(SetLike, [{
key: "add",
value: function add(value) {
if (this.has(value) === false) {
this.items.push(value);
}
return this;
}
}, {
key: "clear",
value: function clear() {
this.items = [];
}
}, {
key: "delete",
value: function _delete(value) {
var previousLength = this.items.length;
this.items = this.items.filter(function (item) {
return item !== value;
});
return previousLength !== this.items.length;
}
}, {
key: "forEach",
value: function forEach(callbackfn) {
var _this = this;
this.items.forEach(function (item) {
callbackfn(item, item, _this);
});
}
}, {
key: "has",
value: function has(value) {
return this.items.indexOf(value) !== -1;
}
}, {
key: "size",
get: function get() {
return this.items.length;
}
}]);
return SetLike;
}();
export default typeof Set === "undefined" ? Set : SetLike;
//# sourceMappingURL=SetLike.mjs.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../sources/polyfills/SetLike.ts"],"names":["SetLike","items","value","has","push","previousLength","length","filter","item","callbackfn","forEach","indexOf","Set"],"mappings":";;;;;;;;AAmBA;IACMA,O;AAGL,qBAA6B;AAAA,QAAjBC,KAAiB,uEAAJ,EAAI;;AAAA;;AAAA;;AAC5B,SAAKA,KAAL,GAAaA,KAAb;AACA;;;;WAED,aAAIC,KAAJ,EAAoB;AACnB,UAAI,KAAKC,GAAL,CAASD,KAAT,MAAoB,KAAxB,EAA+B;AAC9B,aAAKD,KAAL,CAAWG,IAAX,CAAgBF,KAAhB;AACA;;AACD,aAAO,IAAP;AACA;;;WACD,iBAAc;AACb,WAAKD,KAAL,GAAa,EAAb;AACA;;;WACD,iBAAOC,KAAP,EAA0B;AACzB,UAAMG,cAAc,GAAG,KAAKJ,KAAL,CAAWK,MAAlC;AACA,WAAKL,KAAL,GAAa,KAAKA,KAAL,CAAWM,MAAX,CAAkB,UAACC,IAAD;AAAA,eAAUA,IAAI,KAAKN,KAAnB;AAAA,OAAlB,CAAb;AAEA,aAAOG,cAAc,KAAK,KAAKJ,KAAL,CAAWK,MAArC;AACA;;;WACD,iBAAQG,UAAR,EAAsE;AAAA;;AACrE,WAAKR,KAAL,CAAWS,OAAX,CAAmB,UAACF,IAAD,EAAU;AAC5BC,QAAAA,UAAU,CAACD,IAAD,EAAOA,IAAP,EAAa,KAAb,CAAV;AACA,OAFD;AAGA;;;WACD,aAAIN,KAAJ,EAAuB;AACtB,aAAO,KAAKD,KAAL,CAAWU,OAAX,CAAmBT,KAAnB,MAA8B,CAAC,CAAtC;AACA;;;SAED,eAAmB;AAClB,aAAO,KAAKD,KAAL,CAAWK,MAAlB;AACA;;;;;;AAGF,eAAe,OAAOM,GAAP,KAAe,WAAf,GAA6BA,GAA7B,GAAmCZ,OAAlD","sourcesContent":["declare global {\n\tclass Set<T> {\n\t\t// es2015.collection.d.ts\n\t\tconstructor(items?: T[]);\n\t\tadd(value: T): this;\n\t\tclear(): void;\n\t\tdelete(value: T): boolean;\n\t\tforEach(\n\t\t\tcallbackfn: (value: T, value2: T, set: Set<T>) => void,\n\t\t\tthisArg?: unknown\n\t\t): void;\n\t\thas(value: T): boolean;\n\t\treadonly size: number;\n\n\t\t// es2015.iterable.d.ts\n\t\t// no implemennted\n\t}\n}\n\n// for environments without Set we fallback to arrays with unique members\nclass SetLike<T> implements Set<T> {\n\tprivate items: T[];\n\n\tconstructor(items: T[] = []) {\n\t\tthis.items = items;\n\t}\n\n\tadd(value: T): this {\n\t\tif (this.has(value) === false) {\n\t\t\tthis.items.push(value);\n\t\t}\n\t\treturn this;\n\t}\n\tclear(): void {\n\t\tthis.items = [];\n\t}\n\tdelete(value: T): boolean {\n\t\tconst previousLength = this.items.length;\n\t\tthis.items = this.items.filter((item) => item !== value);\n\n\t\treturn previousLength !== this.items.length;\n\t}\n\tforEach(callbackfn: (value: T, value2: T, set: Set<T>) => void): void {\n\t\tthis.items.forEach((item) => {\n\t\t\tcallbackfn(item, item, this);\n\t\t});\n\t}\n\thas(value: T): boolean {\n\t\treturn this.items.indexOf(value) !== -1;\n\t}\n\n\tget size(): number {\n\t\treturn this.items.length;\n\t}\n}\n\nexport default typeof Set === \"undefined\" ? Set : SetLike;\n"],"file":"SetLike.mjs"}

View file

@ -0,0 +1,6 @@
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
*/
export default function arrayFrom<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
//# sourceMappingURL=array.from.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"array.from.d.ts","sourceRoot":"","sources":["../../sources/polyfills/array.from.ts"],"names":[],"mappings":"AAuBA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC"}

View file

@ -0,0 +1,99 @@
"use strict";
exports.__esModule = true;
exports.default = arrayFrom;
/**
* @source {https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Polyfill}
* but without thisArg (too hard to type, no need to `this`)
*/
var toStr = Object.prototype.toString;
function isCallable(fn) {
return typeof fn === "function" || toStr.call(fn) === "[object Function]";
}
function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
}
var maxSafeInteger = Math.pow(2, 53) - 1;
function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
}
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
*/
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
function arrayFrom(arrayLike, mapFn) {
// 1. Let C be the this value.
// edit(@eps1lon): we're not calling it as Array.from
var C = Array; // 2. Let items be ToObject(arrayLike).
var items = Object(arrayLike); // 3. ReturnIfAbrupt(items).
if (arrayLike == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
} // 4. If mapfn is undefined, then let mapping be false.
// const mapFn = arguments.length > 1 ? arguments[1] : void undefined;
if (typeof mapFn !== "undefined") {
// 5. else
// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
if (!isCallable(mapFn)) {
throw new TypeError("Array.from: when provided, the second argument must be a function");
}
} // 10. Let lenValue be Get(items, "length").
// 11. Let len be ToLength(lenValue).
var len = toLength(items.length); // 13. If IsConstructor(C) is true, then
// 13. a. Let A be the result of calling the [[Construct]] internal method
// of C with an argument list containing the single item len.
// 14. a. Else, Let A be ArrayCreate(len).
var A = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0.
var k = 0; // 17. Repeat, while k < len… (also steps a - h)
var kValue;
while (k < len) {
kValue = items[k];
if (mapFn) {
A[k] = mapFn(kValue, k);
} else {
A[k] = kValue;
}
k += 1;
} // 18. Let putStatus be Put(A, "length", len, true).
A.length = len; // 20. Return A.
return A;
}
//# sourceMappingURL=array.from.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,94 @@
/**
* @source {https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Polyfill}
* but without thisArg (too hard to type, no need to `this`)
*/
var toStr = Object.prototype.toString;
function isCallable(fn) {
return typeof fn === "function" || toStr.call(fn) === "[object Function]";
}
function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
}
var maxSafeInteger = Math.pow(2, 53) - 1;
function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
}
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
*/
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
export default function arrayFrom(arrayLike, mapFn) {
// 1. Let C be the this value.
// edit(@eps1lon): we're not calling it as Array.from
var C = Array; // 2. Let items be ToObject(arrayLike).
var items = Object(arrayLike); // 3. ReturnIfAbrupt(items).
if (arrayLike == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
} // 4. If mapfn is undefined, then let mapping be false.
// const mapFn = arguments.length > 1 ? arguments[1] : void undefined;
if (typeof mapFn !== "undefined") {
// 5. else
// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
if (!isCallable(mapFn)) {
throw new TypeError("Array.from: when provided, the second argument must be a function");
}
} // 10. Let lenValue be Get(items, "length").
// 11. Let len be ToLength(lenValue).
var len = toLength(items.length); // 13. If IsConstructor(C) is true, then
// 13. a. Let A be the result of calling the [[Construct]] internal method
// of C with an argument list containing the single item len.
// 14. a. Else, Let A be ArrayCreate(len).
var A = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0.
var k = 0; // 17. Repeat, while k < len… (also steps a - h)
var kValue;
while (k < len) {
kValue = items[k];
if (mapFn) {
A[k] = mapFn(kValue, k);
} else {
A[k] = kValue;
}
k += 1;
} // 18. Let putStatus be Put(A, "length", len, true).
A.length = len; // 20. Return A.
return A;
}
//# sourceMappingURL=array.from.mjs.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,2 @@
"use strict";
//# sourceMappingURL=iterator.d.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"iterator.d.js"}

View file

@ -0,0 +1,2 @@
//# sourceMappingURL=iterator.d.mjs.map

View file

@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"iterator.d.mjs"}