UNPKG
@proem/some
Version:
latest (0.0.23)
0.0.23
0.0.22
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.12
0.0.6
Proem package for handling possibly null values
github.com/wunderdogsw/proem
wunderdogsw/proem
@proem/some
/
src
/
index.ts
10 lines
(7 loc)
•
268 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
/* Package for handling possibly null values. */
export
const
map = <A, B>(
value
: A |
null
,
mapper
:
(
value: A
) =>
B): B |
null
=>
value ===
null
?
null
:
mapper
(value) map.
partial
= <A, B>
(
mapper: (value: A) => B
) =>
(
value
: A): B |
null
=>
map
(value, mapper)