Socket
Socket
Sign inDemoInstall

@rimbu/sorted

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rimbu/sorted - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

44

dist/main/base.js

@@ -11,3 +11,3 @@ "use strict";

var SortedEmpty = /** @class */ (function (_super) {
tslib_1.__extends(SortedEmpty, _super);
(0, tslib_1.__extends)(SortedEmpty, _super);
function SortedEmpty() {

@@ -17,9 +17,9 @@ return _super !== null && _super.apply(this, arguments) || this;

SortedEmpty.prototype.min = function (otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};
SortedEmpty.prototype.max = function (otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};
SortedEmpty.prototype.getAtIndex = function (index, otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};

@@ -39,3 +39,3 @@ SortedEmpty.prototype.take = function () {

var SortedNonEmptyBase = /** @class */ (function (_super) {
tslib_1.__extends(SortedNonEmptyBase, _super);
(0, tslib_1.__extends)(SortedNonEmptyBase, _super);
function SortedNonEmptyBase() {

@@ -107,3 +107,3 @@ return _super !== null && _super.apply(this, arguments) || this;

function innerDeleteMin(source) {
var _a = tslib_1.__read(source.children[0].deleteMin(), 2), min = _a[0], newFirst = _a[1];
var _a = (0, tslib_1.__read)(source.children[0].deleteMin(), 2), min = _a[0], newFirst = _a[1];
var newSelf = source.normalizeIncreaseChild(0, newFirst, source.size - 1);

@@ -115,3 +115,3 @@ return [min, newSelf];

var lastChildIndex = source.children.length - 1;
var _a = tslib_1.__read(source.children[lastChildIndex].deleteMax(), 2), max = _a[0], newLast = _a[1];
var _a = (0, tslib_1.__read)(source.children[lastChildIndex].deleteMax(), 2), max = _a[0], newLast = _a[1];
var newSelf = source.normalizeIncreaseChild(lastChildIndex, newLast, source.size - 1);

@@ -194,3 +194,3 @@ return [max, newSelf];

// cannot shift
var _a = tslib_1.__read(newChild.mutateSplitRight(), 2), upEntry = _a[0], rightChild_1 = _a[1];
var _a = (0, tslib_1.__read)(newChild.mutateSplitRight(), 2), upEntry = _a[0], rightChild_1 = _a[1];
var newEntries_1 = base_1.Arr.insert(source.entries, childIndex, upEntry);

@@ -204,3 +204,3 @@ var newChildren_1 = base_1.Arr.splice(source.children, childIndex, 1, newChild, rightChild_1);

// shiftleft
var _b = tslib_1.__read(newChild.mutateGiveToLeft(leftChild, source.entries[childIndex - 1]), 2), newSep_1 = _b[0], newLeft = _b[1];
var _b = (0, tslib_1.__read)(newChild.mutateGiveToLeft(leftChild, source.entries[childIndex - 1]), 2), newSep_1 = _b[0], newLeft = _b[1];
var newEntries_2 = base_1.Arr.update(source.entries, childIndex - 1, newSep_1);

@@ -211,3 +211,3 @@ var newChildren_2 = base_1.Arr.splice(source.children, childIndex - 1, 2, newLeft, newChild);

// shiftright
var _c = tslib_1.__read(newChild.mutateGiveToRight(rightChild, source.entries[childIndex]), 2), newSep = _c[0], newRight = _c[1];
var _c = (0, tslib_1.__read)(newChild.mutateGiveToRight(rightChild, source.entries[childIndex]), 2), newSep = _c[0], newRight = _c[1];
var newEntries = base_1.Arr.update(source.entries, childIndex, newSep);

@@ -246,3 +246,3 @@ var newChildren = base_1.Arr.splice(source.children, childIndex, 2, newChild, newRight);

// get from left
var _a = tslib_1.__read(newChild.mutateGetFromLeft(leftChild, source.entries[childIndex - 1]), 2), newSep_2 = _a[0], newLeft = _a[1];
var _a = (0, tslib_1.__read)(newChild.mutateGetFromLeft(leftChild, source.entries[childIndex - 1]), 2), newSep_2 = _a[0], newLeft = _a[1];
var newEntries_5 = base_1.Arr.update(source.entries, childIndex - 1, newSep_2);

@@ -253,3 +253,3 @@ var newChildren_6 = base_1.Arr.splice(source.children, childIndex - 1, 2, newLeft, newChild);

// get from right
var _b = tslib_1.__read(newChild.mutateGetFromRight(rightChild, source.entries[childIndex]), 2), newSep = _b[0], newRight = _b[1];
var _b = (0, tslib_1.__read)(newChild.mutateGetFromRight(rightChild, source.entries[childIndex]), 2), newSep = _b[0], newRight = _b[1];
var newEntries = base_1.Arr.update(source.entries, childIndex, newSep);

@@ -287,3 +287,3 @@ var newChildren = base_1.Arr.splice(source.children, childIndex, 2, newChild, newRight);

if (index >= source.size || -index > source.size)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
if (index < 0)

@@ -302,3 +302,3 @@ return innerGetAtIndex(source, source.size + index, otherwise);

if (Array.isArray(indexResult)) {
var _a = tslib_1.__read(indexResult, 2), childIndex = _a[0], inChildIndex = _a[1];
var _a = (0, tslib_1.__read)(indexResult, 2), childIndex = _a[0], inChildIndex = _a[1];
var untilChild = childIndex;

@@ -332,3 +332,3 @@ var entries_1 = source.entries.slice(0, untilChild);

if (Array.isArray(indexResult)) {
var _a = tslib_1.__read(indexResult, 2), childIndex = _a[0], inChildIndex = _a[1];
var _a = (0, tslib_1.__read)(indexResult, 2), childIndex = _a[0], inChildIndex = _a[1];
var fromChild = childIndex;

@@ -363,3 +363,3 @@ var entries_2 = source.entries.slice(fromChild);

return stream_1.Stream.empty();
var _a = tslib_1.__read(result, 2), startIndex = _a[0], endIndex = _a[1];
var _a = (0, tslib_1.__read)(result, 2), startIndex = _a[0], endIndex = _a[1];
var startSubIndex = innerGetSubIndex(source, startIndex);

@@ -454,3 +454,3 @@ var endSubIndex = innerGetSubIndex(source, endIndex);

if (this.size === 0)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
if (this.hasChildren)

@@ -464,3 +464,3 @@ return this.children[0].min(otherwise);

if (this.size === 0)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
if (this.hasChildren)

@@ -476,3 +476,3 @@ return base_1.Arr.last(this.children).max(otherwise);

if (index >= this.size || -index > this.size) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
}

@@ -503,3 +503,3 @@ if (index < 0) {

SortedBuilder.prototype.forEach = function (f, state) {
if (state === void 0) { state = common_1.TraverseState(); }
if (state === void 0) { state = (0, common_1.TraverseState)(); }
if (state.halted || this.isEmpty)

@@ -578,3 +578,3 @@ return;

// join left
var _a = tslib_1.__read(this.entries.splice(childIndex - 1, 1), 1), down_1 = _a[0];
var _a = (0, tslib_1.__read)(this.entries.splice(childIndex - 1, 1), 1), down_1 = _a[0];
leftChild.entries.push(down_1);

@@ -590,3 +590,3 @@ leftChild.entries = leftChild.entries.concat(child.entries);

// join right
var _b = tslib_1.__read(this.entries.splice(childIndex, 1), 1), down = _b[0];
var _b = (0, tslib_1.__read)(this.entries.splice(childIndex, 1), 1), down = _b[0];
rightChild.entries.unshift(down);

@@ -593,0 +593,0 @@ rightChild.entries = child.entries.concat(rightChild.entries);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./internal"), exports);
(0, tslib_1.__exportStar)(require("./internal"), exports);
//# sourceMappingURL=index.js.map

@@ -5,8 +5,8 @@ "use strict";

var tslib_1 = require("tslib");
exports.SortedIndex = tslib_1.__importStar(require("./common/sorted-index"));
exports.SortedCustom = tslib_1.__importStar(require("./sorted-custom"));
exports.SortedMapCustom = tslib_1.__importStar(require("./sortedmap-custom"));
exports.SortedSetCustom = tslib_1.__importStar(require("./sortedset-custom"));
tslib_1.__exportStar(require("./map/interface"), exports);
tslib_1.__exportStar(require("./set/interface"), exports);
exports.SortedIndex = (0, tslib_1.__importStar)(require("./common/sorted-index"));
exports.SortedCustom = (0, tslib_1.__importStar)(require("./sorted-custom"));
exports.SortedMapCustom = (0, tslib_1.__importStar)(require("./sortedmap-custom"));
exports.SortedSetCustom = (0, tslib_1.__importStar)(require("./sortedset-custom"));
(0, tslib_1.__exportStar)(require("./map/interface"), exports);
(0, tslib_1.__exportStar)(require("./set/interface"), exports);
//# sourceMappingURL=internal.js.map

@@ -12,3 +12,3 @@ "use strict";

var SortedMapBuilder = /** @class */ (function (_super) {
tslib_1.__extends(SortedMapBuilder, _super);
(0, tslib_1.__extends)(SortedMapBuilder, _super);
function SortedMapBuilder(context, source, _entries, _children, size) {

@@ -25,3 +25,3 @@ if (size === void 0) { size = (_a = source === null || source === void 0 ? void 0 : source.size) !== null && _a !== void 0 ? _a : 0; }

if (!_this.context.comp.isComparable(key))
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
if (undefined !== _this.source)

@@ -38,3 +38,3 @@ return _this.source.get(key, otherwise);

}
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};

@@ -60,3 +60,3 @@ _this.hasKey = function (key) {

if (!_this.context.comp.isComparable(key))
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
var result = _this.removeInternal(key, otherwise);

@@ -88,7 +88,7 @@ _this.normalize();

found = true;
return common_1.Update(value, update);
return (0, common_1.Update)(value, update);
},
});
if (!found)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
return result;

@@ -190,3 +190,3 @@ };

if (this.size === 0)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
var entryIndex = this.context.findIndex(key, this.entries);

@@ -214,3 +214,3 @@ if (entryIndex >= 0) {

if (!this.hasChildren)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
var childIndex = internal_1.SortedIndex.next(entryIndex);

@@ -222,3 +222,3 @@ var child = this.children[childIndex];

if (token === oldValue)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
this.source = undefined;

@@ -251,3 +251,3 @@ this.size += child.size - preSize;

return false;
var newValue = common_1.OptLazyOr(options.ifNew, base_1.Token);
var newValue = (0, common_1.OptLazyOr)(options.ifNew, base_1.Token);
if (base_1.Token === newValue)

@@ -254,0 +254,0 @@ return false;

@@ -8,3 +8,3 @@ "use strict";

var SortedMapContext = /** @class */ (function (_super) {
tslib_1.__extends(SortedMapContext, _super);
(0, tslib_1.__extends)(SortedMapContext, _super);
function SortedMapContext(blockSizeBits, comp) {

@@ -11,0 +11,0 @@ var _this = _super.call(this) || this;

@@ -11,3 +11,3 @@ "use strict";

var SortedMapEmpty = /** @class */ (function (_super) {
tslib_1.__extends(SortedMapEmpty, _super);
(0, tslib_1.__extends)(SortedMapEmpty, _super);
function SortedMapEmpty(context) {

@@ -31,15 +31,15 @@ var _this = _super.call(this) || this;

SortedMapEmpty.prototype.minKey = function (otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};
SortedMapEmpty.prototype.minValue = function (otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};
SortedMapEmpty.prototype.maxKey = function (otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};
SortedMapEmpty.prototype.maxValue = function (otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};
SortedMapEmpty.prototype.get = function (key, otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};

@@ -50,6 +50,6 @@ SortedMapEmpty.prototype.hasKey = function () {

SortedMapEmpty.prototype.getKeyAtIndex = function (index, otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};
SortedMapEmpty.prototype.getValueAtIndex = function (index, otherwise) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
};

@@ -76,3 +76,3 @@ SortedMapEmpty.prototype.set = function (key, value) {

if (undefined !== options.ifNew) {
var value = common_1.OptLazyOr(options.ifNew, base_1.Token);
var value = (0, common_1.OptLazyOr)(options.ifNew, base_1.Token);
if (base_1.Token === value)

@@ -114,4 +114,4 @@ return this;

}
return (_a = this.context).mergeAll.apply(_a, tslib_1.__spreadArray([fillValue,
this], tslib_1.__read(sources)));
return (_a = this.context).mergeAll.apply(_a, (0, tslib_1.__spreadArray)([fillValue,
this], (0, tslib_1.__read)(sources), false));
};

@@ -124,5 +124,5 @@ SortedMapEmpty.prototype.mergeAllWith = function (fillValue, mergeFun) {

}
return (_a = this.context).mergeAllWith.apply(_a, tslib_1.__spreadArray([fillValue,
return (_a = this.context).mergeAllWith.apply(_a, (0, tslib_1.__spreadArray)([fillValue,
mergeFun,
this], tslib_1.__read(sources)));
this], (0, tslib_1.__read)(sources), false));
};

@@ -135,3 +135,3 @@ SortedMapEmpty.prototype.merge = function () {

}
return (_a = this.context).merge.apply(_a, tslib_1.__spreadArray([this], tslib_1.__read(sources)));
return (_a = this.context).merge.apply(_a, (0, tslib_1.__spreadArray)([this], (0, tslib_1.__read)(sources), false));
};

@@ -144,4 +144,4 @@ SortedMapEmpty.prototype.mergeWith = function (mergeFun) {

}
return (_a = this.context).mergeWith.apply(_a, tslib_1.__spreadArray([mergeFun,
this], tslib_1.__read(sources)));
return (_a = this.context).mergeWith.apply(_a, (0, tslib_1.__spreadArray)([mergeFun,
this], (0, tslib_1.__read)(sources), false));
};

@@ -152,3 +152,3 @@ return SortedMapEmpty;

var SortedMapNode = /** @class */ (function (_super) {
tslib_1.__extends(SortedMapNode, _super);
(0, tslib_1.__extends)(SortedMapNode, _super);
function SortedMapNode() {

@@ -165,3 +165,3 @@ return _super !== null && _super.apply(this, arguments) || this;

if (undefined !== start) {
var _b = tslib_1.__read(start, 2), startValue = _b[0], startInclude = _b[1];
var _b = (0, tslib_1.__read)(start, 2), startValue = _b[0], startInclude = _b[1];
startIndex = this.getInsertIndexOf(startValue);

@@ -176,3 +176,3 @@ if (startIndex < 0) {

if (undefined !== end) {
var _c = tslib_1.__read(end, 2), endValue = _c[0], endInclude = _c[1];
var _c = (0, tslib_1.__read)(end, 2), endValue = _c[0], endInclude = _c[1];
endIndex = this.getInsertIndexOf(endValue);

@@ -219,3 +219,3 @@ if (endIndex < 0)

if (token === result)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
return result[0];

@@ -227,3 +227,3 @@ };

if (token === result)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
return result[1];

@@ -251,3 +251,3 @@ };

return this.modifyAt(key, {
ifExists: function (value) { return common_1.Update(value, update); },
ifExists: function (value) { return (0, common_1.Update)(value, update); },
}).assumeNonEmpty();

@@ -316,3 +316,3 @@ };

return this;
var _a = tslib_1.__read(indexRange, 2), start = _a[0], end = _a[1];
var _a = (0, tslib_1.__read)(indexRange, 2), start = _a[0], end = _a[1];
return this.drop(start).take(end - start + 1);

@@ -353,4 +353,4 @@ };

}
return (_a = this.context).mergeAll.apply(_a, tslib_1.__spreadArray([fillValue,
this], tslib_1.__read(sources)));
return (_a = this.context).mergeAll.apply(_a, (0, tslib_1.__spreadArray)([fillValue,
this], (0, tslib_1.__read)(sources), false));
};

@@ -363,5 +363,5 @@ SortedMapNode.prototype.mergeAllWith = function (fillValue, mergeFun) {

}
return (_a = this.context).mergeAllWith.apply(_a, tslib_1.__spreadArray([fillValue,
return (_a = this.context).mergeAllWith.apply(_a, (0, tslib_1.__spreadArray)([fillValue,
mergeFun,
this], tslib_1.__read(sources)));
this], (0, tslib_1.__read)(sources), false));
};

@@ -374,3 +374,3 @@ SortedMapNode.prototype.merge = function () {

}
return (_a = this.context).merge.apply(_a, tslib_1.__spreadArray([this], tslib_1.__read(sources)));
return (_a = this.context).merge.apply(_a, (0, tslib_1.__spreadArray)([this], (0, tslib_1.__read)(sources), false));
};

@@ -383,4 +383,4 @@ SortedMapNode.prototype.mergeWith = function (mergeFun) {

}
return (_a = this.context).mergeWith.apply(_a, tslib_1.__spreadArray([mergeFun,
this], tslib_1.__read(sources)));
return (_a = this.context).mergeWith.apply(_a, (0, tslib_1.__spreadArray)([mergeFun,
this], (0, tslib_1.__read)(sources), false));
};

@@ -391,3 +391,3 @@ return SortedMapNode;

var SortedMapLeaf = /** @class */ (function (_super) {
tslib_1.__extends(SortedMapLeaf, _super);
(0, tslib_1.__extends)(SortedMapLeaf, _super);
function SortedMapLeaf(context, entries) {

@@ -425,6 +425,6 @@ var _this = _super.call(this) || this;

if (!this.context.isValidKey(key))
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
var index = this.context.findIndex(key, this.entries);
if (index < 0)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
return this.entries[index][1];

@@ -434,3 +434,3 @@ };

if (index >= this.size || -index > this.size)
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
if (index < 0)

@@ -441,3 +441,3 @@ return this.getAtIndex(this.size + index, otherwise);

SortedMapLeaf.prototype.forEach = function (f, state) {
if (state === void 0) { state = common_1.TraverseState(); }
if (state === void 0) { state = (0, common_1.TraverseState)(); }
if (state.halted)

@@ -496,3 +496,3 @@ return;

return this;
var newValue = common_1.OptLazyOr(options.ifNew, base_1.Token);
var newValue = (0, common_1.OptLazyOr)(options.ifNew, base_1.Token);
if (base_1.Token === newValue)

@@ -514,27 +514,27 @@ return this;

SortedMapLeaf.prototype.deleteMin = function () {
return sorted_custom_1.leafDeleteMin(this);
return (0, sorted_custom_1.leafDeleteMin)(this);
};
SortedMapLeaf.prototype.deleteMax = function () {
return sorted_custom_1.leafDeleteMax(this);
return (0, sorted_custom_1.leafDeleteMax)(this);
};
SortedMapLeaf.prototype.mutateSplitRight = function (index) {
return sorted_custom_1.leafMutateSplitRight(this, index);
return (0, sorted_custom_1.leafMutateSplitRight)(this, index);
};
SortedMapLeaf.prototype.mutateGiveToLeft = function (left, toLeft) {
return sorted_custom_1.leafMutateGiveToLeft(this, left, toLeft);
return (0, sorted_custom_1.leafMutateGiveToLeft)(this, left, toLeft);
};
SortedMapLeaf.prototype.mutateGiveToRight = function (right, toRight) {
return sorted_custom_1.leafMutateGiveToRight(this, right, toRight);
return (0, sorted_custom_1.leafMutateGiveToRight)(this, right, toRight);
};
SortedMapLeaf.prototype.mutateGetFromLeft = function (left, toMe) {
return sorted_custom_1.leafMutateGetFromLeft(this, left, toMe);
return (0, sorted_custom_1.leafMutateGetFromLeft)(this, left, toMe);
};
SortedMapLeaf.prototype.mutateGetFromRight = function (right, toMe) {
return sorted_custom_1.leafMutateGetFromRight(this, right, toMe);
return (0, sorted_custom_1.leafMutateGetFromRight)(this, right, toMe);
};
SortedMapLeaf.prototype.mutateJoinLeft = function (left, entry) {
return sorted_custom_1.leafMutateJoinLeft(this, left, entry);
return (0, sorted_custom_1.leafMutateJoinLeft)(this, left, entry);
};
SortedMapLeaf.prototype.mutateJoinRight = function (right, entry) {
return sorted_custom_1.leafMutateJoinRight(this, right, entry);
return (0, sorted_custom_1.leafMutateJoinRight)(this, right, entry);
};

@@ -547,3 +547,3 @@ SortedMapLeaf.prototype.normalize = function () {

var size = this.size;
var _a = tslib_1.__read(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
var _a = (0, tslib_1.__read)(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
return this.context.inner([upEntry], [this, rightNode], size);

@@ -555,3 +555,3 @@ };

var SortedMapInner = /** @class */ (function (_super) {
tslib_1.__extends(SortedMapInner, _super);
(0, tslib_1.__extends)(SortedMapInner, _super);
function SortedMapInner(context, entries, children, size) {

@@ -587,3 +587,3 @@ var _this = _super.call(this) || this;

.flatMap(function (_a) {
var _b = tslib_1.__read(_a, 2), child = _b[0], e = _b[1];
var _b = (0, tslib_1.__read)(_a, 2), child = _b[0], e = _b[1];
if (token === child)

@@ -597,3 +597,3 @@ base_1.RimbuError.throwInvalidStateError();

SortedMapInner.prototype.streamSliceIndex = function (range, reversed) {
return sorted_custom_1.innerStreamSliceIndex(this, range, reversed);
return (0, sorted_custom_1.innerStreamSliceIndex)(this, range, reversed);
};

@@ -608,3 +608,3 @@ SortedMapInner.prototype.min = function () {

if (!this.context.isValidKey(key))
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
var index = this.context.findIndex(key, this.entries);

@@ -618,6 +618,6 @@ if (index >= 0)

SortedMapInner.prototype.getAtIndex = function (index, otherwise) {
return sorted_custom_1.innerGetAtIndex(this, index, otherwise);
return (0, sorted_custom_1.innerGetAtIndex)(this, index, otherwise);
};
SortedMapInner.prototype.forEach = function (f, state) {
if (state === void 0) { state = common_1.TraverseState(); }
if (state === void 0) { state = (0, common_1.TraverseState)(); }
var i = -1;

@@ -717,3 +717,3 @@ var entryLength = this.entries.length;

if (leftChild.entries.length >= rightChild.entries.length) {
var _a = tslib_1.__read(leftChild.deleteMax(), 2), max = _a[0], newLeft = _a[1];
var _a = (0, tslib_1.__read)(leftChild.deleteMax(), 2), max = _a[0], newLeft = _a[1];
var newEntries_4 = base_1.Arr.update(this.entries, entryIndex, max);

@@ -723,3 +723,3 @@ var newSelf_1 = this.copy(newEntries_4);

}
var _b = tslib_1.__read(rightChild.deleteMin(), 2), min = _b[0], newRight = _b[1];
var _b = (0, tslib_1.__read)(rightChild.deleteMin(), 2), min = _b[0], newRight = _b[1];
var newEntries_5 = base_1.Arr.update(this.entries, entryIndex, min);

@@ -748,39 +748,39 @@ var newSelf = this.copy(newEntries_5);

SortedMapInner.prototype.takeInternal = function (amount) {
return sorted_custom_1.innerTakeInternal(this, amount);
return (0, sorted_custom_1.innerTakeInternal)(this, amount);
};
SortedMapInner.prototype.dropInternal = function (amount) {
return sorted_custom_1.innerDropInternal(this, amount);
return (0, sorted_custom_1.innerDropInternal)(this, amount);
};
SortedMapInner.prototype.deleteMin = function () {
return sorted_custom_1.innerDeleteMin(this);
return (0, sorted_custom_1.innerDeleteMin)(this);
};
SortedMapInner.prototype.deleteMax = function () {
return sorted_custom_1.innerDeleteMax(this);
return (0, sorted_custom_1.innerDeleteMax)(this);
};
SortedMapInner.prototype.mutateSplitRight = function (index) {
return sorted_custom_1.innerMutateSplitRight(this, index);
return (0, sorted_custom_1.innerMutateSplitRight)(this, index);
};
SortedMapInner.prototype.mutateGiveToLeft = function (left, toLeft) {
return sorted_custom_1.innerMutateGiveToLeft(this, left, toLeft);
return (0, sorted_custom_1.innerMutateGiveToLeft)(this, left, toLeft);
};
SortedMapInner.prototype.mutateGiveToRight = function (right, toRight) {
return sorted_custom_1.innerMutateGiveToRight(this, right, toRight);
return (0, sorted_custom_1.innerMutateGiveToRight)(this, right, toRight);
};
SortedMapInner.prototype.mutateGetFromLeft = function (left, toMe) {
return sorted_custom_1.innerMutateGetFromLeft(this, left, toMe);
return (0, sorted_custom_1.innerMutateGetFromLeft)(this, left, toMe);
};
SortedMapInner.prototype.mutateGetFromRight = function (right, toMe) {
return sorted_custom_1.innerMutateGetFromRight(this, right, toMe);
return (0, sorted_custom_1.innerMutateGetFromRight)(this, right, toMe);
};
SortedMapInner.prototype.mutateJoinLeft = function (left, entry) {
return sorted_custom_1.innerMutateJoinLeft(this, left, entry);
return (0, sorted_custom_1.innerMutateJoinLeft)(this, left, entry);
};
SortedMapInner.prototype.mutateJoinRight = function (right, entry) {
return sorted_custom_1.innerMutateJoinRight(this, right, entry);
return (0, sorted_custom_1.innerMutateJoinRight)(this, right, entry);
};
SortedMapInner.prototype.normalizeDownsizeChild = function (childIndex, newChild, newSize) {
return sorted_custom_1.innerNormalizeDownsizeChild(this, childIndex, newChild, newSize);
return (0, sorted_custom_1.innerNormalizeDownsizeChild)(this, childIndex, newChild, newSize);
};
SortedMapInner.prototype.normalizeIncreaseChild = function (childIndex, newChild, newSize) {
return sorted_custom_1.innerNormalizeIncreaseChild(this, childIndex, newChild, newSize);
return (0, sorted_custom_1.innerNormalizeIncreaseChild)(this, childIndex, newChild, newSize);
};

@@ -793,3 +793,3 @@ SortedMapInner.prototype.normalize = function () {

var size = this.size;
var _a = tslib_1.__read(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
var _a = (0, tslib_1.__read)(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
return this.copy([upEntry], [this, rightNode], size);

@@ -796,0 +796,0 @@ };

@@ -29,3 +29,3 @@ "use strict";

};
exports.SortedMap = tslib_1.__assign(tslib_1.__assign({}, _defaultContext), _contextHelpers);
exports.SortedMap = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, _defaultContext), _contextHelpers);
//# sourceMappingURL=interface.js.map

@@ -10,3 +10,3 @@ "use strict";

var SortedSetBuilder = /** @class */ (function (_super) {
tslib_1.__extends(SortedSetBuilder, _super);
(0, tslib_1.__extends)(SortedSetBuilder, _super);
function SortedSetBuilder(context, source, _entries, _children, size) {

@@ -13,0 +13,0 @@ if (size === void 0) { size = (_a = source === null || source === void 0 ? void 0 : source.size) !== null && _a !== void 0 ? _a : 0; }

@@ -8,3 +8,3 @@ "use strict";

var SortedSetContext = /** @class */ (function (_super) {
tslib_1.__extends(SortedSetContext, _super);
(0, tslib_1.__extends)(SortedSetContext, _super);
function SortedSetContext(blockSizeBits, comp) {

@@ -11,0 +11,0 @@ var _this = _super.call(this) || this;

@@ -11,3 +11,3 @@ "use strict";

var SortedSetEmpty = /** @class */ (function (_super) {
tslib_1.__extends(SortedSetEmpty, _super);
(0, tslib_1.__extends)(SortedSetEmpty, _super);
function SortedSetEmpty(context) {

@@ -74,3 +74,3 @@ var _this = _super.call(this) || this;

var SortedSetNode = /** @class */ (function (_super) {
tslib_1.__extends(SortedSetNode, _super);
(0, tslib_1.__extends)(SortedSetNode, _super);
function SortedSetNode() {

@@ -87,3 +87,3 @@ return _super !== null && _super.apply(this, arguments) || this;

if (undefined !== start) {
var _b = tslib_1.__read(start, 2), startValue = _b[0], startInclude = _b[1];
var _b = (0, tslib_1.__read)(start, 2), startValue = _b[0], startInclude = _b[1];
startIndex = this.getInsertIndexOf(startValue);

@@ -96,3 +96,3 @@ if (startIndex < 0)

if (undefined !== end) {
var _c = tslib_1.__read(end, 2), endValue = _c[0], endInclude = _c[1];
var _c = (0, tslib_1.__read)(end, 2), endValue = _c[0], endInclude = _c[1];
endIndex = this.getInsertIndexOf(endValue);

@@ -167,3 +167,3 @@ if (endIndex < 0)

return this;
var _a = tslib_1.__read(indexRange, 2), start = _a[0], end = _a[1];
var _a = (0, tslib_1.__read)(indexRange, 2), start = _a[0], end = _a[1];
return this.drop(start).take(end - start + 1);

@@ -258,3 +258,3 @@ };

var SortedSetLeaf = /** @class */ (function (_super) {
tslib_1.__extends(SortedSetLeaf, _super);
(0, tslib_1.__extends)(SortedSetLeaf, _super);
function SortedSetLeaf(context, entries) {

@@ -299,3 +299,3 @@ var _this = _super.call(this) || this;

if (index >= this.size || -index > this.size) {
return common_1.OptLazy(otherwise);
return (0, common_1.OptLazy)(otherwise);
}

@@ -308,3 +308,3 @@ if (index < 0) {

SortedSetLeaf.prototype.forEach = function (f, state) {
if (state === void 0) { state = common_1.TraverseState(); }
if (state === void 0) { state = (0, common_1.TraverseState)(); }
if (state.halted)

@@ -348,27 +348,27 @@ return;

SortedSetLeaf.prototype.deleteMin = function () {
return sorted_custom_1.leafDeleteMin(this);
return (0, sorted_custom_1.leafDeleteMin)(this);
};
SortedSetLeaf.prototype.deleteMax = function () {
return sorted_custom_1.leafDeleteMax(this);
return (0, sorted_custom_1.leafDeleteMax)(this);
};
SortedSetLeaf.prototype.mutateSplitRight = function (index) {
return sorted_custom_1.leafMutateSplitRight(this, index);
return (0, sorted_custom_1.leafMutateSplitRight)(this, index);
};
SortedSetLeaf.prototype.mutateGiveToLeft = function (left, toLeft) {
return sorted_custom_1.leafMutateGiveToLeft(this, left, toLeft);
return (0, sorted_custom_1.leafMutateGiveToLeft)(this, left, toLeft);
};
SortedSetLeaf.prototype.mutateGiveToRight = function (right, toRight) {
return sorted_custom_1.leafMutateGiveToRight(this, right, toRight);
return (0, sorted_custom_1.leafMutateGiveToRight)(this, right, toRight);
};
SortedSetLeaf.prototype.mutateGetFromLeft = function (left, toMe) {
return sorted_custom_1.leafMutateGetFromLeft(this, left, toMe);
return (0, sorted_custom_1.leafMutateGetFromLeft)(this, left, toMe);
};
SortedSetLeaf.prototype.mutateGetFromRight = function (right, toMe) {
return sorted_custom_1.leafMutateGetFromRight(this, right, toMe);
return (0, sorted_custom_1.leafMutateGetFromRight)(this, right, toMe);
};
SortedSetLeaf.prototype.mutateJoinLeft = function (left, entry) {
return sorted_custom_1.leafMutateJoinLeft(this, left, entry);
return (0, sorted_custom_1.leafMutateJoinLeft)(this, left, entry);
};
SortedSetLeaf.prototype.mutateJoinRight = function (right, entry) {
return sorted_custom_1.leafMutateJoinRight(this, right, entry);
return (0, sorted_custom_1.leafMutateJoinRight)(this, right, entry);
};

@@ -381,3 +381,3 @@ SortedSetLeaf.prototype.normalize = function () {

var size = this.size;
var _a = tslib_1.__read(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
var _a = (0, tslib_1.__read)(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
return this.context.inner([upEntry], [this, rightNode], size);

@@ -389,3 +389,3 @@ };

var SortedSetInner = /** @class */ (function (_super) {
tslib_1.__extends(SortedSetInner, _super);
(0, tslib_1.__extends)(SortedSetInner, _super);
function SortedSetInner(context, entries, children, size) {

@@ -422,3 +422,3 @@ var _this = _super.call(this) || this;

.flatMap(function (_a) {
var _b = tslib_1.__read(_a, 2), child = _b[0], e = _b[1];
var _b = (0, tslib_1.__read)(_a, 2), child = _b[0], e = _b[1];
if (token === child)

@@ -433,3 +433,3 @@ base_1.RimbuError.throwInvalidStateError();

if (reversed === void 0) { reversed = false; }
return sorted_custom_1.innerStreamSliceIndex(this, range, reversed);
return (0, sorted_custom_1.innerStreamSliceIndex)(this, range, reversed);
};

@@ -453,6 +453,6 @@ SortedSetInner.prototype.min = function () {

SortedSetInner.prototype.getAtIndex = function (index, otherwise) {
return sorted_custom_1.innerGetAtIndex(this, index, otherwise);
return (0, sorted_custom_1.innerGetAtIndex)(this, index, otherwise);
};
SortedSetInner.prototype.forEach = function (f, state) {
if (state === void 0) { state = common_1.TraverseState(); }
if (state === void 0) { state = (0, common_1.TraverseState)(); }
var i = -1;

@@ -506,33 +506,33 @@ var halt = state.halt;

SortedSetInner.prototype.deleteMin = function () {
return sorted_custom_1.innerDeleteMin(this);
return (0, sorted_custom_1.innerDeleteMin)(this);
};
SortedSetInner.prototype.deleteMax = function () {
return sorted_custom_1.innerDeleteMax(this);
return (0, sorted_custom_1.innerDeleteMax)(this);
};
SortedSetInner.prototype.mutateSplitRight = function (index) {
return sorted_custom_1.innerMutateSplitRight(this, index);
return (0, sorted_custom_1.innerMutateSplitRight)(this, index);
};
SortedSetInner.prototype.mutateGiveToLeft = function (left, toLeft) {
return sorted_custom_1.innerMutateGiveToLeft(this, left, toLeft);
return (0, sorted_custom_1.innerMutateGiveToLeft)(this, left, toLeft);
};
SortedSetInner.prototype.mutateGiveToRight = function (right, toRight) {
return sorted_custom_1.innerMutateGiveToRight(this, right, toRight);
return (0, sorted_custom_1.innerMutateGiveToRight)(this, right, toRight);
};
SortedSetInner.prototype.mutateGetFromLeft = function (left, toMe) {
return sorted_custom_1.innerMutateGetFromLeft(this, left, toMe);
return (0, sorted_custom_1.innerMutateGetFromLeft)(this, left, toMe);
};
SortedSetInner.prototype.mutateGetFromRight = function (right, toMe) {
return sorted_custom_1.innerMutateGetFromRight(this, right, toMe);
return (0, sorted_custom_1.innerMutateGetFromRight)(this, right, toMe);
};
SortedSetInner.prototype.mutateJoinLeft = function (left, entry) {
return sorted_custom_1.innerMutateJoinLeft(this, left, entry);
return (0, sorted_custom_1.innerMutateJoinLeft)(this, left, entry);
};
SortedSetInner.prototype.mutateJoinRight = function (right, entry) {
return sorted_custom_1.innerMutateJoinRight(this, right, entry);
return (0, sorted_custom_1.innerMutateJoinRight)(this, right, entry);
};
SortedSetInner.prototype.normalizeDownsizeChild = function (childIndex, newChild, newSize) {
return sorted_custom_1.innerNormalizeDownsizeChild(this, childIndex, newChild, newSize);
return (0, sorted_custom_1.innerNormalizeDownsizeChild)(this, childIndex, newChild, newSize);
};
SortedSetInner.prototype.normalizeIncreaseChild = function (childIndex, newChild, newSize) {
return sorted_custom_1.innerNormalizeIncreaseChild(this, childIndex, newChild, newSize);
return (0, sorted_custom_1.innerNormalizeIncreaseChild)(this, childIndex, newChild, newSize);
};

@@ -568,3 +568,3 @@ SortedSetInner.prototype.addInternal = function (value) {

if (leftChild.entries.length >= rightChild.entries.length) {
var _a = tslib_1.__read(leftChild.deleteMax(), 2), max = _a[0], newLeft = _a[1];
var _a = (0, tslib_1.__read)(leftChild.deleteMax(), 2), max = _a[0], newLeft = _a[1];
var newEntries_2 = base_1.Arr.update(this.entries, entryIndex, max);

@@ -574,3 +574,3 @@ var newSelf_1 = this.copy(newEntries_2);

}
var _b = tslib_1.__read(rightChild.deleteMin(), 2), min = _b[0], newRight = _b[1];
var _b = (0, tslib_1.__read)(rightChild.deleteMin(), 2), min = _b[0], newRight = _b[1];
var newEntries = base_1.Arr.update(this.entries, entryIndex, min);

@@ -594,6 +594,6 @@ var newSelf = this.copy(newEntries);

SortedSetInner.prototype.takeInternal = function (amount) {
return sorted_custom_1.innerTakeInternal(this, amount);
return (0, sorted_custom_1.innerTakeInternal)(this, amount);
};
SortedSetInner.prototype.dropInternal = function (amount) {
return sorted_custom_1.innerDropInternal(this, amount);
return (0, sorted_custom_1.innerDropInternal)(this, amount);
};

@@ -606,3 +606,3 @@ SortedSetInner.prototype.normalize = function () {

var size = this.size;
var _a = tslib_1.__read(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
var _a = (0, tslib_1.__read)(this.mutateSplitRight(), 2), upEntry = _a[0], rightNode = _a[1];
return this.copy([upEntry], [this, rightNode], size);

@@ -609,0 +609,0 @@ };

@@ -29,3 +29,3 @@ "use strict";

};
exports.SortedSet = tslib_1.__assign(tslib_1.__assign({}, _defaultContext), _contextHelpers);
exports.SortedSet = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, _defaultContext), _contextHelpers);
//# sourceMappingURL=interface.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./base"), exports);
(0, tslib_1.__exportStar)(require("./base"), exports);
//# sourceMappingURL=sorted-custom.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./map/builder"), exports);
tslib_1.__exportStar(require("./map/context"), exports);
tslib_1.__exportStar(require("./map/immutable"), exports);
(0, tslib_1.__exportStar)(require("./map/builder"), exports);
(0, tslib_1.__exportStar)(require("./map/context"), exports);
(0, tslib_1.__exportStar)(require("./map/immutable"), exports);
//# sourceMappingURL=sortedmap-custom.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./set/builder"), exports);
tslib_1.__exportStar(require("./set/context"), exports);
tslib_1.__exportStar(require("./set/immutable"), exports);
(0, tslib_1.__exportStar)(require("./set/builder"), exports);
(0, tslib_1.__exportStar)(require("./set/context"), exports);
(0, tslib_1.__exportStar)(require("./set/immutable"), exports);
//# sourceMappingURL=sortedset-custom.js.map
{
"name": "@rimbu/sorted",
"version": "0.7.0",
"version": "0.7.1",
"description": "Immutable SortedMap and SortedSet implementations for TypeScript",

@@ -62,7 +62,7 @@ "keywords": [

"dependencies": {
"@rimbu/base": "^0.6.5",
"@rimbu/collection-types": "^0.7.3",
"@rimbu/common": "^0.7.3",
"@rimbu/stream": "^0.7.3",
"tslib": "^2.3.0"
"@rimbu/base": "^0.6.6",
"@rimbu/collection-types": "^0.7.4",
"@rimbu/common": "^0.7.4",
"@rimbu/stream": "^0.7.4",
"tslib": "^2.3.1"
},

@@ -75,3 +75,3 @@ "publishConfig": {

},
"gitHead": "435cbcb64b0c17a52c2af41d0c599c1a895da424"
"gitHead": "e509f9938fad6253702f6b78eb9f8e3b3a8f92ac"
}

@@ -22,6 +22,8 @@ <p align="center">

All types are exported through [`@rimbu/core`](../core). It is recommended to use this package.
All types are exported through [`@rimbu/core`](../core). It is recommended to use that package.
To install separately:
### Yarn/NPM
> `yarn add @rimbu/sorted`

@@ -33,4 +35,30 @@

### recommended tsconfig settings
### Deno
Create a file called `rimbu.ts` and add the following:
> ```ts
> export * from 'https://deno.land/x/rimbu/sorted/mod.ts';
> ```
Or using a pinned version (`x.y.z`):
> ```ts
> export * from 'https://deno.land/x/rimbu/sorted@x.y.z/mod.ts';
> ```
Then import what you need from `rimbu.ts`:
```ts
import { SortedMap } from './rimbu.ts';
```
Because Rimbu uses complex types, it's recommended to use the `--no-check` flag (your editor should already have checked your code) and to specify a `tsconfig.json` file with the settings described below.
Running your script then becomes:
> `deno run --no-check --config tsconfig.json <your-script>.ts`
## Recommended `tsconfig.json` settings
Rimbu uses advanced and recursive typing, potentially making the TypeScript compiler quite slow in some cases, or causing infinite recursion. It is recommended to set the following values in the `tsconfig.json` file of your project:

@@ -37,0 +65,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc