Add flatMap to Fluent
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paravel",
|
"name": "paravel",
|
||||||
"version": "0.4.9",
|
"version": "0.4.10",
|
||||||
"description": "Yet another toolkit for nostr",
|
"description": "Yet another toolkit for nostr",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ export class Fluent<T> {
|
|||||||
|
|
||||||
map = <U>(f: (t: T) => U) => new Fluent(this.xs.map(f))
|
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]))
|
pluck = (k: number | string) => new Fluent(this.xs.map(x => x[k]))
|
||||||
|
|
||||||
filter = (f: (t: T) => boolean) => new Fluent(this.xs.filter(f))
|
filter = (f: (t: T) => boolean) => new Fluent(this.xs.filter(f))
|
||||||
|
|||||||
Reference in New Issue
Block a user