@yookue/ts-multi-map
Version:
Multiple key/value map & range map for typescript
136 lines • 3.76 kB
JavaScript
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
var _Symbol$iterator, _Symbol$toStringTag;
import { MultiValueMap } from "./..";
_Symbol$iterator = Symbol.iterator;
_Symbol$toStringTag = Symbol.toStringTag;
export var ReadonlyMultiValueMap = /*#__PURE__*/function () {
function ReadonlyMultiValueMap(entries) {
var _this = this;
_classCallCheck(this, ReadonlyMultiValueMap);
_defineProperty(this, "map", new MultiValueMap());
entries === null || entries === void 0 || entries.forEach(function (entry) {
var _entry = _slicedToArray(entry, 2),
k = _entry[0],
vs = _entry[1];
_this.map.set(k, vs);
});
}
_createClass(ReadonlyMultiValueMap, [{
key: "get",
value: function get(key, defaults) {
return this.map.get(key, defaults);
}
}, {
key: "keys",
value: function keys() {
return this.map.keys();
}
}, {
key: "values",
value: function values() {
return this.map.values();
}
}, {
key: "entries",
value: function entries() {
return this.map.entries();
}
}, {
key: "forEach",
value: function forEach(callback, thisArg) {
this.map.forEach(callback, thisArg);
}
}, {
key: "forEachIndexing",
value: function forEachIndexing(callback, thisArg) {
this.map.forEachIndexing(callback, thisArg);
}
}, {
key: "forEachBreakable",
value: function forEachBreakable(callback, thisArg) {
this.map.forEachBreakable(callback, thisArg);
}
}, {
key: "hasKey",
value: function hasKey(key) {
return this.map.hasKey(key);
}
}, {
key: "hasKeyValue",
value: function hasKeyValue(key, value) {
return this.map.hasKeyValue(key, value);
}
}, {
key: "hasAnyKeys",
value: function hasAnyKeys(keys) {
return this.map.hasAnyKeys(keys);
}
}, {
key: "hasAllKeys",
value: function hasAllKeys(keys) {
return this.map.hasAllKeys(keys);
}
}, {
key: "hasValue",
value: function hasValue(values) {
var exact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return this.map.hasValue(values, exact);
}
}, {
key: "hasAnyValues",
value: function hasAnyValues(values) {
var exact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return this.map.hasAnyValues(values, exact);
}
}, {
key: "hasAllValues",
value: function hasAllValues(values) {
var exact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return this.map.hasAllValues(values, exact);
}
}, {
key: "isEmpty",
value: function isEmpty() {
return this.map.isEmpty();
}
}, {
key: "isNotEmpty",
value: function isNotEmpty() {
return this.map.isNotEmpty();
}
}, {
key: "getKey",
value: function getKey(values, defaults) {
return this.map.getKey(values, defaults);
}
}, {
key: _Symbol$iterator,
value: function value() {
return this.map[Symbol.iterator]();
}
}, {
key: "size",
get: function get() {
return this.map.size;
}
}, {
key: _Symbol$toStringTag,
get: function get() {
return 'ReadonlyMultiValueMap';
}
}, {
key: "toString",
value: function toString() {
return this.map.toString();
}
}], [{
key: "of",
value: function of(entries) {
return new ReadonlyMultiValueMap(entries);
}
}]);
return ReadonlyMultiValueMap;
}();