list-toolkit 2.2.6 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -37
- package/llms-full.txt +743 -0
- package/llms.txt +100 -0
- package/package.json +34 -29
- package/src/cache/cache-fifo.d.ts +6 -0
- package/src/cache/cache-fifo.js +7 -4
- package/src/cache/cache-lfu.d.ts +18 -0
- package/src/cache/cache-lfu.js +18 -6
- package/src/cache/cache-lru.d.ts +74 -0
- package/src/cache/cache-lru.js +60 -5
- package/src/cache/cache-random.d.ts +20 -0
- package/src/cache/cache-random.js +17 -6
- package/src/cache/decorator.d.ts +46 -0
- package/src/cache/decorator.js +26 -2
- package/src/cache.d.ts +13 -0
- package/src/cache.js +7 -2
- package/src/ext-list.d.ts +3 -0
- package/src/ext-list.js +0 -2
- package/src/ext-slist.d.ts +3 -0
- package/src/ext-slist.js +0 -2
- package/src/ext-value-list.d.ts +3 -0
- package/src/ext-value-list.js +0 -2
- package/src/ext-value-slist.d.ts +3 -0
- package/src/ext-value-slist.js +0 -2
- package/src/heap/basics.d.ts +89 -0
- package/src/heap/basics.js +42 -5
- package/src/heap/leftist-heap.d.ts +107 -0
- package/src/heap/leftist-heap.js +54 -2
- package/src/heap/min-heap.d.ts +270 -0
- package/src/heap/min-heap.js +186 -2
- package/src/heap/skew-heap.d.ts +105 -0
- package/src/heap/skew-heap.js +54 -2
- package/src/heap.d.ts +3 -0
- package/src/heap.js +0 -2
- package/src/list/basics.d.ts +43 -0
- package/src/list/basics.js +26 -8
- package/src/list/core.d.ts +271 -0
- package/src/list/core.js +162 -7
- package/src/list/ext-value.d.ts +253 -0
- package/src/list/ext-value.js +40 -6
- package/src/list/ext.d.ts +242 -0
- package/src/list/ext.js +148 -10
- package/src/list/nodes.d.ts +336 -0
- package/src/list/nodes.js +141 -3
- package/src/list/ptr.d.ts +72 -0
- package/src/list/ptr.js +44 -2
- package/src/list/value.d.ts +292 -0
- package/src/list/value.js +47 -6
- package/src/list-helpers.d.ts +44 -0
- package/src/list-helpers.js +36 -3
- package/src/list-utils.d.ts +141 -0
- package/src/list-utils.js +89 -3
- package/src/list.d.ts +3 -0
- package/src/list.js +0 -2
- package/src/meta-utils.d.ts +212 -0
- package/src/meta-utils.js +152 -1
- package/src/nt-utils.d.ts +91 -0
- package/src/nt-utils.js +65 -4
- package/src/queue.d.ts +74 -0
- package/src/queue.js +28 -2
- package/src/slist/basics.d.ts +47 -0
- package/src/slist/basics.js +23 -8
- package/src/slist/core.d.ts +251 -0
- package/src/slist/core.js +151 -6
- package/src/slist/ext-value.d.ts +188 -0
- package/src/slist/ext-value.js +35 -6
- package/src/slist/ext.d.ts +182 -0
- package/src/slist/ext.js +114 -12
- package/src/slist/nodes.d.ts +361 -0
- package/src/slist/nodes.js +156 -3
- package/src/slist/ptr.d.ts +73 -0
- package/src/slist/ptr.js +45 -2
- package/src/slist/value.d.ts +246 -0
- package/src/slist/value.js +38 -6
- package/src/slist.d.ts +3 -0
- package/src/slist.js +0 -2
- package/src/stack.d.ts +59 -0
- package/src/stack.js +29 -3
- package/src/tree/splay-tree.d.ts +151 -0
- package/src/tree/splay-tree.js +94 -3
- package/src/value-list.d.ts +3 -0
- package/src/value-list.js +0 -2
- package/src/value-slist.d.ts +3 -0
- package/src/value-slist.js +0 -2
- package/cjs/cache/cache-fifo.js +0 -37
- package/cjs/cache/cache-lfu.js +0 -76
- package/cjs/cache/cache-lru.js +0 -100
- package/cjs/cache/cache-random.js +0 -77
- package/cjs/cache/decorator.js +0 -47
- package/cjs/cache.js +0 -27
- package/cjs/ext-list.js +0 -21
- package/cjs/ext-slist.js +0 -21
- package/cjs/ext-value-list.js +0 -21
- package/cjs/ext-value-slist.js +0 -21
- package/cjs/heap/basics.js +0 -63
- package/cjs/heap/leftist-heap.js +0 -124
- package/cjs/heap/min-heap.js +0 -294
- package/cjs/heap/skew-heap.js +0 -114
- package/cjs/heap.js +0 -21
- package/cjs/list/basics.js +0 -88
- package/cjs/list/core.js +0 -305
- package/cjs/list/ext-value.js +0 -88
- package/cjs/list/ext.js +0 -356
- package/cjs/list/nodes.js +0 -240
- package/cjs/list/ptr.js +0 -61
- package/cjs/list/value.js +0 -99
- package/cjs/list-helpers.js +0 -91
- package/cjs/list-utils.js +0 -141
- package/cjs/list.js +0 -21
- package/cjs/meta-utils.js +0 -171
- package/cjs/nt-utils.js +0 -132
- package/cjs/package.json +0 -1
- package/cjs/queue.js +0 -58
- package/cjs/slist/basics.js +0 -71
- package/cjs/slist/core.js +0 -362
- package/cjs/slist/ext-value.js +0 -82
- package/cjs/slist/ext.js +0 -336
- package/cjs/slist/nodes.js +0 -276
- package/cjs/slist/ptr.js +0 -87
- package/cjs/slist/value.js +0 -90
- package/cjs/slist.js +0 -21
- package/cjs/stack.js +0 -55
- package/cjs/tree/splay-tree.js +0 -362
- package/cjs/value-list.js +0 -21
- package/cjs/value-slist.js +0 -21
package/cjs/list/value.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Ptr", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _core.Ptr;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.ValueList = void 0;
|
|
13
|
-
Object.defineProperty(exports, "ValueNode", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _nodes.ValueNode;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.default = void 0;
|
|
20
|
-
var _core = _interopRequireWildcard(require("./core.js"));
|
|
21
|
-
var _nodes = require("./nodes.js");
|
|
22
|
-
var _basics = require("./basics.js");
|
|
23
|
-
var _metaUtils = require("../meta-utils.js");
|
|
24
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
25
|
-
class ValueList extends _core.default {
|
|
26
|
-
popFront() {
|
|
27
|
-
if (!this.isEmpty) return (0, _basics.pop)(this, this[this.nextName]).extracted.value;
|
|
28
|
-
}
|
|
29
|
-
popBack() {
|
|
30
|
-
if (!this.isEmpty) return (0, _basics.pop)(this, this[this.prevName]).extracted.value;
|
|
31
|
-
}
|
|
32
|
-
adoptValue(value) {
|
|
33
|
-
if (value instanceof _core.Ptr) {
|
|
34
|
-
if (!this.isCompatiblePtr(value)) throw new Error('Incompatible pointer');
|
|
35
|
-
if (value.node instanceof _nodes.ValueNode) {
|
|
36
|
-
value.list = this;
|
|
37
|
-
return super.adoptNode(value);
|
|
38
|
-
}
|
|
39
|
-
return new _nodes.ValueNode(value.node, this);
|
|
40
|
-
}
|
|
41
|
-
if (value instanceof _nodes.ValueNode) {
|
|
42
|
-
if (!this.isNodeLike(value)) throw new Error('Incompatible node');
|
|
43
|
-
return super.adoptNode(value);
|
|
44
|
-
}
|
|
45
|
-
return new _nodes.ValueNode(value, this);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// iterators
|
|
49
|
-
|
|
50
|
-
[Symbol.iterator]() {
|
|
51
|
-
let current = this[this.nextName],
|
|
52
|
-
readyToStop = this.isEmpty;
|
|
53
|
-
return (0, _metaUtils.normalizeIterator)({
|
|
54
|
-
next: () => {
|
|
55
|
-
if (readyToStop && current === this) return {
|
|
56
|
-
done: true
|
|
57
|
-
};
|
|
58
|
-
readyToStop = true;
|
|
59
|
-
const value = current.value;
|
|
60
|
-
current = current[this.nextName];
|
|
61
|
-
return {
|
|
62
|
-
value
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
getValueIterator(range) {
|
|
68
|
-
return (0, _metaUtils.mapIterator)(this.getNodeIterator(range), node => node.value);
|
|
69
|
-
}
|
|
70
|
-
getReverseValueIterator(range) {
|
|
71
|
-
return (0, _metaUtils.mapIterator)(this.getReverseNodeIterator(range), node => node.value);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// meta helpers
|
|
75
|
-
|
|
76
|
-
clone() {
|
|
77
|
-
return ValueList.from(this, this);
|
|
78
|
-
}
|
|
79
|
-
make() {
|
|
80
|
-
return new ValueList(this);
|
|
81
|
-
}
|
|
82
|
-
makeFrom(values) {
|
|
83
|
-
return ValueList.from(values, this);
|
|
84
|
-
}
|
|
85
|
-
static from(values, options) {
|
|
86
|
-
const list = new ValueList(options);
|
|
87
|
-
for (const value of values) list.pushBack(value);
|
|
88
|
-
return list;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.ValueList = ValueList;
|
|
92
|
-
ValueList.Ptr = _core.Ptr;
|
|
93
|
-
ValueList.ValueNode = _nodes.ValueNode;
|
|
94
|
-
(0, _metaUtils.addAliases)(ValueList.prototype, {
|
|
95
|
-
popFront: 'pop',
|
|
96
|
-
getValueIterator: 'getIterator',
|
|
97
|
-
getReverseValueIterator: 'getReverseIterator'
|
|
98
|
-
});
|
|
99
|
-
var _default = exports.default = ValueList;
|
package/cjs/list-helpers.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.normalizeRange = exports.normalizePtrRange = exports.normalizeNode = exports.isRangeLike = exports.isPtrRangeLike = void 0;
|
|
7
|
-
const normalizeNode = (list, node, PtrBase) => {
|
|
8
|
-
if (!node) return null;
|
|
9
|
-
if (node instanceof PtrBase) {
|
|
10
|
-
if (!list.isCompatible(node.list)) throw new Error('Incompatible lists');
|
|
11
|
-
node = node.node;
|
|
12
|
-
} else {
|
|
13
|
-
if (!list.isNodeLike(node)) throw new Error('Not a compatible node');
|
|
14
|
-
}
|
|
15
|
-
return node;
|
|
16
|
-
};
|
|
17
|
-
exports.normalizeNode = normalizeNode;
|
|
18
|
-
const isRangeLike = (listHost, range, PtrBase) => {
|
|
19
|
-
if (!range) return true;
|
|
20
|
-
if (range.list && !listHost.isCompatible(range.list)) return false;
|
|
21
|
-
let list = range.list;
|
|
22
|
-
if (range.from instanceof PtrBase) {
|
|
23
|
-
if (range.list) {
|
|
24
|
-
if (range.from.list !== range.list) return false;
|
|
25
|
-
} else {
|
|
26
|
-
if (!listHost.isCompatible(range.from.list)) return false;
|
|
27
|
-
list ||= range.from.list;
|
|
28
|
-
}
|
|
29
|
-
} else {
|
|
30
|
-
if (range.from && !listHost.isNodeLike(range.from)) return false;
|
|
31
|
-
}
|
|
32
|
-
if (range.to instanceof PtrBase) {
|
|
33
|
-
if (list) {
|
|
34
|
-
if (range.to.list !== list) return false;
|
|
35
|
-
} else {
|
|
36
|
-
if (!listHost.isCompatible(range.to.list)) return false;
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
if (range.to && !listHost.isNodeLike(range.to)) return false;
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
};
|
|
43
|
-
exports.isRangeLike = isRangeLike;
|
|
44
|
-
const normalizeRange = (listHost, range, PtrBase) => {
|
|
45
|
-
if (!range) return null;
|
|
46
|
-
if (!isRangeLike(listHost, range, PtrBase)) throw new Error('Not a compatible range');
|
|
47
|
-
let {
|
|
48
|
-
from,
|
|
49
|
-
to
|
|
50
|
-
} = range;
|
|
51
|
-
if (from instanceof PtrBase) from = from.node;
|
|
52
|
-
if (to instanceof PtrBase) to = to.node;
|
|
53
|
-
return {
|
|
54
|
-
...range,
|
|
55
|
-
from,
|
|
56
|
-
to
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
exports.normalizeRange = normalizeRange;
|
|
60
|
-
const isPtrRangeLike = (listHost, range, PtrBase) => {
|
|
61
|
-
if (!range) return true;
|
|
62
|
-
if (!(range.from instanceof PtrBase)) return false;
|
|
63
|
-
if (range.list) {
|
|
64
|
-
if (!listHost.isCompatible(range.list)) return false;
|
|
65
|
-
if (range.from.list !== range.list) return false;
|
|
66
|
-
} else {
|
|
67
|
-
if (!listHost.isCompatible(range.from.list)) return false;
|
|
68
|
-
}
|
|
69
|
-
if (range.to instanceof PtrBase) {
|
|
70
|
-
if (range.to.list !== (range.list || range.from.list)) return false;
|
|
71
|
-
} else {
|
|
72
|
-
if (range.to && !listHost.isNodeLike(range.to)) return false;
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
};
|
|
76
|
-
exports.isPtrRangeLike = isPtrRangeLike;
|
|
77
|
-
const normalizePtrRange = (listHost, range, PtrBase) => {
|
|
78
|
-
if (!range) return null;
|
|
79
|
-
if (!isPtrRangeLike(listHost, range, PtrBase)) throw new Error('Not a compatible ptr range');
|
|
80
|
-
let {
|
|
81
|
-
from,
|
|
82
|
-
to
|
|
83
|
-
} = range;
|
|
84
|
-
if (to instanceof PtrBase) to = to.node;
|
|
85
|
-
return {
|
|
86
|
-
...range,
|
|
87
|
-
from,
|
|
88
|
-
to
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
exports.normalizePtrRange = normalizePtrRange;
|
package/cjs/list-utils.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.removeNodeBy = exports.pushValuesFront = exports.pushValuesBack = exports.isValidSList = exports.isValidList = exports.insertValuesBefore = exports.insertValuesAfter = exports.frontPusher = exports.findPtrBy = exports.findNodeBy = exports.backPusher = exports.appendValuesFront = exports.appendValuesBack = exports.addValuesBefore = exports.addValuesAfter = void 0;
|
|
7
|
-
const isValidList = list => {
|
|
8
|
-
let current = list;
|
|
9
|
-
do {
|
|
10
|
-
const next = current[list.nextName];
|
|
11
|
-
if (!next || next[list.prevName] !== current) return false;
|
|
12
|
-
current = next;
|
|
13
|
-
} while (current !== list);
|
|
14
|
-
return true;
|
|
15
|
-
};
|
|
16
|
-
exports.isValidList = isValidList;
|
|
17
|
-
const isValidSList = list => {
|
|
18
|
-
let current = list;
|
|
19
|
-
do {
|
|
20
|
-
const next = current[list.nextName];
|
|
21
|
-
if (!next) return false;
|
|
22
|
-
current = next;
|
|
23
|
-
} while (current !== list);
|
|
24
|
-
return true;
|
|
25
|
-
};
|
|
26
|
-
exports.isValidSList = isValidSList;
|
|
27
|
-
const pushValuesFront = (list, values) => {
|
|
28
|
-
for (const value of values) {
|
|
29
|
-
list.pushFront(value);
|
|
30
|
-
}
|
|
31
|
-
return list;
|
|
32
|
-
};
|
|
33
|
-
exports.pushValuesFront = pushValuesFront;
|
|
34
|
-
const pushValuesBack = (list, values) => {
|
|
35
|
-
for (const value of values) {
|
|
36
|
-
list.pushBack(value);
|
|
37
|
-
}
|
|
38
|
-
return list;
|
|
39
|
-
};
|
|
40
|
-
exports.pushValuesBack = pushValuesBack;
|
|
41
|
-
const appendValuesFront = (list, values) => {
|
|
42
|
-
if (typeof list.appendFront == 'function' && list.isCompatible(values)) {
|
|
43
|
-
list.appendFront(values);
|
|
44
|
-
return list;
|
|
45
|
-
}
|
|
46
|
-
if (!Array.isArray(values)) values = Array.from(values);
|
|
47
|
-
for (let i = values.length - 1; i >= 0; --i) {
|
|
48
|
-
list.pushFront(values[i]);
|
|
49
|
-
}
|
|
50
|
-
return list;
|
|
51
|
-
};
|
|
52
|
-
exports.appendValuesFront = appendValuesFront;
|
|
53
|
-
const appendValuesBack = (list, values) => {
|
|
54
|
-
if (typeof list.appendBack == 'function' && list.isCompatible(values)) {
|
|
55
|
-
list.appendBack(values);
|
|
56
|
-
return list;
|
|
57
|
-
}
|
|
58
|
-
return pushValuesBack(list, values);
|
|
59
|
-
};
|
|
60
|
-
exports.appendValuesBack = appendValuesBack;
|
|
61
|
-
const addValuesBefore = (ptr, values) => {
|
|
62
|
-
for (const value of values) {
|
|
63
|
-
ptr.addBefore(value);
|
|
64
|
-
}
|
|
65
|
-
return ptr;
|
|
66
|
-
};
|
|
67
|
-
exports.addValuesBefore = addValuesBefore;
|
|
68
|
-
const addValuesAfter = (ptr, values) => {
|
|
69
|
-
for (const value of values) {
|
|
70
|
-
ptr.addAfter(value);
|
|
71
|
-
}
|
|
72
|
-
return ptr;
|
|
73
|
-
};
|
|
74
|
-
exports.addValuesAfter = addValuesAfter;
|
|
75
|
-
const insertValuesBefore = (ptr, values) => {
|
|
76
|
-
if (typeof ptr.insertBefore == 'function' && ptr.list.isCompatible(values)) {
|
|
77
|
-
ptr.insertBefore(ptr.list.makeFrom(values));
|
|
78
|
-
return ptr;
|
|
79
|
-
}
|
|
80
|
-
return addValuesBefore(ptr, values);
|
|
81
|
-
};
|
|
82
|
-
exports.insertValuesBefore = insertValuesBefore;
|
|
83
|
-
const insertValuesAfter = (ptr, values) => {
|
|
84
|
-
if (typeof ptr.insertAfter == 'function' && ptr.list.isCompatible(values)) {
|
|
85
|
-
ptr.insertAfter(ptr.list.makeFrom(values));
|
|
86
|
-
return ptr;
|
|
87
|
-
}
|
|
88
|
-
if (!Array.isArray(values)) values = Array.from(values);
|
|
89
|
-
for (let i = values.length - 1; i >= 0; --i) {
|
|
90
|
-
ptr.addAfter(values[i]);
|
|
91
|
-
}
|
|
92
|
-
return ptr;
|
|
93
|
-
};
|
|
94
|
-
exports.insertValuesAfter = insertValuesAfter;
|
|
95
|
-
const findNodeBy = (list, condition) => {
|
|
96
|
-
for (const node of list.getNodeIterator()) {
|
|
97
|
-
if (condition(node)) return node;
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
};
|
|
101
|
-
exports.findNodeBy = findNodeBy;
|
|
102
|
-
const findPtrBy = (list, condition) => {
|
|
103
|
-
for (const ptr of list.getPtrIterator()) {
|
|
104
|
-
if (condition(ptr.node)) return ptr;
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
};
|
|
108
|
-
exports.findPtrBy = findPtrBy;
|
|
109
|
-
const removeNodeBy = (list, condition) => {
|
|
110
|
-
for (const ptr of list.getPtrIterator()) {
|
|
111
|
-
if (condition(ptr.node)) return ptr.removeCurrent();
|
|
112
|
-
}
|
|
113
|
-
return null;
|
|
114
|
-
};
|
|
115
|
-
exports.removeNodeBy = removeNodeBy;
|
|
116
|
-
const backPusher = (ExtListClass, options) => {
|
|
117
|
-
const list = new ExtListClass(null, options),
|
|
118
|
-
adapter = {
|
|
119
|
-
nextName: list.nextName,
|
|
120
|
-
prevName: list.prevName,
|
|
121
|
-
pushBackNode: node => {
|
|
122
|
-
const ptr = list.addNodeAfter(node);
|
|
123
|
-
list.next();
|
|
124
|
-
return ptr.node;
|
|
125
|
-
},
|
|
126
|
-
releaseList: () => list.make(list.next().detach())
|
|
127
|
-
};
|
|
128
|
-
return adapter;
|
|
129
|
-
};
|
|
130
|
-
exports.backPusher = backPusher;
|
|
131
|
-
const frontPusher = (ExtListClass, options) => {
|
|
132
|
-
const list = new ExtListClass(null, options),
|
|
133
|
-
adapter = {
|
|
134
|
-
nextName: list.nextName,
|
|
135
|
-
prevName: list.prevName,
|
|
136
|
-
pushFrontNode: node => list.addNodeAfter(node).node,
|
|
137
|
-
releaseList: () => (void 0).make(list.detach())
|
|
138
|
-
};
|
|
139
|
-
return adapter;
|
|
140
|
-
};
|
|
141
|
-
exports.frontPusher = frontPusher;
|
package/cjs/list.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {};
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _core = _interopRequireWildcard(require("./list/core.js"));
|
|
9
|
-
Object.keys(_core).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
12
|
-
if (key in exports && exports[key] === _core[key]) return;
|
|
13
|
-
Object.defineProperty(exports, key, {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _core[key];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
|
-
var _default = exports.default = _core.default;
|
package/cjs/meta-utils.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.toSnakeCase = exports.toPascalCase = exports.toKebabCase = exports.toCamelCase = exports.toAllCapsSnakeCase = exports.normalizeIterator = exports.mapIterator = exports.fromSnakeCase = exports.fromSetter = exports.fromPascalCase = exports.fromKebabCase = exports.fromGetter = exports.fromCamelCase = exports.fromAccessors = exports.defaultDescriptor = exports.copyOptions = exports.copyDescriptors = exports.capitalize = exports.canHaveProps = exports.augmentIterator = exports.addGetters = exports.addDescriptors = exports.addDescriptor = exports.addAliases = exports.addAlias = exports.addAccessor = void 0;
|
|
7
|
-
const capitalize = name => name ? name[0].toUpperCase() + name.substring(1).toLowerCase() : name;
|
|
8
|
-
exports.capitalize = capitalize;
|
|
9
|
-
const toCamelCase = names => names.map((name, index) => index ? capitalize(name) : name.toLowerCase()).join('');
|
|
10
|
-
exports.toCamelCase = toCamelCase;
|
|
11
|
-
const fromCamelCase = name => name.split(/(?=[A-Z])/g);
|
|
12
|
-
exports.fromCamelCase = fromCamelCase;
|
|
13
|
-
const toPascalCase = names => names.map(name => capitalize(name)).join('');
|
|
14
|
-
exports.toPascalCase = toPascalCase;
|
|
15
|
-
const fromPascalCase = name => name.split(/(?=[A-Z])/g);
|
|
16
|
-
exports.fromPascalCase = fromPascalCase;
|
|
17
|
-
const toAllCapsSnakeCase = names => names.map(name => name.toUpperCase()).join('_');
|
|
18
|
-
exports.toAllCapsSnakeCase = toAllCapsSnakeCase;
|
|
19
|
-
const toSnakeCase = names => names.map(name => name.toLowerCase()).join('_');
|
|
20
|
-
exports.toSnakeCase = toSnakeCase;
|
|
21
|
-
const fromSnakeCase = name => name.split('_');
|
|
22
|
-
exports.fromSnakeCase = fromSnakeCase;
|
|
23
|
-
const toKebabCase = names => names.map(name => name.toLowerCase()).join('-');
|
|
24
|
-
exports.toKebabCase = toKebabCase;
|
|
25
|
-
const fromKebabCase = name => name.split('-');
|
|
26
|
-
exports.fromKebabCase = fromKebabCase;
|
|
27
|
-
const defaultDescriptor = exports.defaultDescriptor = {
|
|
28
|
-
configurable: true,
|
|
29
|
-
enumerable: true
|
|
30
|
-
};
|
|
31
|
-
const fromGetter = (getter, defaultDescriptor = defaultDescriptor) => {
|
|
32
|
-
const descriptor = {
|
|
33
|
-
...defaultDescriptor
|
|
34
|
-
};
|
|
35
|
-
if (typeof getter == 'function') descriptor.get = getter;
|
|
36
|
-
return descriptor;
|
|
37
|
-
};
|
|
38
|
-
exports.fromGetter = fromGetter;
|
|
39
|
-
const fromSetter = (setter, defaultDescriptor = defaultDescriptor) => {
|
|
40
|
-
const descriptor = {
|
|
41
|
-
...defaultDescriptor
|
|
42
|
-
};
|
|
43
|
-
if (typeof setter == 'function') descriptor.set = setter;
|
|
44
|
-
return descriptor;
|
|
45
|
-
};
|
|
46
|
-
exports.fromSetter = fromSetter;
|
|
47
|
-
const fromAccessors = (getter, setter, defaultDescriptor = defaultDescriptor) => {
|
|
48
|
-
const descriptor = {
|
|
49
|
-
...defaultDescriptor
|
|
50
|
-
};
|
|
51
|
-
if (typeof getter == 'function') descriptor.get = getter;
|
|
52
|
-
if (typeof setter == 'function') descriptor.set = setter;
|
|
53
|
-
return descriptor;
|
|
54
|
-
};
|
|
55
|
-
exports.fromAccessors = fromAccessors;
|
|
56
|
-
const addDescriptor = (target, names, descriptor, force) => {
|
|
57
|
-
if (!descriptor) return target;
|
|
58
|
-
if (typeof names == 'string') names = names.trim().split(/\s*,\s*/);
|
|
59
|
-
if (!Array.isArray(names)) names = [names];
|
|
60
|
-
for (const name of names) {
|
|
61
|
-
if (!force && target.hasOwnProperty(name)) continue;
|
|
62
|
-
Object.defineProperty(target, name, descriptor);
|
|
63
|
-
}
|
|
64
|
-
return target;
|
|
65
|
-
};
|
|
66
|
-
exports.addDescriptor = addDescriptor;
|
|
67
|
-
const addDescriptors = (target, dict, force) => {
|
|
68
|
-
for (const [names, descriptor] of Object.entries(dict)) {
|
|
69
|
-
addDescriptor(target, names, descriptor, force);
|
|
70
|
-
}
|
|
71
|
-
for (const symbol of Object.getOwnPropertySymbols(dict)) {
|
|
72
|
-
const descriptor = Object.getOwnPropertyDescriptor(dict, symbol);
|
|
73
|
-
if (!descriptor || !descriptor.enumerable) continue;
|
|
74
|
-
addDescriptor(target, [symbol], dict[symbol], force);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
exports.addDescriptors = addDescriptors;
|
|
78
|
-
const addAccessor = (target, names, getter, setter, force) => addDescriptor(target, names, fromAccessors(getter, setter), force);
|
|
79
|
-
exports.addAccessor = addAccessor;
|
|
80
|
-
const addGetters = (target, dict, force) => {
|
|
81
|
-
for (const [names, getter] of Object.entries(dict)) {
|
|
82
|
-
addDescriptor(target, names, fromGetter(getter), force);
|
|
83
|
-
}
|
|
84
|
-
for (const symbol of Object.getOwnPropertySymbols(dict)) {
|
|
85
|
-
const descriptor = Object.getOwnPropertyDescriptor(source, symbol);
|
|
86
|
-
if (!descriptor || !descriptor.enumerable) continue;
|
|
87
|
-
addDescriptor(target, [symbol], fromGetter(dict[symbol]), force);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.addGetters = addGetters;
|
|
91
|
-
const copyDescriptors = (target, source, names, force) => {
|
|
92
|
-
switch (typeof names) {
|
|
93
|
-
case 'string':
|
|
94
|
-
names = names.trim().split(/\s*,\s*/);
|
|
95
|
-
break;
|
|
96
|
-
case 'symbol':
|
|
97
|
-
names = [names];
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (Array.isArray(names)) {
|
|
101
|
-
for (const name of names) {
|
|
102
|
-
addDescriptor(target, [name], Object.getOwnPropertyDescriptor(source, name), force);
|
|
103
|
-
}
|
|
104
|
-
} else {
|
|
105
|
-
for (const [name, aliases] of Object.entries(names)) {
|
|
106
|
-
addDescriptor(target, aliases, Object.getOwnPropertyDescriptor(source, name), force);
|
|
107
|
-
}
|
|
108
|
-
for (const symbol of Object.getOwnPropertySymbols(names)) {
|
|
109
|
-
const descriptor = Object.getOwnPropertyDescriptor(names, symbol);
|
|
110
|
-
if (!descriptor || !descriptor.enumerable) continue;
|
|
111
|
-
addDescriptor(target, names[symbol], Object.getOwnPropertyDescriptor(source, symbol), force);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return target;
|
|
115
|
-
};
|
|
116
|
-
exports.copyDescriptors = copyDescriptors;
|
|
117
|
-
const addAlias = (object, name, aliases, force) => addDescriptor(object, aliases, Object.getOwnPropertyDescriptor(object, name), force);
|
|
118
|
-
exports.addAlias = addAlias;
|
|
119
|
-
const addAliases = (object, dict, force) => copyDescriptors(object, object, dict, force);
|
|
120
|
-
exports.addAliases = addAliases;
|
|
121
|
-
const augmentIterator = iterator => {
|
|
122
|
-
if (!iterator.hasOwnProperty(Symbol.iterator)) {
|
|
123
|
-
iterator[Symbol.iterator] = function () {
|
|
124
|
-
return this;
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
return iterator;
|
|
128
|
-
};
|
|
129
|
-
exports.augmentIterator = augmentIterator;
|
|
130
|
-
let normalizeIterator = exports.normalizeIterator = augmentIterator;
|
|
131
|
-
if (typeof globalThis.Iterator?.from == 'function') {
|
|
132
|
-
exports.normalizeIterator = normalizeIterator = iterator => Iterator.from(iterator);
|
|
133
|
-
}
|
|
134
|
-
const mapIterator = (iterator, callbackFn) => {
|
|
135
|
-
if (typeof iterator?.map == 'function') return iterator.map(callbackFn);
|
|
136
|
-
return {
|
|
137
|
-
[Symbol.iterator]: () => {
|
|
138
|
-
const iterable = iterator[Symbol.iterator]();
|
|
139
|
-
let index = 0;
|
|
140
|
-
return normalizeIterator({
|
|
141
|
-
next: () => {
|
|
142
|
-
const result = iterable.next();
|
|
143
|
-
if (result.done) return result;
|
|
144
|
-
return {
|
|
145
|
-
value: callbackFn(result.value, index++)
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
exports.mapIterator = mapIterator;
|
|
153
|
-
const canHaveProps = exports.canHaveProps = {
|
|
154
|
-
object: 1,
|
|
155
|
-
function: 1
|
|
156
|
-
};
|
|
157
|
-
const copyOptions = (target, pattern, ...sources) => {
|
|
158
|
-
target = target || {};
|
|
159
|
-
const keys = Object.keys(pattern);
|
|
160
|
-
for (const key of keys) {
|
|
161
|
-
target[key] = pattern[key];
|
|
162
|
-
}
|
|
163
|
-
for (const source of sources) {
|
|
164
|
-
if (!source || canHaveProps[typeof source] !== 1) continue;
|
|
165
|
-
for (const key of keys) {
|
|
166
|
-
if (key in source) target[key] = source[key];
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return target;
|
|
170
|
-
};
|
|
171
|
-
exports.copyOptions = copyOptions;
|
package/cjs/nt-utils.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// utilities for working with null-terminated lists
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.makeSListFromNTList = exports.makeNTListFromSListFast = exports.makeNTListFromSList = exports.makeNTListFromList = exports.makeListFromNTList = exports.isNTList = exports.getNTListTail = exports.getNTListLength = exports.getNTListHead = void 0;
|
|
8
|
-
const isNTList = (head, {
|
|
9
|
-
nextName = 'next'
|
|
10
|
-
} = {}) => {
|
|
11
|
-
if (head === null) return true;
|
|
12
|
-
let current = head;
|
|
13
|
-
do {
|
|
14
|
-
const next = current[nextName];
|
|
15
|
-
if (next === null) return true;
|
|
16
|
-
if (!next) break;
|
|
17
|
-
current = next;
|
|
18
|
-
} while (current !== head);
|
|
19
|
-
return false;
|
|
20
|
-
};
|
|
21
|
-
exports.isNTList = isNTList;
|
|
22
|
-
const getNTListTail = (head, {
|
|
23
|
-
nextName = 'next'
|
|
24
|
-
} = {}) => {
|
|
25
|
-
if (head === null) return null;
|
|
26
|
-
let current = head;
|
|
27
|
-
do {
|
|
28
|
-
const next = current[nextName];
|
|
29
|
-
if (!next) return current;
|
|
30
|
-
current = next;
|
|
31
|
-
} while (current !== head);
|
|
32
|
-
return null;
|
|
33
|
-
};
|
|
34
|
-
exports.getNTListTail = getNTListTail;
|
|
35
|
-
const getNTListHead = (node, {
|
|
36
|
-
prevName = 'prev'
|
|
37
|
-
} = {}) => getNTListTail(node, {
|
|
38
|
-
nextName: prevName
|
|
39
|
-
});
|
|
40
|
-
exports.getNTListHead = getNTListHead;
|
|
41
|
-
const getNTListLength = (head, {
|
|
42
|
-
nextName = 'next'
|
|
43
|
-
} = {}) => {
|
|
44
|
-
if (head === null) return 0;
|
|
45
|
-
let current = head;
|
|
46
|
-
let length = 1;
|
|
47
|
-
do {
|
|
48
|
-
const next = current[nextName];
|
|
49
|
-
if (!next) return length;
|
|
50
|
-
current = next;
|
|
51
|
-
++length;
|
|
52
|
-
} while (current !== head);
|
|
53
|
-
return length;
|
|
54
|
-
};
|
|
55
|
-
exports.getNTListLength = getNTListLength;
|
|
56
|
-
const makeListFromNTList = (node, {
|
|
57
|
-
nextName = 'next',
|
|
58
|
-
prevName = 'prev'
|
|
59
|
-
} = {}) => {
|
|
60
|
-
if (node === null) return null;
|
|
61
|
-
const head = getNTListHead(node, {
|
|
62
|
-
prevName
|
|
63
|
-
}),
|
|
64
|
-
tail = getNTListTail(node, {
|
|
65
|
-
nextName
|
|
66
|
-
});
|
|
67
|
-
head[prevName] = tail;
|
|
68
|
-
tail[nextName] = head;
|
|
69
|
-
return {
|
|
70
|
-
head,
|
|
71
|
-
tail
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
exports.makeListFromNTList = makeListFromNTList;
|
|
75
|
-
const makeSListFromNTList = (head, {
|
|
76
|
-
nextName = 'next'
|
|
77
|
-
} = {}) => {
|
|
78
|
-
if (head === null) return null;
|
|
79
|
-
const tail = getNTListTail(head, {
|
|
80
|
-
nextName
|
|
81
|
-
});
|
|
82
|
-
tail[nextName] = head;
|
|
83
|
-
return {
|
|
84
|
-
head,
|
|
85
|
-
tail
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
exports.makeSListFromNTList = makeSListFromNTList;
|
|
89
|
-
const makeNTListFromList = (head, {
|
|
90
|
-
nextName = 'next',
|
|
91
|
-
prevName = 'prev'
|
|
92
|
-
} = {}) => {
|
|
93
|
-
if (head === null) return null;
|
|
94
|
-
const tail = head[prevName];
|
|
95
|
-
tail[nextName] = null;
|
|
96
|
-
head[prevName] = null;
|
|
97
|
-
return {
|
|
98
|
-
head,
|
|
99
|
-
tail
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
exports.makeNTListFromList = makeNTListFromList;
|
|
103
|
-
const makeNTListFromSListFast = (head, {
|
|
104
|
-
nextName = 'next'
|
|
105
|
-
} = {}) => {
|
|
106
|
-
if (head === null) return null;
|
|
107
|
-
const tail = head;
|
|
108
|
-
head = head[nextName];
|
|
109
|
-
tail[nextName] = null;
|
|
110
|
-
return {
|
|
111
|
-
head,
|
|
112
|
-
tail
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
exports.makeNTListFromSListFast = makeNTListFromSListFast;
|
|
116
|
-
const makeNTListFromSList = (head, {
|
|
117
|
-
nextName = 'next'
|
|
118
|
-
} = {}) => {
|
|
119
|
-
if (head === null) return null;
|
|
120
|
-
let tail = head;
|
|
121
|
-
for (;;) {
|
|
122
|
-
const next = tail[nextName];
|
|
123
|
-
if (next === head) break;
|
|
124
|
-
tail = next;
|
|
125
|
-
}
|
|
126
|
-
tail[nextName] = null;
|
|
127
|
-
return {
|
|
128
|
-
head,
|
|
129
|
-
tail
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
exports.makeNTListFromSList = makeNTListFromSList;
|
package/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|