Skip to content

Commit

Permalink
#57 - src/list/ - updated pseudo curried methods, upto 'map' method, …
Browse files Browse the repository at this point in the history
…to idiomatic curry syntax.
  • Loading branch information
elycruz committed Aug 2, 2022
1 parent 56fd4f1 commit c04d742
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/fjl/src/list/iterate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {curry, CurryOf3} from "../function";
import {Unary} from "../types";


Expand Down
8 changes: 3 additions & 5 deletions packages/fjl/src/list/map.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import {curry, CurryOf2} from '../function/curry';
import {typeOf} from '../object/typeOf';
import {of} from '../object/of';
import {isFunctor} from '../object/is';
import {isset} from '../object/isset';
import {Indexable, MapOp, Functor} from "../types";

export type MapType<T1, T2, Functor1, RetFunctor> =
CurryOf2<MapOp<T1, number | string, Functor1, T2>, Functor1, RetFunctor>

/**
* Maps a function onto a ListLike (string or array) or a functor (value containing a map method).
*/
Expand Down Expand Up @@ -50,4 +46,6 @@ export const
}
},

$map = curry(map) as MapType<any, any, any, any>;
$map = <T, RetT>(fn: MapOp<T, number | string, Functor<T> | Indexable<T>, RetT>) =>
(xs: Functor<T> | Indexable<T>): Functor<RetT> | Indexable<RetT> | any => map(fn, xs)
;

0 comments on commit c04d742

Please sign in to comment.