@rimbu/proximity
Version:
Immutable ProximityMap implementation for TypeScript
76 lines • 2.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProximityMapEmpty = void 0;
var tslib_1 = require("tslib");
var base_1 = require("@rimbu/base");
var map_custom_1 = require("@rimbu/collection-types/map-custom");
var common_1 = require("@rimbu/common");
var stream_1 = require("@rimbu/stream");
var ProximityMapEmpty = /** @class */ (function (_super) {
tslib_1.__extends(ProximityMapEmpty, _super);
function ProximityMapEmpty(context) {
var _this = _super.call(this) || this;
_this.context = context;
return _this;
}
ProximityMapEmpty.prototype.streamKeys = function () {
return stream_1.Stream.empty();
};
ProximityMapEmpty.prototype.streamValues = function () {
return stream_1.Stream.empty();
};
ProximityMapEmpty.prototype.get = function (_key, otherwise) {
return (0, common_1.OptLazy)(otherwise);
};
ProximityMapEmpty.prototype.hasKey = function () {
return false;
};
ProximityMapEmpty.prototype.set = function (key, value) {
return this.context.from([[key, value]]);
};
ProximityMapEmpty.prototype.addEntry = function (entry) {
return this.context.from([entry]);
};
ProximityMapEmpty.prototype.addEntries = function (entries) {
return this.context.from(entries);
};
ProximityMapEmpty.prototype.removeKeyAndGet = function () {
return undefined;
};
ProximityMapEmpty.prototype.removeKey = function () {
return this;
};
ProximityMapEmpty.prototype.removeKeys = function () {
return this;
};
ProximityMapEmpty.prototype.modifyAt = function (atKey, options) {
if (!options.ifNew) {
return this;
}
var value = (0, common_1.OptLazyOr)(options.ifNew, base_1.Token);
if (value === base_1.Token)
return this;
return this.set(atKey, value);
};
ProximityMapEmpty.prototype.mapValues = function () {
return this;
};
ProximityMapEmpty.prototype.updateAt = function () {
return this;
};
ProximityMapEmpty.prototype.toBuilder = function () {
return this.context.builder();
};
ProximityMapEmpty.prototype.toString = function () {
return "".concat(this.context.typeTag, "()");
};
ProximityMapEmpty.prototype.toJSON = function () {
return {
dataType: this.context.typeTag,
value: [],
};
};
return ProximityMapEmpty;
}(map_custom_1.EmptyBase));
exports.ProximityMapEmpty = ProximityMapEmpty;
//# sourceMappingURL=Empty.cjs.map