9719ee86b1a316ca8eb7a38e10038592.json 5.0 KB

1
  1. {"ast":null,"code":"function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n} // for environments without Set we fallback to arrays with unique members\n\n\nvar SetLike = /*#__PURE__*/function () {\n function SetLike() {\n var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n _classCallCheck(this, SetLike);\n\n _defineProperty(this, \"items\", void 0);\n\n this.items = items;\n }\n\n _createClass(SetLike, [{\n key: \"add\",\n value: function add(value) {\n if (this.has(value) === false) {\n this.items.push(value);\n }\n\n return this;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.items = [];\n }\n }, {\n key: \"delete\",\n value: function _delete(value) {\n var previousLength = this.items.length;\n this.items = this.items.filter(function (item) {\n return item !== value;\n });\n return previousLength !== this.items.length;\n }\n }, {\n key: \"forEach\",\n value: function forEach(callbackfn) {\n var _this = this;\n\n this.items.forEach(function (item) {\n callbackfn(item, item, _this);\n });\n }\n }, {\n key: \"has\",\n value: function has(value) {\n return this.items.indexOf(value) !== -1;\n }\n }, {\n key: \"size\",\n get: function get() {\n return this.items.length;\n }\n }]);\n\n return SetLike;\n}();\n\nexport default typeof Set === \"undefined\" ? Set : SetLike;","map":{"version":3,"sources":["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A8B,CAArC,CAAA;AACA;;;SAED,SAAA,GAAA,GAAmB;AAClB,aAAO,KAAA,KAAA,CAAP,MAAA;AACA;;;;;;AAGF,eAAe,OAAA,GAAA,KAAA,WAAA,GAAA,GAAA,GAAf,OAAA","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"]},"metadata":{},"sourceType":"module"}