From 8d6839f9e4bc33dc4626048869afc488cd13a78c Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 30 Nov 2023 16:15:01 -0800 Subject: [PATCH] Add flatMap to Fluent --- package.json | 2 +- src/util/nostr.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 78ec709..1c6f35e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paravel", - "version": "0.4.9", + "version": "0.4.10", "description": "Yet another toolkit for nostr", "author": "hodlbod", "license": "MIT", diff --git a/src/util/nostr.ts b/src/util/nostr.ts index 7ee419b..d2c4f8c 100644 --- a/src/util/nostr.ts +++ b/src/util/nostr.ts @@ -120,6 +120,8 @@ export class Fluent { map = (f: (t: T) => U) => new Fluent(this.xs.map(f)) + flatMap = (f: (t: T) => U) => new Fluent(this.xs.flatMap(f)) + pluck = (k: number | string) => new Fluent(this.xs.map(x => x[k])) filter = (f: (t: T) => boolean) => new Fluent(this.xs.filter(f))