New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 3.4.0 to 3.4.1

.nyc_output/29925.json

15

CHANGELOG.md
# 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).
## 3.4.0

@@ -4,0 +19,0 @@

102

lib/partial.lenses.js

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

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -63,2 +65,18 @@

var isArray = function isArray(x) {
return x && x.constructor === Array;
};
var isObject = function isObject(x) {
return x && x.constructor === Object;
};
var unArray = function unArray(x) {
return isArray(x) ? x : undefined;
};
var unObject = function unObject(x) {
return isObject(x) ? x : undefined;
};
//
var id = function id(x) {

@@ -87,4 +105,5 @@ return x;

var deleteKey = function deleteKey(k, o) {
if (o === undefined || !(k in o)) return o;
var deleteKey = function deleteKey(k) {
var o = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var r = void 0;

@@ -100,4 +119,5 @@ for (var p in o) {

var setKey = function setKey(k, v, o) {
if (o === undefined) return _defineProperty({}, k, v);
var setKey = function setKey(k, v) {
var o = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
if (k in o && R.equals(v, o[k])) return o;

@@ -273,4 +293,5 @@ var r = _defineProperty({}, k, v);

return lensI(function (o) {
return o && o[k];
}, function (v, o) {
return unObject(o) && o[k];
}, function (v, oIn) {
var o = unObject(oIn);
return v === undefined ? deleteKey(k, o) : setKey(k, v, o);

@@ -282,5 +303,8 @@ });

return choose(function (xs) {
if (xs === undefined) return append;
var i = xs.findIndex(predicate);
return i < 0 ? append : i;
if (isArray(xs)) {
var i = xs.findIndex(predicate);
return i < 0 ? append : i;
} else {
return append;
}
});

@@ -304,10 +328,10 @@ };

return lensI(function (xs) {
return xs && xs[i];
return unArray(xs) && xs[i];
}, function (x, xs) {
if (x === undefined) {
if (xs === undefined) return undefined;
if (!isArray(xs)) return undefined;
if (i < xs.length) return dropped(xs.slice(0, i).concat(xs.slice(i + 1)));
return xs;
return dropped(xs);
} else {
if (xs === undefined) return Array(i).concat([x]);
if (!isArray(xs)) return Array(i).concat([x]);
if (xs.length <= i) return xs.concat(Array(i - xs.length), [x]);

@@ -321,3 +345,3 @@ if (R.equals(x, xs[i])) return xs;

var append = exports.append = lensI(snd, function (x, xs) {
return x === undefined ? xs : xs === undefined ? [x] : xs.concat([x]);
return x === undefined ? unArray(xs) : isArray(xs) ? xs.concat([x]) : [x];
});

@@ -327,5 +351,5 @@

return lensI(function (xs) {
return xs && xs.filter(p);
return unArray(xs) && xs.filter(p);
}, function (ys, xs) {
return conserve(dropped(R.concat(ys || [], (xs || []).filter(R.complement(p)))), xs);
return conserve(dropped(R.concat(ys || [], (unArray(xs) || []).filter(R.complement(p)))), xs);
});

@@ -335,18 +359,32 @@ };

var augment = exports.augment = function augment(template) {
return lensI(toPartial(function (x) {
var z = _extends({}, x);
for (var k in template) {
z[k] = template[k](x);
}return z;
}), toConserve(function (y, c) {
if (y === undefined) return undefined;
var z = void 0;
var set = function set(k, v) {
if (undefined === z) z = {};
z[k] = v;
};
for (var k in y) {
if (!(k in template)) set(k, y[k]);else if (k in c) set(k, c[k]);
return lensI(function (x) {
if (isObject(x)) {
var z = _extends({}, x);
for (var k in template) {
z[k] = template[k](x);
}return z;
} else {
return undefined;
}
return z;
}, toConserve(function (y, cIn) {
if (isObject(y)) {
var _ret = function () {
var c = unObject(cIn) || {};
var z = void 0;
var set = function set(k, v) {
if (undefined === z) z = {};
z[k] = v;
};
for (var k in y) {
if (!(k in template)) set(k, y[k]);else if (k in c) set(k, c[k]);
}
return {
v: z
};
}();
if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
} else {
return undefined;
}
}));

@@ -416,2 +454,2 @@ };

exports.default = compose;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9wYXJ0aWFsLmxlbnNlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQTs7SUFBWTs7Ozs7Ozs7OztBQUlaLFNBQVMsUUFBVCxDQUFrQixLQUFsQixFQUF5QjtBQUFDLE9BQUssS0FBTCxHQUFhLEtBQWIsQ0FBRDtDQUF6QjtBQUNBLElBQU0sUUFBUSxTQUFSLEtBQVE7U0FBSyxJQUFJLFFBQUosQ0FBYSxDQUFiO0NBQUw7QUFDZCxTQUFTLFNBQVQsQ0FBbUIsR0FBbkIsR0FBeUIsVUFBVSxHQUFWLEVBQWU7QUFBQyxTQUFPLElBQUksUUFBSixDQUFhLElBQUksS0FBSyxLQUFMLENBQWpCLENBQVAsQ0FBRDtDQUFmO0FBQ3pCLFNBQVMsU0FBVCxDQUFtQixFQUFuQixHQUF3QixLQUF4QjtBQUNBLFNBQVMsU0FBVCxDQUFtQixFQUFuQixHQUF3QixVQUFVLENBQVYsRUFBYTtBQUFDL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ba10gPSB2XG4gICAgfVxuICAgIGZvciAoY29uc3QgayBpbiB5KSB7XG4gICAgICBpZiAoIShrIGluIHRlbXBsYXRlKSlcbiAgICAgICAgc2V0KGssIHlba10pXG4gICAgICBlbHNlXG4gICAgICAgIGlmIChrIGluIGMpXG4gICAgICAgICAgc2V0KGssIGNba10pXG4gICAgfVxuICAgIHJldHVybiB6XG4gIH0pKVxuXG5leHBvcnQgY29uc3QgcGljayA9IHRlbXBsYXRlID0+IGxlbnNJKFxuICBjID0+IHtcbiAgICBsZXQgclxuICAgIGZvciAoY29uc3QgayBpbiB0ZW1wbGF0ZSkge1xuICAgICAgY29uc3QgdiA9IGdldEkodG9SYW1kYSh0ZW1wbGF0ZVtrXSksIGMpXG4gICAgICBpZiAodiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChyID09PSB1bmRlZmluZWQpXG4gICAgICAgICAgciA9IHt9XG4gICAgICAgIHJba10gPSB2XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByXG4gIH0sXG4gIChvID0gZW1wdHksIGNJbikgPT4ge1xuICAgIGxldCBjID0gY0luXG4gICAgZm9yIChjb25zdCBrIGluIHRlbXBsYXRlKVxuICAgICAgYyA9IHNldEkodG9SYW1kYSh0ZW1wbGF0ZVtrXSksIG9ba10sIGMpXG4gICAgcmV0dXJuIGNcbiAgfSlcblxuZXhwb3J0IGNvbnN0IGlkZW50aXR5ID0gbGVuc0koaWQsIGNvbnNlcnZlKVxuXG5leHBvcnQgY29uc3QgcHJvcHMgPSAoLi4ua3MpID0+IHBpY2soUi56aXBPYmooa3MsIGtzKSlcblxuY29uc3Qgc2hvdyA9ICguLi5sYWJlbHMpID0+IHggPT4gY29uc29sZS5sb2coLi4ubGFiZWxzLCB4KSB8fCB4XG5cbmV4cG9ydCBjb25zdCBsb2cgPSAoLi4ubGFiZWxzKSA9PlxuICBsZW5zSShzaG93KC4uLmxhYmVscywgXCJnZXRcIiksIHNob3coLi4ubGFiZWxzLCBcIn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gbGV0IHpcbiAgICAgIGNvbnN0IHNldCA9IChrLCB2KSA9PiB7XG4gICAgICAgIGlmICh1bmRlZmluZWQgPT09IHopXG4gICAgICAgICAgeiA9IHt9XG4gICAgICAgIHpba10gPSB2XG4gICAgICB9XG4gICAgICBmb3IgKGNvbnN0IGsgaW4geSkge1xuICAgICAgICBpZiAoIShrIGluIHRlbXBsYXRlKSlcbiAgICAgICAgICBzZXQoaywgeVtrXSlcbiAgICAgICAgZWxzZVxuICAgICAgICAgIGlmIChrIGluIGMpXG4gICAgICAgICAgICBzZXQoaywgY1trXSlcbiAgICAgIH1cbiAgICAgIHJldHVybiB6XG4gICAgfSBlbHNlIHtcbiAgICAgIHJldHVybiB1bmRlZmluZWRcbiAgICB9XG4gIH0pKVxuXG5leHBvcnQgY29uc3QgcGljayA9IHRlbXBsYXRlID0+IGxlbnNJKFxuICBjID0+IHtcbiAgICBsZXQgclxuICAgIGZvciAoY29uc3QgayBpbiB0ZW1wbGF0ZSkge1xuICAgICAgY29uc3QgdiA9IGdldEkodG9SYW1kYSh0ZW1wbGF0ZVtrXSksIGMpXG4gICAgICBpZiAodiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChyID09PSB1bmRlZmluZWQpXG4gICAgICAgICAgciA9IHt9XG4gICAgICAgIHJba10gPSB2XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByXG4gIH0sXG4gIChvID0gZW1wdHksIGNJbikgPT4ge1xuICAgIGxldCBjID0gY0luXG4gICAgZm9yIChjb25zdCBrIGluIHRlbXBsYXRlKVxuICAgICAgYyA9IHNldEkodG9SYW1kYSh0ZW1wbGF0ZVtrXSksIG9ba10sIGMpXG4gICAgcmV0dXJuIGNcbiAgfSlcblxuZXhwb3J0IGNvbnN0IGlkZW50aXR5ID0gbGVuc0koaWQsIGNvbnNlcnZlKVxuXG5leHBvcnQgY29uc3QgcHJvcHMgPSAoLi4ua3MpID0+IHBpY2soUi56aXBPYmooa3MsIGtzKSlcblxuY29uc3Qgc2hvdyA9ICguLi5sYWJlbHMpID0+IHggPT4gY29uc29sZS5sb2coLi4ubGFiZWxzLCB4KSB8fCB4XG5cbmV4cG9ydCBjb25zdCBsb2cgPSAoLi4ubGFiZWxzKSA9PlxuICBsZW5zSShzaG93KC4uLmxhYmVscywgXCJnZXRcIiksIHNob3coLi4ubGFiZWxzLCBcInNldFwiKSlcblxuZXhwb3J0IGNvbnN0IHNlcXVlbmNlID0gdG9BcHBsaWNhdGl2ZSA9PiB0YXJnZXQgPT5cbiAgd2FybihcImBzZXF1ZW5jZWAgaXMgZXhwZXJpbWVudGFsIGFuZCBtaWdodCBiZSByZW1vdmVkLCByZW5hbWVkIG9yIGNoYW5nZWQgc2VtYW50aWNhbGx5IGJlZm9yZSBuZXh0IG1ham9yIHJlbGVhc2VcIikgfHxcbiAgUi5zZXF1ZW5jZShJZGVudCwgUi5tYXAodG9BcHBsaWNhdGl2ZSwgdGFyZ2V0KSlcbiAgLm1hcChSLnBpcGUoUi5maWx0ZXIoeCA9PiB4ICE9PSB1bmRlZmluZWQpLCBkcm9wcGVkKSlcblxuZXhwb3J0IGRlZmF1bHQgY29tcG9zZVxuIl19
{
"name": "partial.lenses",
"version": "3.4.0",
"version": "3.4.1",
"description": "Partial lenses",

@@ -31,11 +31,12 @@ "main": "lib/partial.lenses.js",

"devDependencies": {
"babel-cli": "^6.7.5",
"babel-eslint": "^6.0.2",
"babel-plugin-transform-es2015-modules-commonjs": "^6.7.4",
"babel-cli": "^6.8.0",
"babel-eslint": "^6.0.4",
"babel-plugin-transform-es2015-modules-commonjs": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-2": "^6.5.0",
"eslint": "^2.8.0",
"babel-register": "^6.8.0",
"eslint": "^2.9.0",
"mocha": "^2.4.5",
"nyc": "^6.4.0"
"nyc": "^6.4.4"
}
}

@@ -427,6 +427,5 @@ [ [Tutorial](#tutorial) | [Reference](#reference) | [Background](#background) ]

`L.append` is a special semi-degenerate lens that operates on arrays. The view
of `L.append` is always undefined. Setting `L.append` to undefined has no
effect by itself. Setting `L.append` to a defined value appends the value to
the end of the focused array.
`L.append` is a special semi-degenerate lens that operates on arrays and is
equivalent to `L.index(i)` with the index `i` set to the length of the focused
array or 0 in case the focus is not a defined array.

@@ -443,6 +442,6 @@ For example:

`L.augment({prop: obj => val, ...props})` is given a template of functions to
compute new properties. When viewing or setting undefined, the result is
undefined. When viewing a defined object, the object is extended with the
computed properties. When set with a defined object, the extended properties
are removed.
compute new properties. When not viewing or setting a defined object, the
result is undefined. When viewing a defined object, the object is extended with
the computed properties. When set with a defined object, the extended
properties are removed.

@@ -549,7 +548,7 @@ For example:

`L.filter(predicate)` operates on arrays. When viewed, only elements matching
the given predicate will be returned. When set, the resulting array will be
formed by concatenating the set array and the complement of the filtered
context. If the resulting array would be empty, the whole result will be
undefined.
`L.filter(predicate)` operates on arrays. When not viewing an array, the result
is undefined. When viewing an array, only elements matching the given predicate
will be returned. When set, the resulting array will be formed by concatenating
the set array and the complement of the filtered context. If the resulting
array would be empty, the whole result will be undefined.

@@ -613,4 +612,3 @@ For example:

* When viewing an undefined array index or an undefined array, the result is
undefined.
* When not viewing a defined array index, the result is undefined.
* When setting to undefined, the element is removed from the resulting array,

@@ -782,4 +780,3 @@ shifting all higher indices down by one. If the result would be an array

* When viewing an undefined property or an undefined object, the result is
undefined.
* When not viewing a defined object property, the result is undefined.
* When setting property to undefined, the property is removed from the result.

@@ -863,3 +860,3 @@ If the result would be an empty object, the whole result will be undefined.

#### <a name="sequence"></a>[`L.sequence`](#sequence "L.sequence :: Traversal s s")
#### <a name="sequence"></a>[`L.sequence`](#sequence "L.sequence :: PTraversal [a] a")

@@ -866,0 +863,0 @@ **`L.sequence` is experimental and might be removed, renamed or changed

@@ -31,2 +31,10 @@ import * as R from "ramda"

const isArray = x => x && x.constructor === Array
const isObject = x => x && x.constructor === Object
const unArray = x => isArray(x) ? x : undefined
const unObject = x => isObject(x) ? x : undefined
//
const id = x => x

@@ -50,5 +58,3 @@ const snd = (_, c) => c

const deleteKey = (k, o) => {
if (o === undefined || !(k in o))
return o
const deleteKey = (k, o = {}) => {
let r

@@ -65,5 +71,3 @@ for (const p in o) {

const setKey = (k, v, o) => {
if (o === undefined)
return {[k]: v}
const setKey = (k, v, o = {}) => {
if (k in o && R.equals(v, o[k]))

@@ -164,11 +168,14 @@ return o

const toRamdaProp = k =>
lensI(o => o && o[k],
(v, o) => v === undefined ? deleteKey(k, o) : setKey(k, v, o))
const toRamdaProp = k => lensI(o => unObject(o) && o[k], (v, oIn) => {
const o = unObject(oIn)
return v === undefined ? deleteKey(k, o) : setKey(k, v, o)
})
export const find = predicate => choose(xs => {
if (xs === undefined)
if (isArray(xs)) {
const i = xs.findIndex(predicate)
return i < 0 ? append : i
} else {
return append
const i = xs.findIndex(predicate)
return i < 0 ? append : i
}
})

@@ -185,11 +192,11 @@

const toRamdaIndex = i => lensI(xs => xs && xs[i], (x, xs) => {
const toRamdaIndex = i => lensI(xs => unArray(xs) && xs[i], (x, xs) => {
if (x === undefined) {
if (xs === undefined)
if (!isArray(xs))
return undefined
if (i < xs.length)
return dropped(xs.slice(0, i).concat(xs.slice(i+1)))
return xs
return dropped(xs)
} else {
if (xs === undefined)
if (!isArray(xs))
return Array(i).concat([x])

@@ -205,31 +212,38 @@ if (xs.length <= i)

export const append = lensI(snd, (x, xs) =>
x === undefined ? xs : xs === undefined ? [x] : xs.concat([x]))
x === undefined ? unArray(xs) : isArray(xs) ? xs.concat([x]) : [x])
export const filter = p => lensI(xs => xs && xs.filter(p), (ys, xs) =>
conserve(dropped(R.concat(ys || [], (xs || []).filter(R.complement(p)))), xs))
export const filter = p => lensI(xs => unArray(xs) && xs.filter(p), (ys, xs) =>
conserve(dropped(R.concat(ys || [], (unArray(xs) || []).filter(R.complement(p)))), xs))
export const augment = template => lensI(
toPartial(x => {
const z = {...x}
for (const k in template)
z[k] = template[k](x)
return z
}),
toConserve((y, c) => {
if (y === undefined)
x => {
if (isObject(x)) {
const z = {...x}
for (const k in template)
z[k] = template[k](x)
return z
} else {
return undefined
let z
const set = (k, v) => {
if (undefined === z)
z = {}
z[k] = v
}
for (const k in y) {
if (!(k in template))
set(k, y[k])
else
if (k in c)
set(k, c[k])
},
toConserve((y, cIn) => {
if (isObject(y)) {
const c = unObject(cIn) || {}
let z
const set = (k, v) => {
if (undefined === z)
z = {}
z[k] = v
}
for (const k in y) {
if (!(k in template))
set(k, y[k])
else
if (k in c)
set(k, c[k])
}
return z
} else {
return undefined
}
return z
}))

@@ -236,0 +250,0 @@

@@ -37,2 +37,4 @@ import * as R from "ramda"

const empties = [undefined, null, false, true, "a", 0, 0.0/0.0, {}, []]
describe("compose", () => {

@@ -111,2 +113,7 @@ testEq("P === L.compose", true)

testEq('L.set(1, "2", ["1", "2", "3"])', ["1", "2", "3"])
empties.forEach(invalid => testEq(`L.get(0, ${show(invalid)})`, undefined))
empties.forEach(invalid => testEq(`L.set(0, "f", ${show(invalid)})`, ["f"]))
testEq('L.set(L.index(0), "Hello", "x, world!")', ["Hello"])
testEq('L.remove(0, [])', undefined)
testEq('L.remove(1, [])', undefined)
})

@@ -129,2 +136,5 @@

testEq('L.get(P("z"), {x: 1})', undefined)
empties.forEach(invalid => testEq(`L.get("x", ${show(invalid)})`, undefined))
empties.forEach(invalid => testEq(`L.set("ex", true, ${show(invalid)})`, {ex: true}))
testEq('L.remove("x", {})', undefined)
})

@@ -205,2 +215,4 @@

testEq('L.remove(L.filter(R.lt(2)), [3,1,4,1,5,9,2])', [1,1,2])
empties.filter(x => !(x instanceof Array)).forEach(invalid => testEq(`L.get(L.filter(R.always(true)), ${show(invalid)})`, undefined))
empties.filter(x => !(x instanceof Array)).forEach(invalid => testEq(`L.set(L.filter(R.always(true)), [1,"2",3], ${show(invalid)})`, [1,"2",3]))
})

@@ -212,2 +224,7 @@

describe("L.append", () => {
testEq('L.remove(L.append, "anything")', undefined)
empties.forEach(invalid => testEq(`L.set(L.append, "a", ${show(invalid)})`, ["a"]))
})
describe("L.augment", () => {

@@ -220,2 +237,4 @@ testEq('L.get(L.augment({y: c => c.x+1, z: c => c.x-1}), {x: 0})', {x: 0, y: 1, z: -1})

testEq('L.remove(L.augment({z: c => c.x + c.y}), {x: 1, y: 2})', undefined)
empties.filter(x => !R.equals(x, {})).forEach(invalid => testEq(`L.get(L.augment({x: () => 1}), ${show(invalid)})`, undefined))
empties.forEach(invalid => testEq(`L.set(L.augment({x: () => 1}), {y: 2}, ${show(invalid)})`, {y: 2}))
})

@@ -238,2 +257,3 @@

testEq('L.removeAll(P(L.pick({x: "b", y: "a"}), L.choice("y", "x")), {a: [2], b: 1})', undefined)
testEq('L.get(L.pick({x: 0, y: 1}), ["a", "b"])', {x: "a", y: "b"})
})

@@ -240,0 +260,0 @@

Sorry, the diff of this file is not supported yet

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