UNPKG

veffect

Version:

powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha

287 lines (285 loc) 7.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.values = exports.unsafeGet = exports.union = exports.toEntries = exports.size = exports.set = exports.removeMany = exports.remove = exports.reduce = exports.mutate = exports.modifyHash = exports.modifyAt = exports.modify = exports.map = exports.make = exports.keys = exports.keySet = exports.isHashMap = exports.isEmpty = exports.hasHash = exports.has = exports.getHash = exports.get = exports.fromIterable = exports.forEach = exports.flatMap = exports.findFirst = exports.filterMap = exports.filter = exports.entries = exports.endMutation = exports.empty = exports.compact = exports.beginMutation = void 0; var HM = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/hashMap.js")); var _keySet = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/hashMap/keySet.js")); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } /** * @since 2.0.0 */ const TypeId = HM.HashMapTypeId; /** * @since 2.0.0 * @category refinements */ const isHashMap = exports.isHashMap = HM.isHashMap; /** * Creates a new `HashMap`. * * @since 2.0.0 * @category constructors */ const empty = exports.empty = HM.empty; /** * Constructs a new `HashMap` from an array of key/value pairs. * * @since 2.0.0 * @category constructors */ const make = exports.make = HM.make; /** * Creates a new `HashMap` from an iterable collection of key/value pairs. * * @since 2.0.0 * @category constructors */ const fromIterable = exports.fromIterable = HM.fromIterable; /** * Checks if the `HashMap` contains any entries. * * @since 2.0.0 * @category elements */ const isEmpty = exports.isEmpty = HM.isEmpty; /** * Safely lookup the value for the specified key in the `HashMap` using the * internal hashing function. * * @since 2.0.0 * @category elements */ const get = exports.get = HM.get; /** * Lookup the value for the specified key in the `HashMap` using a custom hash. * * @since 2.0.0 * @category elements */ const getHash = exports.getHash = HM.getHash; /** * Unsafely lookup the value for the specified key in the `HashMap` using the * internal hashing function. * * @since 2.0.0 * @category unsafe */ const unsafeGet = exports.unsafeGet = HM.unsafeGet; /** * Checks if the specified key has an entry in the `HashMap`. * * @since 2.0.0 * @category elements */ const has = exports.has = HM.has; /** * Checks if the specified key has an entry in the `HashMap` using a custom * hash. * * @since 2.0.0 * @category elements */ const hasHash = exports.hasHash = HM.hasHash; /** * Sets the specified key to the specified value using the internal hashing * function. * * @since 2.0.0 */ const set = exports.set = HM.set; /** * Returns an `IterableIterator` of the keys within the `HashMap`. * * @since 2.0.0 * @category getters */ const keys = exports.keys = HM.keys; /** * Returns a `HashSet` of keys within the `HashMap`. * * @since 2.0.0 * @category getter */ const keySet = exports.keySet = _keySet.keySet; /** * Returns an `IterableIterator` of the values within the `HashMap`. * * @since 2.0.0 * @category getters */ const values = exports.values = HM.values; /** * Returns an `IterableIterator` of the entries within the `HashMap`. * * @since 2.0.0 * @category getters */ const entries = exports.entries = HM.entries; /** * Returns an `Array<[K, V]>` of the entries within the `HashMap`. * * @since 2.0.0 * @category getters */ const toEntries = self => Array.from(entries(self)); /** * Returns the number of entries within the `HashMap`. * * @since 2.0.0 * @category getters */ exports.toEntries = toEntries; const size = exports.size = HM.size; /** * Marks the `HashMap` as mutable. * * @since 2.0.0 */ const beginMutation = exports.beginMutation = HM.beginMutation; /** * Marks the `HashMap` as immutable. * * @since 2.0.0 */ const endMutation = exports.endMutation = HM.endMutation; /** * Mutates the `HashMap` within the context of the provided function. * * @since 2.0.0 */ const mutate = exports.mutate = HM.mutate; /** * Set or remove the specified key in the `HashMap` using the specified * update function. The value of the specified key will be computed using the * provided hash. * * The update function will be invoked with the current value of the key if it * exists, or `None` if no such value exists. * * @since 2.0.0 */ const modifyAt = exports.modifyAt = HM.modifyAt; /** * Alter the value of the specified key in the `HashMap` using the specified * update function. The value of the specified key will be computed using the * provided hash. * * The update function will be invoked with the current value of the key if it * exists, or `None` if no such value exists. * * This function will always either update or insert a value into the `HashMap`. * * @since 2.0.0 */ const modifyHash = exports.modifyHash = HM.modifyHash; /** * Updates the value of the specified key within the `HashMap` if it exists. * * @since 2.0.0 */ const modify = exports.modify = HM.modify; /** * Performs a union of this `HashMap` and that `HashMap`. * * @since 2.0.0 */ const union = exports.union = HM.union; /** * Remove the entry for the specified key in the `HashMap` using the internal * hashing function. * * @since 2.0.0 */ const remove = exports.remove = HM.remove; /** * Removes all entries in the `HashMap` which have the specified keys. * * @since 2.0.0 */ const removeMany = exports.removeMany = HM.removeMany; /** * Maps over the entries of the `HashMap` using the specified function. * * @since 2.0.0 * @category mapping */ const map = exports.map = HM.map; /** * Chains over the entries of the `HashMap` using the specified function. * * **NOTE**: the hash and equal of both maps have to be the same. * * @since 2.0.0 * @category sequencing */ const flatMap = exports.flatMap = HM.flatMap; /** * Applies the specified function to the entries of the `HashMap`. * * @since 2.0.0 * @category traversing */ const forEach = exports.forEach = HM.forEach; /** * Reduces the specified state over the entries of the `HashMap`. * * @since 2.0.0 * @category folding */ const reduce = exports.reduce = HM.reduce; /** * Filters entries out of a `HashMap` using the specified predicate. * * @since 2.0.0 * @category filtering */ const filter = exports.filter = HM.filter; /** * Filters out `None` values from a `HashMap` of `Options`s. * * @since 2.0.0 * @category filtering */ const compact = exports.compact = HM.compact; /** * Maps over the entries of the `HashMap` using the specified partial function * and filters out `None` values. * * @since 2.0.0 * @category filtering */ const filterMap = exports.filterMap = HM.filterMap; /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. * * @category elements * @since 2.0.0 */ const findFirst = exports.findFirst = HM.findFirst; //# sourceMappingURL=HashMap.js.map