本文整理匯總了TypeScript中@jonggrang/container.intmap類的典型用法代碼示例。如果您正苦於以下問題:TypeScript intmap類的具體用法?TypeScript intmap怎麽用?TypeScript intmap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了intmap類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
export function merge<A>(m1: MMap<A>, m2: MMap<A>): MMap<A> {
return I.unionWithKey((_, a, b) => L.append(a, b), m1, m2);
}
示例2: isNothing
export function searchWith<A>(k: number, f: (_: A) => boolean, m: MMap<A>): Maybe<A> {
const ret = I.lookup(k, m);
return isNothing(ret) ? ret : L.find(f, ret.value);
}
示例3: chainMaybe
export function search<A>(k: number, m: MMap<A>): Maybe<A> {
return chainMaybe(I.lookup(k, m), L.head);
}
示例4: isNothing
export function lookup<A>(h: number, k: string, hm: HashMap<A>): Maybe<A> {
const ret = I.lookup(h, hm);
return isNothing(ret) ? ret : M.lookup(k, ret.value);
}
示例5:
export function insert<A>(h: number, k: string, v: A, m: HashMap<A>): HashMap<A> {
return I.insertWith(M.union as any, h, M.singleton(k, v), m);
}