diff --git a/packages/lib/Tools.ts b/packages/lib/Tools.ts index 95afd8e..7ec01b7 100644 --- a/packages/lib/Tools.ts +++ b/packages/lib/Tools.ts @@ -91,6 +91,8 @@ export const difference = (a: T[], b: T[]) => { export const remove = (a: T, b: T[]) => b.filter(x => x !== a) +export const without = (a: T[], b: T[]) => b.filter(x => !a.includes(x)) + export const clamp = ([min, max]: [number, number], n: number) => Math.min(max, Math.max(min, n)) export const tryCatch = async (f: () => Promise | T | void, onError?: (e: Error) => void): Promise => { diff --git a/packages/util/Filters.ts b/packages/util/Filters.ts index a709957..d43f770 100644 --- a/packages/util/Filters.ts +++ b/packages/util/Filters.ts @@ -2,7 +2,7 @@ import {Event} from 'nostr-tools' import {matchFilter as nostrToolsMatchFilter} from 'nostr-tools' import {prop, avg, hash, groupBy, randomId, uniq} from '@welshman/lib' import type {HashedEvent, TrustedEvent} from './Events' -import {isReplaceableKind, isPlainReplaceableKind} from './Kinds' +import {isReplaceableKind} from './Kinds' import {Address, getAddress} from './Address' export const EPOCH = 1609459200 diff --git a/packages/util/Router.ts b/packages/util/Router.ts index 3aaac3a..1a5bef4 100644 --- a/packages/util/Router.ts +++ b/packages/util/Router.ts @@ -193,7 +193,7 @@ export class Router { EventAncestors = (event: TrustedEvent, type: "mentions" | "replies" | "roots") => { const tags = Tags.fromEvent(event) const ancestors = tags.ancestors()[type] - const pubkeys = tags.whereKey("p").values().valueOf() + const pubkeys = tags.values("p").valueOf() const communities = tags.communities().values().valueOf() const groups = tags.groups().values().valueOf() const relays = uniq([