Add flatMap to Fluent

This commit is contained in:
Jon Staab
2023-11-30 16:15:01 -08:00
parent 2e925b9821
commit 8d6839f9e4
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paravel",
"version": "0.4.9",
"version": "0.4.10",
"description": "Yet another toolkit for nostr",
"author": "hodlbod",
"license": "MIT",
+2
View File
@@ -120,6 +120,8 @@ export class Fluent<T> {
map = <U>(f: (t: T) => U) => new Fluent(this.xs.map(f))
flatMap = <U>(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))