|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
643 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = superset;
|
|---|
| 7 | function superset(values, other) {
|
|---|
| 8 | const iterator = values[Symbol.iterator](),
|
|---|
| 9 | set = new Set();
|
|---|
| 10 | for (const o of other) {
|
|---|
| 11 | const io = intern(o);
|
|---|
| 12 | if (set.has(io)) continue;
|
|---|
| 13 | let value, done;
|
|---|
| 14 | while (({
|
|---|
| 15 | value,
|
|---|
| 16 | done
|
|---|
| 17 | } = iterator.next())) {
|
|---|
| 18 | if (done) return false;
|
|---|
| 19 | const ivalue = intern(value);
|
|---|
| 20 | set.add(ivalue);
|
|---|
| 21 | if (Object.is(io, ivalue)) break;
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 | return true;
|
|---|
| 25 | }
|
|---|
| 26 | function intern(value) {
|
|---|
| 27 | return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|---|
| 28 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.