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 0.4.0 to 0.5.0

54

lib/partial.lenses.js

@@ -8,2 +8,3 @@ "use strict";

});
exports.lift = undefined;

@@ -68,3 +69,3 @@ var _ramda = require("ramda");

var lift = function lift(l) {
var lift = exports.lift = function lift(l) {
switch (typeof l === "undefined" ? "undefined" : _typeof(l)) {

@@ -88,11 +89,47 @@ case "string":

L.compose = _ramda2.default.compose;
L.compose = L;
L.delete = _ramda2.default.curry(function (l, s) {
return _ramda2.default.set(l, undefined, s);
return _ramda2.default.set(lift(l), undefined, s);
});
L.lens = _ramda2.default.lens;
L.over = _ramda2.default.over;
L.set = _ramda2.default.set;
L.view = _ramda2.default.view;
L.over = _ramda2.default.curry(function (l, x2x, s) {
return _ramda2.default.over(lift(l), x2x, s);
});
L.set = _ramda2.default.curry(function (l, x, s) {
return _ramda2.default.set(lift(l), x, s);
});
L.view = _ramda2.default.curry(function (l, s) {
return _ramda2.default.view(lift(l), s);
});
L.firstOf = function () {
for (var _len2 = arguments.length, ls = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
ls[_key2] = arguments[_key2];
}
switch (ls.length) {
case 0:
throw new Error("firstOf called without arguments");
case 1:
return lift(ls[0]);
default:
var choose = function choose(target, otherwise) {
for (var i = 0, n = ls.length; i < n; ++i) {
var l = ls[i];
var r = _ramda2.default.view(lift(l), target);
if (undefined !== r) return otherwise ? l : r;
}
return otherwise;
};
return function (toFunctor) {
return function (target) {
return _ramda2.default.map(function (focus) {
return _ramda2.default.set(lift(choose(target, ls[0])), focus, target);
}, toFunctor(choose(target)));
};
};
}
};
L.replace = _ramda2.default.curry(function (inn, out) {

@@ -110,2 +147,5 @@ return _ramda2.default.lens(function (x) {

};
L.define = function (v) {
return _ramda2.default.compose(L.required(v), L.default(v));
};

@@ -161,2 +201,2 @@ L.normalize = function (transform) {

exports.default = L;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9wYXJ0aWFsLmxlbnNlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUlBLElBQU0sWUFBWSxTQUFaLFNBQVksQ0FBQyxDQUFELEVBQUksQ0FBSixFQUFVO0FBQzFCLE1BQUksTUFBTSxTQUFOLElBQW1CLEVBQUUsS0FBSyxDQUFMLENBQUYsRUFDckIsT0FBTyxDQUFQLENBREY7QUFFQSxNQUFJLGFBQUosQ0FIMEI7QUFJMUIsT0FBSyxJQUFNLENBQU4sSUFBVyxDQUFoQixFQUFtQjtBQUNqQixRQUFJLE1BQU0sQ0FBTixFQUFTO0FBQ1gsVUFBSSxjQUFjLENBQWQsRUFDRixJQUFJLEVBQUosQ0FERjtBQUVBLFFBQUUsQ0FBRixJQUFPLEVBQUUsQ0FBRixDQUFQLENBSFc7S0FBYjtHQURGO0FBT0EsU0FBTyxDQUFQLENBWDBCO0NBQVY7O0FBY2xCLElBQU0sU0FBUyxTQUFULE1BQVMsQ0FBQyxDQUFELEVBQUksQ0FBSixFQUFPLENBQVAsRUFBYTtBQUMxQixNQUFJLE1BQU0sU0FBTixFQUNGLDJCQUFTLEdBQUksRUFBYixDQURGO0FBRUEsTUFBSSxLQUFLLENBQUwsSUFBVSxnQkFBRSxNQUFGLENBQVMsQ0FBVCxFQUFZLEVBQUUsQ0FBRixDQUFaLENBQVYsRUFDRixPQUFPLENBQVAsQ0FERjtBQUVBLE1BQU0sd0JBQU0sR0FBSSxFQUFWLENBTG9CO0FBTTFCLE9BQUssSUFBTSxDQUFOLElBQVcsQ0FBaEI7QUFDRSxRQUFJLE1BQU0sQ0FBTixFQUNGLEVBQUUsQ0FBRixJQUFPLEVBQUUsQ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ldHVybiB4cy5jb25jYXQoW3hdKVxuICAgIGlmIChSLmVxdWFscyh4LCB4c1tpXSkpXG4gICAgICByZXR1cm4geHNcbiAgICByZXR1cm4geHMuc2xpY2UoMCwgaSkuY29uY2F0KFt4XSwgeHMuc2xpY2UoaSsxKSlcbiAgfVxufSlcblxuTC5pbmRleCA9IGkgPT4gUi5sZW5zKHhzID0+IHhzICYmIHhzW2ldLCAoeCwgeHMpID0+IHtcbiAgaWYgKHggPT09IHVuZGVmaW5lZCkge1xuICAgIGlmICh4cyA9PT0gdW5kZWZpbmVkKVxuICAgICAgcmV0dXJuIHVuZGVmaW5lZFxuICAgIGlmIChpIDwgeHMubGVuZ3RoKVxuICAgICAgcmV0dXJuIGRyb3BwZWQoeHMuc2xpY2UoMCwgaSkuY29uY2F0KHhzLnNsaWNlKGkrMSkpKVxuICAgIHJldHVybiB4c1xuICB9IGVsc2Uge1xuICAgIGlmICh4cyA9PT0gdW5kZWZpbmVkKVxuICAgICAgcmV0dXJuIEFycmF5KGkpLmNvbmNhdChbeF0pXG4gICAgaWYgKHhzLmxlbmd0aCA8PSBpKVxuICAgICAgcmV0dXJuIHhzLmNvbmNhdChBcnJheShpIC0geHMubGVuZ3RoKSwgW3hdKVxuICAgIGlmIChSLmVxdWFscyh4LCB4c1tpXSkpXG4gICAgICByZXR1cm4geHNcbiAgICByZXR1cm4geHMuc2xpY2UoMCwgaSkuY29uY2F0KFt4XSwgeHMuc2xpY2UoaSsxKSlcbiAgfVxufSlcblxuZXhwb3J0IGRlZmF1bHQgTFxuIl19

2

package.json
{
"name": "partial.lenses",
"version": "0.4.0",
"version": "0.5.0",
"description": "Ramda compatible lenses",

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

@@ -1,2 +0,2 @@

[![npm version](https://badge.fury.io/js/partial.lenses.svg)](http://badge.fury.io/js/partial.lenses)
[ [Examples](#examples) | [Reference](#reference) | [Background](#background) ]

@@ -8,7 +8,10 @@ This library provides a collection of [Ramda](http://ramdajs.com/) compatible

Index:
* [Examples](#examples)
* [Reference](#reference)
* [Background](#background)
In Javascript, optional data can be mapped to `undefined`, which is what partial
lenses also do. When the viewed part of a data structure is missing, the result
is `undefined`. When a part of a data structure is set to `undefined`, the part
is deleted. Partial lenses are defined in such a way that operations compose
and one can conveniently and robustly operate on deeply nested data structures.
[![npm version](https://badge.fury.io/js/partial.lenses.svg)](http://badge.fury.io/js/partial.lenses)
## Examples

@@ -75,3 +78,3 @@

> L.set(textIn("fi"), "Otsikko", data)
{ contents: [ { language: "en", text: "The title" },
{ contents: [ { language: "en", text: "Title" },
{ language: "fi", text: "Otsikko" },

@@ -87,3 +90,3 @@ { language: "sv", text: "Rubrik" } ] }

> L.set(textIn("sv"), undefined, data)
{ contents: [ { language: "en", text: "The title" } ] }
{ contents: [ { language: "en", text: "Title" } ] }
```

@@ -99,2 +102,5 @@

Note that unless required and default values are explicitly specified as part of
the lens, they will both be undefined.
## Reference

@@ -112,27 +118,18 @@

For convenience, you can access basic operations on lenses via the default
import `L`:
You can access basic operations on lenses via the default import `L`:
* `L.compose(l1, ..., ln)` is the same as `R.compose(l1, ..., lN)` (see [compose](http://ramdajs.com/0.19.0/docs/#compose)).
* `L.lens(get, set)` is the same as `R.lens(get, set)` (see [lens](http://ramdajs.com/0.19.0/docs/#lens)).
* `L.over(l, x2x, s)` is the same as `R.over(l, x2x, s)` (see [over](http://ramdajs.com/0.19.0/docs/#over)).
* `L.set(l, x, s)` is the same as `R.set(l, x, s)` (see [set](http://ramdajs.com/0.19.0/docs/#set)).
* `L.view(l, s)` is the same as `R.view(l, s)` (see [view](http://ramdajs.com/0.19.0/docs/#view)).
* `L(l1, ..., ln)` and `L.compose(l1, ..., ln)` both are the same as
`R.compose(lift(l1), ..., lift(lN))` (see
[compose](http://ramdajs.com/0.19.0/docs/#compose)).
* `L.lens(get, set)` is the same as `R.lens(get, set)` (see
[lens](http://ramdajs.com/0.19.0/docs/#lens)).
* `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)).
* `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)).
* `L.view(l, s)` is the same as `R.view(lift(l), s)` (see
[view](http://ramdajs.com/0.19.0/docs/#view)).
For convenience, there is also a shorthand for delete:
The `lift` operation is defined as
* `L.delete(l, s)` is the same as `R.set(l, undefined, s)`.
### Shorthand composition and lifting
The default import, `L`, is also a shorthand function for lens composition (see
[compose](http://ramdajs.com/0.19.0/docs/#compose)) and lifting. The semantics
can be described as
```
L(l1, ..., lN) === R.compose(lift(l1), ..., lift(lN))
```
where
```js

@@ -148,4 +145,20 @@ const lift = l => {

Note that `L.compose` does not perform lifting.
and is available as a non-default export.
#### L.delete(l, s)
For convenience, there is also a shorthand for delete:
* `L.delete(l, s)` is the same as `R.set(lift(l), undefined, s)`.
#### L.firstOf(l1, ..., lN)
`L.firstOf(l1, ..., lN)` returns a partial lens that acts like the first of the
given lenses whose view is not undefined on the given target. When the views of
all of the given lenses are undefined, the returned lens acts like the first of
the given lenses.
Note that `L.firstOf` is an associative operation, but there is no identity
element.
### Lenses

@@ -155,4 +168,4 @@

`L.prop(string)` is much like `R.lensProp(string)` (see
[lensProp](http://ramdajs.com/0.19.0/docs/#lensProp)), but composes as a partial
`L.prop(string)` or `L(string)` is similar to `R.lensProp(string)` (see
[lensProp](http://ramdajs.com/0.19.0/docs/#lensProp)), but acts as a partial
lens:

@@ -164,22 +177,7 @@ * When viewing an undefined property or an undefined object, the result is

Examples:
```js
> L.set(L("x", "y"), undefined, {x: {y: 1}})
undefined
> L.set(L("x", "y"), 2, {x: {y: 1}})
{ x: { y: 2 } }
> L.set(L("x", "y"), undefined, {x: {y: 1}, z: 3})
{ z: 3 }
> L.set(L("x", "y"), 2, {x: {y: 1}, z: 3})
{ x: { y: 2 }, z: 3 }
> L.view(L("x", "y"), undefined)
undefined
```
#### L.index(integer)
`L.index(integer)` is like `R.lensIndex(integer)` (see
[lensIndex](http://ramdajs.com/0.19.0/docs/#lensIndex)), but composes as a
partial lens:
`L.index(integer)` or `L(integer)` is similar to `R.lensIndex(integer)` (see
[lensIndex](http://ramdajs.com/0.19.0/docs/#lensIndex)), but acts as a partial
lens:
* When viewing an undefined array index or an undefined array, the result is

@@ -220,19 +218,5 @@ undefined.

Examples:
```js
> L.view(L(L.replace(undefined, {type: "title", text: ""}),
"text"),
undefined)
""
> L.set(L(L.replace(undefined, {type: "title", text: ""}),
"text"),
"",
{type: "title", text: "not empty"})
undefined
```
The use case for `replace` is to handle optional and required properties and
elements. In most cases, rather than using `replace`, you will use a
combination of `required` and `default`:
elements. In most cases, rather than using `replace`, you will make selective
use of `required` and `default`:

@@ -247,2 +231,6 @@ ##### L.default(out)

##### L.define(value)
`L.define(value)` is the same as `L(L.required(value), L.default(value))`.
## Background

@@ -302,7 +290,1 @@

[lensProp](http://ramdajs.com/0.19.0/docs/#lensProp)).
In Javascript, optional data can be mapped to `undefined`, which is what partial
lenses also do. When the viewed part of a data structure is missing, the result
is `undefined`. When a part of a data structure is set to `undefined`, the part
is deleted. Partial lenses are defined in such a way that operations compose
and one can conveniently and robustly operate on deeply nested data structures.

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

const lift = l => {
export const lift = l => {
switch (typeof l) {

@@ -59,9 +59,32 @@ case "string": return L.prop(l)

L.compose = R.compose
L.delete = R.curry((l, s) => R.set(l, undefined, s))
L.compose = L
L.delete = R.curry((l, s) => R.set(lift(l), undefined, s))
L.lens = R.lens
L.over = R.over
L.set = R.set
L.view = R.view
L.over = R.curry((l, x2x, s) => R.over(lift(l), x2x, s))
L.set = R.curry((l, x, s) => R.set(lift(l), x, s))
L.view = R.curry((l, s) => R.view(lift(l), s))
L.firstOf = (...ls) => {
switch (ls.length) {
case 0:
throw new Error("firstOf called without arguments")
case 1:
return lift(ls[0])
default:
const choose = (target, otherwise) => {
for (let i=0, n=ls.length; i<n; ++i) {
const l = ls[i]
const r = R.view(lift(l), target)
if (undefined !== r)
return otherwise ? l : r
}
return otherwise
}
return toFunctor => target =>
R.map(focus => R.set(lift(choose(target, ls[0])), focus, target),
toFunctor(choose(target)))
}
}
L.replace = R.curry((inn, out) =>

@@ -73,2 +96,3 @@ R.lens(x => R.equals(x, inn) ? out : x,

L.required = inn => L.replace(inn, undefined)
L.define = v => R.compose(L.required(v), L.default(v))

@@ -75,0 +99,0 @@ L.normalize = transform =>

@@ -43,8 +43,8 @@ import R from "ramda"

L.set(L(1), undefined, [,,]), undefined)
testEq('L.set(L(L.required([]), 1), undefined, [,,])', () =>
L.set(L(L.required([]), 1), undefined, [,,]), [])
testEq('L.set(L.compose(L.required([]), 1), undefined, [,,])', () =>
L.set(L.compose(L.required([]), 1), undefined, [,,]), [])
testEq('L.set(L(1), 4, [1, 2, 3])', () =>
L.set(L(1), 4, [1, 2, 3]), [1, 4, 3])
testEq('L.set(L(2), 4, undefined)', () =>
L.set(L(2), 4, undefined), [,, 4])
testEq('L.set(2, 4, undefined)', () =>
L.set(2, 4, undefined), [,, 4])
testEq('L.set(L(2), 4, [1])', () =>

@@ -56,8 +56,8 @@ L.set(L(2), 4, [1]), [1,, 4])

L.set(L(1), undefined, [1, 2, 3]), [1, 3])
testEq('L.set(L(2), undefined, [1, 2, 3])', () =>
L.set(L(2), undefined, [1, 2, 3]), [1, 2])
testEq('L.set(2, undefined, [1, 2, 3])', () =>
L.set(2, undefined, [1, 2, 3]), [1, 2])
testEq('L.set(L(5), undefined, [1, 2, 3])', () =>
L.set(L(5), undefined, [1, 2, 3]), [1, 2, 3])
testEq('L.view(L(5), undefined)', () =>
L.view(L(5), undefined), undefined)
testEq('L.view(5, undefined)', () =>
L.view(5, undefined), undefined)
testEq('L.view(L(5), [1, 2, 3])', () =>

@@ -72,14 +72,14 @@ L.view(L(5), [1, 2, 3]), undefined)

L.set(L("x", L.required(null)), undefined, {x: 1}), {x: null})
testEq('L.set(L("x", L.required(null)), 2, {x: 1})', () =>
L.set(L("x", L.required(null)), 2, {x: 1}), {x: 2})
testEq('L.delete(L("y"), {x: 1, y: 2})', () =>
L.delete(L("y"), {x: 1, y: 2}), {x: 1})
testEq('L.set(L.compose("x", L.required(null)), 2, {x: 1})', () =>
L.set(L.compose("x", L.required(null)), 2, {x: 1}), {x: 2})
testEq('L.delete("y", {x: 1, y: 2})', () =>
L.delete("y", {x: 1, y: 2}), {x: 1})
testEq('L.set(L("y"), 3, {x: 1, y: 2})', () =>
L.set(L("y"), 3, {x: 1, y: 2}), {x: 1, y: 3})
testEq('L.set(L("z"), 3, {x: 1, y: 2})', () =>
L.set(L("z"), 3, {x: 1, y: 2}), {x: 1, y: 2, z: 3})
testEq('L.set("z", 3, {x: 1, y: 2})', () =>
L.set("z", 3, {x: 1, y: 2}), {x: 1, y: 2, z: 3})
testEq('L.set(L("z"), 3, undefined)', () =>
L.set(L("z"), 3, undefined), {z: 3})
testEq('L.view(L("z"), undefined)', () =>
L.view(L("z"), undefined), undefined)
testEq('L.view("z", undefined)', () =>
L.view("z", undefined), undefined)
testEq('L.view(L("z"), {x: 1})', () =>

@@ -114,15 +114,11 @@ L.view(L("z"), {x: 1}), undefined)

L.view(L.normalize(R.sortBy(R.identity)), [1,3,2,5]), [1,2,3,5])
testEq('L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), 4, [1,3,2,5])', () =>
L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), 4, [1,3,2,5]),
[1,3,4,5])
testEq('L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), 4, undefined)', () =>
L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), 4, undefined),
[4])
testEq('L.delete(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), [2])', () =>
L.delete(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), [2]),
undefined)
testEq('L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), undefined, [1,3,2,5])', () =>

@@ -132,1 +128,24 @@ L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), undefined, [1,3,2,5]),

})
describe("L.firstOf", () => {
testEq('L.view(L.firstOf("x", "y"), {x: 11, y: 12})', () =>
L.view(L.firstOf("x", "y"), {x: 11, y: 12}), 11)
testEq('L.view(L.firstOf("y", "x"), {x: 11, y: 12})', () =>
L.view(L.firstOf("y", "x"), {x: 11, y: 12}), 12)
testEq('L.view(L.firstOf("x", "y"), {z: 13})', () =>
L.view(L.firstOf("x", "y"), {z: 13}), undefined)
testEq('L.over(L.firstOf("x", "y"), x => x-2, {x: 11, y: 12})', () =>
L.over(L.firstOf("x", "y"), x => x-2, {x: 11, y: 12}), {x: 9, y: 12})
testEq('L.over(L.firstOf("y", "x"), x => x-2, {x: 11, y: 12})', () =>
L.over(L.firstOf("y", "x"), x => x-2, {x: 11, y: 12}), {x: 11, y: 10})
testEq('L.set(L.firstOf("x", "y"), 12, {z: 13})', () =>
L.set(L.firstOf("x", "y"), 12, {z: 13}), {x: 12, z: 13})
testEq('L.set(L.firstOf("y", "x"), 12, {z: 13})', () =>
L.set(L.firstOf("y", "x"), 12, {z: 13}), {y: 12, z: 13})
testEq('L.delete(L.firstOf("x", "y"), {z: 13})', () =>
L.delete(L.firstOf("x", "y"), {z: 13}), {z: 13})
testEq('L.delete(L.firstOf("x", "y"), {x: 11, y: 12})', () =>
L.delete(L.firstOf("x", "y"), {x: 11, y: 12}), {y: 12})
testEq('L.delete(L.firstOf("y", "x"), {x: 11, y: 12})', () =>
L.delete(L.firstOf("y", "x"), {x: 11, y: 12}), {x: 11})
})

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