partial.lenses
Advanced tools
Changelog
3.4.1
Fixed bugs when removing a non-existing property from an object or a
non-existent index from an array. Previously L.remove("x", {})
returned {}
.
Now it returns undefined
as it was previously documented. Similarly
L.remove(index, [])
now returns undefined
as was documented.
Tightened the semantics of combinators, including L.index
, L.filter
,
L.prop
and L.augment
(and other combinators whose semantics are defined in
terms of those), that specifically work on objects or arrays. Previously such
combinators worked asymmetrically when operating on values not in their domain.
Now they consistently treat values that are not in their domain as undefined
.
For example, L.get("x", null)
now returns undefined
(previously null
) and,
consistently, L.set("x", 1, null)
now returns {x: 1}
(previously error).
Changelog
3.4.0
Added minimalistic experimental traversal support in the form of the
sequence
traversal.
Changelog
13.1.0
Obsoleted L.iftes
and added L.ifElse
and L.cond
as the replacements for
it. The motivation for the change is that formatting tools such as
Prettier cannot produce readable layouts for combinators
that use such non-trivial argument patterns. In cases where there is just a
single predicate, use L.ifElse
:
-L.iftes(predicate, consequent, alternative)
+L.ifElse(predicate, consequent, alternative)
In cases where there are multiple predicates, use L.cond
:
-L.iftes(predicate1, consequent1,
- predicate2, consequent2,
- alternative)
+L.cond([predicate1, consequent1],
+ [predicate2, consequent2],
+ [alternative])
Changelog
3.0.0
Dropped implicit Ramda compatibility. To interop with Ramda, one must now
explicitly convert lenses using L.toRamda
and L.fromRamda
. In particular,
L.compose
no longer necessarily returns a Ramda compatible lens and, in the
future, the implementation may be changed more drastically. This change was
made, because now a lens returned by L.compose
can take less memory and it
will also be possible to further optimize the implementation in the future.
Removed deprecated functions L.view
, L.over
and L.firstOf
.
Changelog
2.2.0
Renamed L.view
and L.over
:
-L.view
+L.get
-L.over
+L.modify
Calling deprecated functions now results in console.warn
messages.