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.2.0 to 0.2.1

14

lib/partial.lenses.js

@@ -50,2 +50,10 @@ "use strict";

var toPartial = function toPartial(transform) {
return function (x) {
return undefined === x ? x : transform(x);
};
};
//
var conserve = function conserve(f) {

@@ -92,2 +100,6 @@ return function (n0, o) {

L.normalize = function (transform) {
return _ramda2.default.lens(toPartial(transform), conserve(toPartial(transform)));
};
L.prop = function (k) {

@@ -138,2 +150,2 @@ return _ramda2.default.lens(function (o) {

exports.default = L;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9wYXJ0aWFsLmxlbnNlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUlBLElBQU0sWUFBWSxTQUFaLFNBQVksQ0FBQyxDQUFELEVBQUksQ0FBSixFQUFVO0FBQzFCLE1BQUksTUFBTSxTQUFOLElBQW1CLEVBQUUsS0FBSyxDQUFMLENBQUYsRUFDckIsT0FBTyxDQUFQLENBREY7QUFFQSxNQUFJLGFBQUosQ0FIMEI7QUFJMUIsT0FBSyxJQUFNLENBQU4sSUFBVyxDQUFoQixFQUFtQjtBQUNqQixRQUFJLE1BQU0sQ0FBTixFQUFTO0FBQ1gsVUFBSSxjQUFjLENBQWQsRUFDRixJQUFJLEVBQUosQ0FERjtBQUVBLFFBQUUsQ0FBRixJQUFPLEVBQUUsQ0FBRixDQUFQLENBSFc7S0FBYjtHQURGO0FBT0EsU0FBTyxDQUFQLENBWDBCO0NBQVY7O0FBY2xCLElBQU0sU0FBUyxTQUFULE1BQVMsQ0FBQyxDQUFELEVBQUksQ0FBSixFQUFPLENB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HhzLmxlbmd0aCksIFt4XSlcbiAgICBpZiAoUi5lcXVhbHMoeCwgeHNbaV0pKVxuICAgICAgcmV0dXJuIHhzXG4gICAgcmV0dXJuIHhzLnNsaWNlKDAsIGkpLmNvbmNhdChbeF0sIHhzLnNsaWNlKGkrMSkpXG4gIH1cbn0pXG5cbmV4cG9ydCBkZWZhdWx0IExcbiJdfQ==

2

package.json
{
"name": "partial.lenses",
"version": "0.2.0",
"version": "0.2.1",
"description": "Ramda compatible lenses",

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

@@ -49,4 +49,5 @@ [![npm version](https://badge.fury.io/js/partial.lenses.svg)](http://badge.fury.io/js/partial.lenses)

The default import, `L`, is also a shorthand function for lens composition and
lifting. The semantics can be described as
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

@@ -113,4 +114,19 @@ ```

matches the given unary predicate. When no matching element is found the effect
is same as with `R.index` when the index set to the length of the array.
is same as with `R.index` with the index set to the length of the array.
### L.normalize(transform)
`L.normalize(transform)` maps the value with same given `transform` when viewed
and set and implicitly maps undefined to undefined. More specifically,
`L.normalize(transform)` is equivalent to `R.lens(toPartial(transform),
toPartial(transform))` where
```js
const toPartial = transform => x => undefined === x ? x : transform(x)
```
The use case for `normalize` is to make it easy to determine whether, after a
change, the data has actually changed. By keeping the data normalized, a simple
`R.equals` comparison will do.
### L.replace(inn, out)

@@ -125,6 +141,13 @@

```js
> L.view(L(L.replace(undefined, {type: "title", text: ""}), "text"), undefined)
> 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"})
> 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 properties and elements.

@@ -35,3 +35,6 @@ import R from "ramda"

//
const toPartial = transform => x => undefined === x ? x : transform(x)
//

@@ -65,2 +68,5 @@

L.normalize = transform =>
R.lens(toPartial(transform), conserve(toPartial(transform)))
L.prop = k =>

@@ -67,0 +73,0 @@ R.lens(o => o && o[k],

@@ -90,1 +90,22 @@ import R from "ramda"

})
describe("L.normalize", () => {
testEq('L.view(L.normalize(R.sortBy(R.identity)), [1,3,2,5])', () =>
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.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), undefined, [2])', () =>
L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), undefined, [2]),
undefined)
testEq('L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), undefined, [1,3,2,5])', () =>
L.set(L(L.normalize(R.sortBy(R.identity)), L.find(R.equals(2))), undefined, [1,3,2,5]),
[1,3,5])
})

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