Skip to content

Commit 450026d

Browse files
committed
Use maybe in main compose
1 parent 04b45dc commit 450026d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ class Mapper {
9898
this.config.mapDelimiter
9999
)
100100

101+
const set = assign(targetField, this.config.objDelimiter)
102+
101103
const fn = compose(
102-
v =>
103-
v === undefined
104-
? accum
105-
: assign(targetField, this.config.objDelimiter)(accum, v),
104+
maybe(accum)(set.bind(this, accum)),
105+
Maybe.of,
106106
/* End user-land transforms */
107107
...this.config.postFilters,
108108
getMappingFilter(mapping.type, this.config.types),

src/maybe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Maybe {
22
get nil() {
3-
return this.$value == null
3+
return this.$value === undefined
44
}
55
constructor(x) {
66
this.$value = x

0 commit comments

Comments
 (0)