collection-utils
Advanced tools
Comparing version 0.0.5 to 0.0.6
export declare const hashCodeInit = 17; | ||
export declare function addHashCode(acc: number, h: number): number; | ||
export declare function definedMap<T, U>(x: T | undefined, f: (x: T) => U): U | undefined; | ||
export declare function hasOwnProperty(obj: object, name: string): boolean; | ||
export declare function mapOptional<T, U>(x: T | undefined, f: (x: T) => U): U | undefined; | ||
export declare function iterableFind<T>(it: Iterable<T>, p: (v: T) => boolean): T | undefined; | ||
@@ -39,2 +38,5 @@ export declare function iterableEvery<T>(it: Iterable<T>, p: (v: T) => boolean): boolean; | ||
}): Map<string, V>; | ||
export declare function mapToObject<V>(m: Map<string, V>): { | ||
[k: string]: V; | ||
}; | ||
export declare function mapFromIterable<K, V>(it: Iterable<K>, valueForKey: (k: K) => V): Map<K, V>; | ||
@@ -41,0 +43,0 @@ export declare function mapFind<K, V>(it: Iterable<[K, V]>, p: (v: V, k: K) => boolean): V | undefined; |
@@ -17,3 +17,3 @@ "use strict"; | ||
exports.addHashCode = addHashCode; | ||
function definedMap(x, f) { | ||
function mapOptional(x, f) { | ||
if (x === undefined) | ||
@@ -23,7 +23,3 @@ return undefined; | ||
} | ||
exports.definedMap = definedMap; | ||
function hasOwnProperty(obj, name) { | ||
return Object.prototype.hasOwnProperty.call(obj, name); | ||
} | ||
exports.hasOwnProperty = hasOwnProperty; | ||
exports.mapOptional = mapOptional; | ||
function iterableFind(it, p) { | ||
@@ -291,2 +287,10 @@ for (const v of it) { | ||
exports.mapFromObject = mapFromObject; | ||
function mapToObject(m) { | ||
const result = {}; | ||
for (const [k, v] of m) { | ||
result[k] = v; | ||
} | ||
return result; | ||
} | ||
exports.mapToObject = mapToObject; | ||
function mapFromIterable(it, valueForKey) { | ||
@@ -293,0 +297,0 @@ const result = new Map(); |
{ | ||
"name": "collection-utils", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
33259
608