Comparing version 1.8.0 to 1.9.0
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _isArray = require('is-array'); | ||
var _isArray2 = _interopRequireDefault(_isArray); | ||
var _attr = require('./attr'); | ||
@@ -29,3 +25,3 @@ | ||
return (0, _isArray2.default)(arr) ? arr.slice(0, index).concat(f.apply(undefined, [arr[index]].concat(params))).concat(arr.slice(index + 1)) : (0, _attr2.default)(index).mod(f)(arr); | ||
return Array.isArray(arr) ? arr.slice(0, index).concat(f.apply(undefined, [arr[index]].concat(params))).concat(arr.slice(index + 1)) : (0, _attr2.default)(index).mod(f)(arr); | ||
}; | ||
@@ -32,0 +28,0 @@ } |
@@ -6,14 +6,16 @@ 'use strict'; | ||
}); | ||
exports.any = exports.every = exports.map = exports.filter = exports.cons = undefined; | ||
exports.any = exports.every = exports.map = exports.filter = exports.prepend = exports.append = exports.concat = exports.push = exports.rest = exports.first = exports.cons = undefined; | ||
var _pickBy = require('lodash/pickBy'); | ||
var _lodash = require('lodash.pickby'); | ||
var _pickBy2 = _interopRequireDefault(_pickBy); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _mapValues = require('lodash/mapValues'); | ||
var _lodash3 = require('lodash.mapvalues'); | ||
var _mapValues2 = _interopRequireDefault(_mapValues); | ||
var _lodash4 = _interopRequireDefault(_lodash3); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); } | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
@@ -26,6 +28,29 @@ | ||
}; | ||
var first = exports.first = function first(xs) { | ||
return xs[0]; | ||
}; | ||
var rest = exports.rest = function rest(_ref) { | ||
var _ref2 = _toArray(_ref), | ||
x = _ref2[0], | ||
xs = _ref2.slice(1); | ||
return xs; | ||
}; | ||
var push = exports.push = cons; | ||
var concat = exports.concat = function concat(xs) { | ||
return function (ys) { | ||
return [].concat(_toConsumableArray(ys), _toConsumableArray(xs)); | ||
}; | ||
}; | ||
var append = exports.append = concat; | ||
var prepend = exports.prepend = function prepend(ys) { | ||
return function (xs) { | ||
return [].concat(_toConsumableArray(ys), _toConsumableArray(xs)); | ||
}; | ||
}; | ||
var filter = exports.filter = function filter(f) { | ||
return function (arr) { | ||
return Array.isArray(arr) ? arr.filter(f) : (0, _pickBy2.default)(arr, f); | ||
return Array.isArray(arr) ? arr.filter(f) : (0, _lodash2.default)(arr, f); | ||
}; | ||
@@ -36,3 +61,3 @@ }; | ||
return function (arr) { | ||
return Array.isArray(arr) ? arr.map(f) : (0, _mapValues2.default)(arr, f); | ||
return Array.isArray(arr) ? arr.map(f) : (0, _lodash4.default)(arr, f); | ||
}; | ||
@@ -39,0 +64,0 @@ }; |
@@ -8,13 +8,13 @@ '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 _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _isEqual = require('lodash/isEqual'); | ||
var _lodash = require('lodash.isequal'); | ||
var _isEqual2 = _interopRequireDefault(_isEqual); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _list = require('../list'); | ||
var _get = require('lodash/get'); | ||
var _lodash3 = require('lodash.get'); | ||
var _get2 = _interopRequireDefault(_get); | ||
var _lodash4 = _interopRequireDefault(_lodash3); | ||
@@ -50,5 +50,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
return pattern && (typeof pattern === 'undefined' ? 'undefined' : _typeof(pattern)) === 'object' ? (0, _list.every)(Object.keys(pattern).map(function (key) { | ||
return has((0, _get2.default)(pattern, key))((0, _get2.default)(obj, key)); | ||
})) : typeof pattern === 'function' ? pattern(obj) : (0, _isEqual2.default)(pattern, obj); | ||
return has((0, _lodash4.default)(pattern, key))((0, _lodash4.default)(obj, key)); | ||
})) : typeof pattern === 'function' ? pattern(obj) : (0, _lodash2.default)(pattern, obj); | ||
}; | ||
}; |
{ | ||
"name": "shades", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "Lens-like functionality with a lodash-style interface.", | ||
@@ -32,8 +32,14 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"is-array": "^1.0.1" | ||
"lodash.get": "^4.4.2", | ||
"lodash.isequal": "^4.5.0", | ||
"lodash.mapvalues": "^4.6.0", | ||
"lodash.pickby": "^4.6.0" | ||
}, | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.13.2", | ||
"babel-cli": "^6.26.0", | ||
"babel-plugin-lodash": "^3.3.2", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-register": "^6.11.6", | ||
"chai": "^4.1.2", | ||
"mocha": "^3.0.2", | ||
@@ -40,0 +46,0 @@ "pegjs": "^0.10.0" |
@@ -250,5 +250,29 @@ ## shades | ||
``` | ||
#### cons :: a -> Array a -> Array a | ||
#### <a href="#cons">cons</a> :: a -> Array a -> Array a | ||
Consumes an element `x` and an array `xs` and returns a new array with `x` APPENDED to `xs` (not prepended, which is more typical with `cons` and lists. This is to make it easier to use in pipelined scenarios) | ||
```js | ||
> cons(5)([1, 2, 3, 4]) | ||
[1, 2, 3, 4, 5] | ||
``` | ||
#### push :: a -> Array a -> Array a | ||
Alias for [`cons`](#cons) | ||
#### <a href='concat'>concat</a> :: Array a -> Array a -> Array a | ||
Takes two arrays and concatenates the first on to the second. | ||
```js | ||
> concat([1, 2, 3])([4, 5, 6]) | ||
[4, 5, 6, 1, 2, 3] | ||
``` | ||
#### append :: Array a -> Array a -> Array a | ||
Alias for [`concat`](#concat) | ||
#### prepend :: Array a -> Array a -> Array a | ||
Takes two arrays and concatenates the second on to the first. | ||
```js | ||
> prepend([1, 2, 3])([4, 5, 6]) | ||
[1, 2, 3, 4, 5, 6] | ||
``` | ||
#### and :: (...(...args) -> boolean) -> (...args) -> boolean | ||
@@ -255,0 +279,0 @@ A function level equivalent of the `&&` operator. It consumes an arbitrary number of functions that take the same argument types and produce booleans, and returns a single function that takes the same arguments, and returns `true ` if all of the functions return `true` |
@@ -1,4 +0,2 @@ | ||
setting a property on an array yields an object: set('.d')(10)([1, 2]) == {0: 1, 1: 2, d: 10} | ||
setting an outof bounds index on an array appends: set('[5]')(10)([1, 2]) == [1, 2, 5] | ||
'all' traversal | ||
performance testing |
Sorry, the diff of this file is not supported yet
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
131996
1128
310
4
8
23
+ Addedlodash.get@^4.4.2
+ Addedlodash.isequal@^4.5.0
+ Addedlodash.mapvalues@^4.6.0
+ Addedlodash.pickby@^4.6.0
+ Addedlodash.get@4.4.2(transitive)
+ Addedlodash.isequal@4.5.0(transitive)
+ Addedlodash.mapvalues@4.6.0(transitive)
+ Addedlodash.pickby@4.6.0(transitive)
- Removedis-array@^1.0.1
- Removedis-array@1.0.1(transitive)