Comparing version 2.1.0-beta.0 to 2.1.0-beta.1
@@ -49,2 +49,6 @@ function _typeof(obj) { | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
} | ||
function _toArray(arr) { | ||
@@ -74,2 +78,28 @@ return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); | ||
function _iterableToArrayLimit(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _nonIterableSpread() { | ||
@@ -390,2 +420,7 @@ throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
}; | ||
var unshift = function unshift(x) { | ||
return function (xs) { | ||
return [x].concat(_toConsumableArray(xs)); | ||
}; | ||
}; | ||
var first = function first(xs) { | ||
@@ -711,6 +746,24 @@ return xs[0]; | ||
return function (obj) { | ||
return _objectSpread({}, obj, filling); | ||
var out = _objectSpread({}, obj); | ||
Object.entries(filling).forEach(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
out[key] = isValue(out[key]) ? out[key] : value; | ||
if (out.hasOwnProperty(key)) { | ||
if (isObject(out[key]) && isObject(value)) { | ||
out[key] = fill(value)(obj[key]); | ||
} | ||
} | ||
}); | ||
return out; | ||
}; | ||
}; | ||
var isObject = function isObject(x) { | ||
return _typeof(x) === 'object' && !Array.isArray(x) && x !== null; | ||
}; | ||
var isValue = function isValue(x) { | ||
return x !== null && x !== undefined; | ||
}; | ||
export { compile as lens, matching, all$1 as all, unless, updateAll, maybe, mod, set$1 as set, get, identity, flip, always, not, and, or, curry, into, filter, map, find, some, reduce, every, cons, first, rest, push, concat, append, prepend, has, greaterThan, lessThan, greaterThanEq, lessThanEq, toggle, returns, add, sub, inc, dec, includes, includesi, foldOf, maxOf, minOf, findOf, sumOf, productOf, foldBy, findBy, maxBy, minBy, fill }; | ||
export { compile as lens, matching, all$1 as all, unless, updateAll, maybe, mod, set$1 as set, get, identity, flip, always, not, and, or, curry, into, filter, map, find, some, reduce, every, cons, unshift, first, rest, push, concat, append, prepend, has, greaterThan, lessThan, greaterThanEq, lessThanEq, toggle, returns, add, sub, inc, dec, includes, includesi, foldOf, maxOf, minOf, findOf, sumOf, productOf, foldBy, findBy, maxBy, minBy, fill }; |
@@ -53,2 +53,6 @@ 'use strict'; | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
} | ||
function _toArray(arr) { | ||
@@ -78,2 +82,28 @@ return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); | ||
function _iterableToArrayLimit(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _nonIterableSpread() { | ||
@@ -394,2 +424,7 @@ throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
}; | ||
var unshift = function unshift(x) { | ||
return function (xs) { | ||
return [x].concat(_toConsumableArray(xs)); | ||
}; | ||
}; | ||
var first = function first(xs) { | ||
@@ -715,5 +750,23 @@ return xs[0]; | ||
return function (obj) { | ||
return _objectSpread({}, obj, filling); | ||
var out = _objectSpread({}, obj); | ||
Object.entries(filling).forEach(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
out[key] = isValue(out[key]) ? out[key] : value; | ||
if (out.hasOwnProperty(key)) { | ||
if (isObject(out[key]) && isObject(value)) { | ||
out[key] = fill(value)(obj[key]); | ||
} | ||
} | ||
}); | ||
return out; | ||
}; | ||
}; | ||
var isObject = function isObject(x) { | ||
return _typeof(x) === 'object' && !Array.isArray(x) && x !== null; | ||
}; | ||
var isValue = function isValue(x) { | ||
return x !== null && x !== undefined; | ||
}; | ||
@@ -744,2 +797,3 @@ exports.lens = compile; | ||
exports.cons = cons; | ||
exports.unshift = unshift; | ||
exports.first = first; | ||
@@ -746,0 +800,0 @@ exports.rest = rest; |
{ | ||
"name": "shades", | ||
"version": "2.1.0-beta.0", | ||
"version": "2.1.0-beta.1", | ||
"description": "Lens-like functionality with a lodash-style interface.", | ||
@@ -5,0 +5,0 @@ "main": "lib/bundle.js", |
@@ -44,3 +44,4 @@ import { | ||
sumOf, | ||
toggle | ||
toggle, | ||
unshift | ||
} from "shades"; | ||
@@ -202,2 +203,8 @@ | ||
includes("hello")("hello"); // $ExpectType boolean | ||
includes("hello")(false); // $ExpectError | ||
includesi("hello")("hello"); // $ExpectType boolean | ||
includesi("hello")(false); // $ExpectError | ||
get("name")(user); // $ExpectType string | ||
@@ -209,8 +216,2 @@ get(0, "name")(users); // $ExpectType string | ||
includes("hello")("hello"); // $ExpectType boolean | ||
includes("hello")(false); // $ExpectError | ||
includesi("hello")("hello"); // $ExpectType boolean | ||
includesi("hello")(false); // $ExpectError | ||
get("friends", all<User>(), "name")(user); // $ExpectType string[] | ||
@@ -311,2 +312,8 @@ | ||
unshift(1)([1, 2, 3]); // $ExpectType number[] | ||
unshift("a")(["a", "b", "c"]); // $ExpectType string[] | ||
unshift(1)(2); // $ExpectError | ||
unshift(1)(["a", "b", "c"]); // $ExpectError | ||
unshift("1")([1, 2, 3]); // $ExpectError | ||
first([1, 3, 4]); // $ExpectType number | ||
@@ -313,0 +320,0 @@ first(users); // $ExpectType User |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4603400
2960
2684