Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

partial.lenses

Package Overview
Dependencies
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

partial.lenses - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

8

lib/partial.lenses.js

@@ -179,3 +179,3 @@ "use strict";

return L(L.find(function (x) {
return L.view(lls, x) !== undefined;
return _ramda2.default.view(lls, x) !== undefined;
}), lls);

@@ -234,3 +234,3 @@ };

L.pick = function (template) {
return L.lens(function (c) {
return _ramda2.default.lens(function (c) {
var r = void 0;

@@ -256,3 +256,5 @@ for (var k in template) {

L.identity = _ramda2.default.lens(_ramda2.default.identity, _ramda2.default.identity);
exports.default = L;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9wYXJ0aWFsLmxlbnNlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQUFBOzs7Ozs7Ozs7Ozs7QUFJQSxJQUFNLFlBQVksU0FBWixTQUFZLENBQUMsQ0FBRCxFQUFJLENBQUosRUFBVTtBQUMxQixNQUFJLE1BQU0sU0FBTixJQUFtQixFQUFFLEtBQUssQ0FBTCxDQUFGLEVBQ3JCLE9BQU8sQ0FBUCxDQURGO0FBRUEsTUFBSSxVQUFKLENBSDBCO0FBSTFCLE9BQUssSUFBTSxDQUFOLElBQVcsQ0FBaEIsRUFBbUI7QUFDakIsUUFBSSxNQUFNLENBQU4sRUFBUztBQUNYLFVBQUksY0FBYyxDQUFkLEVBQ0YsSUFBSSxFQUFKLENBREY7QUFFQSxRQUFFLENBQUYsSUFBTyxFQUFFLENBQUYsQ0FBUCxDQUhXO0tBQWI7R0FERjtBQU9BLFNBQU8sQ0FBUCxDQVgwQjtDQUFWOztBQWNsQixJQUFNLFNBQVMsU0FBVCxNQUFTLENBQUMsQ0FBR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dGVtcGxhdGUpKVxuICAgICAgICBzZXQoaywgeVtrXSlcbiAgICAgIGVsc2VcbiAgICAgICAgaWYgKGsgaW4gYylcbiAgICAgICAgICBzZXQoaywgY1trXSlcbiAgICB9XG4gICAgcmV0dXJuIHpcbiAgfSkpXG5cbkwucGljayA9IHRlbXBsYXRlID0+IFIubGVucyhcbiAgYyA9PiB7XG4gICAgbGV0IHJcbiAgICBmb3IgKGNvbnN0IGsgaW4gdGVtcGxhdGUpIHtcbiAgICAgIGNvbnN0IHYgPSBMLnZpZXcodGVtcGxhdGVba10sIGMpXG4gICAgICBpZiAodiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChyID09PSB1bmRlZmluZWQpXG4gICAgICAgICAgciA9IHt9XG4gICAgICAgIHJba10gPSB2XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByXG4gIH0sXG4gIChvID0ge30sIGNJbikgPT4ge1xuICAgIGxldCBjID0gY0luXG4gICAgZm9yIChjb25zdCBrIGluIHRlbXBsYXRlKVxuICAgICAgYyA9IEwuc2V0KHRlbXBsYXRlW2tdLCBvW2tdLCBjKVxuICAgIHJldHVybiBjXG4gIH0pXG5cbkwuaWRlbnRpdHkgPSBSLmxlbnMoUi5pZGVudGl0eSwgUi5pZGVudGl0eSlcblxuZXhwb3J0IGRlZmF1bHQgTFxuIl19
{
"name": "partial.lenses",
"version": "1.2.0",
"version": "1.3.0",
"description": "Ramda compatible partial lenses",

@@ -5,0 +5,0 @@ "main": "lib/partial.lenses.js",

@@ -210,2 +210,84 @@ [ [Tutorial](#tutorial) | [Reference](#reference) | [Background](#background) ]

### Food for thought: BST as a lens
The previous example is based on an actual use case. In this section we look at
a more involved example: BST, binary search tree, as a lens.
Binary search may initially seem to be outside the scope of definable lenses.
However, the `L.choose` lens allows for dynamic construction of lenses based on
examining the data structure being manipulated. Inside `L.choose` we can write
the ordinary BST logic to pick the correct branch based on the key in the
currently examined node and the key that we are looking for. So, here is our
first attempt at a BST lens:
```js
const binarySearch = key =>
L(L.default({key}),
L.choose(node =>
key < node.key ? L("smaller", binarySearch(key)) :
node.key < key ? L("greater", binarySearch(key)) :
L.identity))
const valueOf = key => L(binarySearch(key), "value")
```
This actually works to a degree. We can use the `valueOf` lens constructor to
build a binary tree:
```js
> const t = R.reduce((tree, item) => L.set(valueOf(item.key), item.value, tree),
undefined,
[{key: "c", value: 1},
{key: "a", value: 2},
{key: "b", value: 3}])
> t
{ smaller: { greater: { value: 3, key: 'b' }, value: 2, key: 'a' },
value: 1,
key: 'c' }
```
However, the above `binarySearch` lens constructor does not maintain the BST
structure when values are being deleted:
```js
> L.delete(valueOf('c'), t)
{ smaller: { greater: { value: 3, key: 'b' },
value: 2,
key: 'a' },
key: 'c' }
```
How do we fix this? What we need is to normalize the data structure after
changes. The `L.normalize` lens can be used for that purpose. Here is the
updated `binarySearch` definition:
```js
const binarySearch = key =>
L(L.default({key}),
L.normalize(node => {
if ("value" in node)
return node
if (!("greater" in node) && "smaller" in node)
return node.smaller
if (!("smaller" in node) && "greater" in node)
return node.greater
return node
}),
L.choose(node =>
key < node.key ? L("smaller", binarySearch(key)) :
node.key < key ? L("greater", binarySearch(key)) :
L.identity))
```
Now we can also delete values from a binary tree:
```js
> L.delete(valueOf('c'), t)
{ greater: { value: 3, key: 'b' }, value: 2, key: 'a' }
```
As an exercise you could improve the normalization to maintain some balance
condition such as AVL.
## Reference

@@ -228,8 +310,16 @@

`L(l, ...ls)` and `L.compose(l, ...ls)` both are the same as `R.compose(lift(l),
...ls.map(lift))` (see [compose](http://ramdajs.com/0.19.0/docs/#compose)).
...ls.map(lift))` (see [compose](http://ramdajs.com/0.19.0/docs/#compose)) and
compose a lens from a path of lenses.
For example:
```js
> L.view(L("a", 1), {a: ["b", "c"]})
"c"
```
#### [`L.lens(get, set)`](#llensget-set "L.lens :: (Maybe s -> Maybe a) -> (Maybe a -> Maybe s -> Maybe s) -> PLens s a")
`L.lens(get, set)` is the same as `R.lens(get, set)` (see
[lens](http://ramdajs.com/0.19.0/docs/#lens)).
[lens](http://ramdajs.com/0.19.0/docs/#lens)) and creates a new primitive lens.

@@ -239,14 +329,38 @@ #### [`L.over(l, x2x, s)`](#loverl-x2x-s "L.over :: PLens s a -> (Maybe a -> Maybe a) -> Maybe s -> Maybe s")

`L.over(l, x2x, s)` is the same as `R.over(lift(l), x2x, s)` (see
[over](http://ramdajs.com/0.19.0/docs/#over)).
[over](http://ramdajs.com/0.19.0/docs/#over)) and allows one to map over the
focused element of a data structure.
For example:
```js
> L.over("elems", R.map(L.delete("x")), {elems: [{x: 1, y: 2}, {x: 3, y: 4}]})
{elems: [{y: 2}, {y: 4}]}
```
#### [`L.set(l, x, s)`](#lsetl-x-s "L.set :: PLens s a -> Maybe a -> Maybe s -> Maybe s")
`L.set(l, x, s)` is the same as `R.set(lift(l), x, s)` (see
[set](http://ramdajs.com/0.19.0/docs/#set)).
[set](http://ramdajs.com/0.19.0/docs/#set)) and is also equivalent to `L.over(l,
() => x, s)`.
For example:
```js
> L.set(L("a", 0, "x"), 11, {id: "z"})
{a: [{x: 11}], id: "z"}
```
#### [`L.view(l, s)`](#lviewl-s "L.view :: PLens s a -> Maybe s -> Maybe a")
`L.view(l, s)` is the same as `R.view(lift(l), s)` (see
[view](http://ramdajs.com/0.19.0/docs/#view)).
[view](http://ramdajs.com/0.19.0/docs/#view)) and returns the focused element
from a data structure.
For example:
```js
> L.view("y", {x: 112, y: 101})
101
```
#### Lifting

@@ -271,6 +385,13 @@

For convenience, there is also a shorthand for delete:
`L.delete(l, s)` is equivalent to `L.set(l, undefined, s)`. With partial
lenses, setting to undefined typically has the effect of removing the focused
element.
* `L.delete(l, s)` is the same as `R.set(lift(l), undefined, s)`.
For example:
```js
> L.delete(L("a", "b"), {a: {b: 1}, x: {y: 2}})
{x: {y: 2}}
```
#### [`L.deleteAll(l, s)`](#ldeletealll-s "L.deleteAll :: PLens s a -> Maybe s -> Maybe s")

@@ -283,2 +404,9 @@

For example:
```js
> L.deleteAll(L.findWith("a"), [{x: 1}, {a: 2}, {a: 3, y: 4}, {z: 5}])
[{x: 1}, {y: 4}, {z: 5}]
```
### Lenses

@@ -356,2 +484,8 @@

#### [`L.identity`](#lidentity "L.identity :: PLens s s")
`L.identity` is equivalent to `R.lens(R.identity, R.identity)` and is the
identity element of lenses: both `L(L.identity, l)` and `L(l, L.identity)` are
equivalent to `l`.
#### [`L.index(integer)`](#lindexinteger "L.index :: Integer -> PLens [a] a")

@@ -358,0 +492,0 @@

@@ -104,3 +104,3 @@ import R from "ramda"

const lls = L(l, ...ls)
return L(L.find(x => L.view(lls, x) !== undefined), lls)
return L(L.find(x => R.view(lls, x) !== undefined), lls)
}

@@ -158,3 +158,3 @@

L.pick = template => L.lens(
L.pick = template => R.lens(
c => {

@@ -179,2 +179,4 @@ let r

L.identity = R.lens(R.identity, R.identity)
export default L

@@ -22,2 +22,3 @@ import R from "ramda"

describe("arities", () => {
testEq('L.augment.length', 1)
testEq('L.compose.length', 1)

@@ -27,3 +28,5 @@ testEq('L.default.length', 1)

testEq('L.delete.length', 2)
testEq('L.filter.length', 1)
testEq('L.find.length', 1)
testEq('L.findWith.length', 1)
testEq('L.index.length', 1)

@@ -34,2 +37,3 @@ testEq('L.length', 1)

testEq('L.over.length', 3)
testEq('L.pick.length', 1)
testEq('L.prop.length', 1)

@@ -36,0 +40,0 @@ testEq('L.replace.length', 2)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc