partial.lenses
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -232,3 +232,25 @@ "use strict"; | ||
L.pick = function (template) { | ||
return L.lens(function (c) { | ||
var r = void 0; | ||
for (var k in template) { | ||
var v = L.view(template[k], c); | ||
if (v !== undefined) { | ||
if (r === undefined) r = {}; | ||
r[k] = v; | ||
} | ||
} | ||
return r; | ||
}, function () { | ||
var o = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var cIn = arguments[1]; | ||
var c = cIn; | ||
for (var k in template) { | ||
c = L.set(template[k], o[k], c); | ||
}return c; | ||
}); | ||
}; | ||
exports.default = L; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9wYXJ0aWFsLmxlbnNlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQUFBOzs7Ozs7Ozs7Ozs7QUFJQSxJQUFNLFlBQVksU0FBWixTQUFZLENBQUMsQ0FBRCxFQUFJLENBQUosRUFBVTtBQUMxQixNQUFJLE1BQU0sU0FBTixJQUFtQixFQUFFLEtBQUssQ0FBTCxDQUFGLEVBQ3JCLE9BQU8sQ0FBUCxDQURGO0FBRUEsTUFBSSxVQUFKLENBSDBCO0FBSTFCLE9BQUssSUFBTSxDQUFOLElBQVcsQ0FBaEIsRUFBbUI7QUFDakIsUUFBSSxNQUFNLENBQU4sRUFBUztBQUNYLFVBQUksY0FBYyxDQUFkLEVBQ0YsSUFBSSxFQUFKLENBREY7QUFFQSxRQUFFLENBQUYsSUFBTyxFQUFFLENBQUYsQ0FBUCxDQUhXO0tBQWI7R0FERjtBQU9BLFNBQU8sQ0FBUCxDQVgwQjtDQUFWOztBQWNsQixJQUFNLFNBQVMsU0FBVCxNQUFTLENBQUMsQ0FBRCxFQUFJLENBQUosRUFBTyxDQUFQLEVBQWE7QUFDMUIsTUFBSSxNQUFNLFNBQU4sRUFDRiwyQkFBUyxHQU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tcbiAgICAgIGNvbnN0IHYgPSBMLnZpZXcodGVtcGxhdGVba10sIGMpXG4gICAgICBpZiAodiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChyID09PSB1bmRlZmluZWQpXG4gICAgICAgICAgciA9IHt9XG4gICAgICAgIHJba10gPSB2XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByXG4gIH0sXG4gIChvID0ge30sIGNJbikgPT4ge1xuICAgIGxldCBjID0gY0luXG4gICAgZm9yIChjb25zdCBrIGluIHRlbXBsYXRlKVxuICAgICAgYyA9IEwuc2V0KHRlbXBsYXRlW2tdLCBvW2tdLCBjKVxuICAgIHJldHVybiBjXG4gIH0pXG5cbmV4cG9ydCBkZWZhdWx0IExcbiJdfQ== |
{ | ||
"name": "partial.lenses", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Ramda compatible partial lenses", | ||
@@ -31,3 +31,2 @@ "main": "lib/partial.lenses.js", | ||
"devDependencies": { | ||
"babel": "^6.5.2", | ||
"babel-cli": "^6.6.5", | ||
@@ -34,0 +33,0 @@ "babel-eslint": "^5.0.0", |
@@ -378,2 +378,15 @@ [ [Tutorial](#tutorial) | [Reference](#reference) | [Background](#background) ] | ||
#### [`L.pick({p1: l1, ...pls})`](#lpickp1-l1-pls "L.pick :: {p1 :: PLens s a1, ...pls} -> PLens s {p1 :: a1, ...pls}") | ||
`L.pick({p1: l1, ...pls})` creates a lens out of the given object template of | ||
lenses. When viewed, an object is created, whose properties are obtained by | ||
viewing through the lenses of the template. When set with an object, the | ||
properties of the object are set to the context via the lenses of the template. | ||
`undefined` is treated as the equivalent of empty or non-existent in both | ||
directions. | ||
Note that, when set, `L.pick` simply ignores any properties that the given | ||
template doesn't mention. Note that the underlying data structure need not be | ||
an object. | ||
#### [`L.prop(string)`](#lpropstring "L.prop :: (p :: a) -> PLens {p :: a, ...ps} a") | ||
@@ -380,0 +393,0 @@ |
@@ -157,2 +157,22 @@ import R from "ramda" | ||
L.pick = template => L.lens( | ||
c => { | ||
let r | ||
for (const k in template) { | ||
const v = L.view(template[k], c) | ||
if (v !== undefined) { | ||
if (r === undefined) | ||
r = {} | ||
r[k] = v | ||
} | ||
} | ||
return r | ||
}, | ||
(o = {}, cIn) => { | ||
let c = cIn | ||
for (const k in template) | ||
c = L.set(template[k], o[k], c) | ||
return c | ||
}) | ||
export default L |
@@ -142,1 +142,11 @@ import R from "ramda" | ||
}) | ||
describe("L.pick", () => { | ||
testEq('L.view(L.pick({x: "c"}), {a: [2], b: 1})', undefined) | ||
testEq('L.set(L(L.pick({x: "c"}), "x"), 4, {a: [2], b: 1})', {a: [2], b: 1, c: 4}) | ||
testEq('L.view(L.pick({x: "b", y: "a"}), {a: [2], b: 1})', {x: 1, y: [2]}) | ||
testEq('L.set(L(L.pick({x: "b", y: "a"}), "x"), 3, {a: [2], b: 1})', {a: [2], b: 3}) | ||
testEq('L.delete(L(L.pick({x: "b", y: "a"}), "y"), {a: [2], b: 1})', {b: 1}) | ||
testEq('L.delete(L(L.pick({x: "b"}), "x"), {a: [2], b: 1})', {a: [2]}) | ||
testEq('L.deleteAll(L(L.pick({x: "b", y: "a"}), L.firstOf("y", "x")), {a: [2], b: 1})', undefined) | ||
}) |
Sorry, the diff of this file is not supported yet
67547
7
498
477