Add without

This commit is contained in:
Jon Staab
2024-05-20 09:36:16 -07:00
parent 69b8bb3b54
commit 1160cedc0b
3 changed files with 4 additions and 2 deletions
+2
View File
@@ -91,6 +91,8 @@ export const difference = <T>(a: T[], b: T[]) => {
export const remove = <T>(a: T, b: T[]) => b.filter(x => x !== a)
export const without = <T>(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 <T>(f: () => Promise<T | void> | T | void, onError?: (e: Error) => void): Promise<T | void> => {
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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([