ramda-adjunct 3.4.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +984 -0
- package/README.md +2 -2
- package/dist/RA.node.js +127 -41
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +127 -41
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +1224 -528
- package/dist/RA.web.standalone.min.js +1 -1
- package/es/concatAll.js +2 -1
- package/es/dispatch.js +1 -1
- package/es/ensureArray.js +1 -1
- package/es/flattenDepth.js +1 -1
- package/es/flattenProp.js +1 -1
- package/es/index.js +1 -0
- package/es/internal/ponyfills/Array.from.js +1 -1
- package/es/internal/ponyfills/Promise.allSettled.js +1 -1
- package/es/internal/ponyfills/Promise.any.js +1 -1
- package/es/isFalse.js +2 -2
- package/es/isNegativeZero.js +2 -2
- package/es/isPositiveZero.js +2 -2
- package/es/isTrue.js +2 -2
- package/es/lastP.js +1 -1
- package/es/lensTraverse.js +12 -3
- package/es/mergeProp.js +1 -1
- package/es/pathNotEq.js +4 -4
- package/es/propNotEq.js +3 -3
- package/es/reduceP.js +2 -2
- package/es/reduceRightP.js +2 -2
- package/es/renameKey.js +35 -0
- package/es/sortByProps.js +1 -1
- package/es/spreadProp.js +1 -1
- package/lib/allEqual.js +0 -1
- package/lib/concatAll.js +2 -1
- package/lib/dispatch.js +36 -1
- package/lib/ensureArray.js +1 -1
- package/lib/flattenDepth.js +1 -1
- package/lib/flattenProp.js +1 -1
- package/lib/index.js +4 -2
- package/lib/internal/ponyfills/Array.from.js +1 -1
- package/lib/internal/ponyfills/Promise.allSettled.js +1 -1
- package/lib/internal/ponyfills/Promise.any.js +1 -1
- package/lib/isFalse.js +1 -1
- package/lib/isNegativeZero.js +1 -1
- package/lib/isPositiveZero.js +1 -1
- package/lib/isSentinelValue.js +1 -2
- package/lib/isTrue.js +1 -1
- package/lib/lastP.js +1 -1
- package/lib/lensTraverse.js +11 -3
- package/lib/mergeProp.js +1 -1
- package/lib/pathNotEq.js +4 -4
- package/lib/propNotEq.js +3 -3
- package/lib/reduceP.js +2 -2
- package/lib/reduceRightP.js +2 -2
- package/lib/renameKey.js +40 -0
- package/lib/seq.js +0 -1
- package/lib/sortByProps.js +1 -1
- package/lib/spreadProp.js +1 -1
- package/lib/toInteger32.js +1 -2
- package/lib/toUinteger32.js +1 -3
- package/package.json +38 -39
- package/src/concatAll.js +2 -1
- package/src/ensureArray.js +1 -1
- package/src/flattenProp.js +1 -1
- package/src/index.js +1 -0
- package/src/isFalse.js +2 -2
- package/src/isNegativeZero.js +2 -2
- package/src/isPositiveZero.js +2 -2
- package/src/isTrue.js +2 -2
- package/src/lensTraverse.js +18 -6
- package/src/mergeProp.js +1 -1
- package/src/pathNotEq.js +4 -4
- package/src/propNotEq.js +3 -3
- package/src/renameKey.js +33 -0
- package/src/spreadProp.js +1 -1
- package/types/index.d.ts +28 -0
- package/.nvmrc +0 -1
package/lib/mergeProp.js
CHANGED
|
@@ -29,7 +29,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
29
29
|
* ); //=> { outer: { foo: 3, bar: 4 } };
|
|
30
30
|
*/
|
|
31
31
|
var mergeProp = (0, _ramda.curry)(function (p, subj, obj) {
|
|
32
|
-
return (0, _mergePath["default"])((0, _ramda.of)(p), subj, obj);
|
|
32
|
+
return (0, _mergePath["default"])((0, _ramda.of)(Array, p), subj, obj);
|
|
33
33
|
});
|
|
34
34
|
var _default = mergeProp;
|
|
35
35
|
exports["default"] = _default;
|
package/lib/pathNotEq.js
CHANGED
|
@@ -12,10 +12,10 @@ var _ramda = require("ramda");
|
|
|
12
12
|
* @memberOf RA
|
|
13
13
|
* @since {@link https://char0n.github.io/ramda-adjunct/2.4.0|v2.4.0}
|
|
14
14
|
* @category Relation
|
|
15
|
-
* @sig [Idx] =>
|
|
16
|
-
* @sig Idx = String | Int
|
|
17
|
-
* @param {Array} path The path of the nested property to use
|
|
15
|
+
* @sig a => [Idx] => {a} => Boolean
|
|
16
|
+
* @sig Idx = String | Int | Symbol
|
|
18
17
|
* @param {a} val The value to compare the nested property with
|
|
18
|
+
* @param {Array} path The path of the nested property to use
|
|
19
19
|
* @param {Object} object The object to check the nested property in
|
|
20
20
|
* @return {boolean} Returns Boolean `false` if the value equals the nested object property, `true` otherwise
|
|
21
21
|
* @see {@link http://ramdajs.com/docs/#pathEq|R.pathEq}
|
|
@@ -25,7 +25,7 @@ var _ramda = require("ramda");
|
|
|
25
25
|
* const user2 = { address: { zipCode: 55555 } };
|
|
26
26
|
* const user3 = { name: 'Bob' };
|
|
27
27
|
* const users = [ user1, user2, user3 ];
|
|
28
|
-
* const isFamous =
|
|
28
|
+
* const isFamous = RA.pathNotEq(90210, ['address', 'zipCode']);
|
|
29
29
|
* R.filter(isFamous, users); //=> [ user2, user3 ]
|
|
30
30
|
*/
|
|
31
31
|
/* eslint-enable max-len */
|
package/lib/propNotEq.js
CHANGED
|
@@ -11,9 +11,9 @@ var _ramda = require("ramda");
|
|
|
11
11
|
* @memberOf RA
|
|
12
12
|
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
|
13
13
|
* @category Relation
|
|
14
|
-
* @sig
|
|
15
|
-
* @param {String} name The property to pick
|
|
14
|
+
* @sig a -> String -> Object -> Boolean
|
|
16
15
|
* @param {a} val The value to compare to
|
|
16
|
+
* @param {String} name The property to pick
|
|
17
17
|
* @param {Object} object The object, that presumably contains value under the property
|
|
18
18
|
* @return {boolean} Comparison result
|
|
19
19
|
* @see {@link http://ramdajs.com/docs/#propEq|R.propEq}
|
|
@@ -24,7 +24,7 @@ var _ramda = require("ramda");
|
|
|
24
24
|
* const rusty = { name: 'Rusty', age: 10, hair: 'brown' };
|
|
25
25
|
* const alois = { name: 'Alois', age: 15, disposition: 'surly' };
|
|
26
26
|
* const kids = [abby, fred, rusty, alois];
|
|
27
|
-
* const hasNotBrownHair = RA.propNotEq('
|
|
27
|
+
* const hasNotBrownHair = RA.propNotEq('brown', 'hair');
|
|
28
28
|
*
|
|
29
29
|
* R.filter(hasNotBrownHair, kids); //=> [abby, alois]
|
|
30
30
|
*/
|
package/lib/reduceP.js
CHANGED
|
@@ -10,8 +10,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
10
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
/* eslint-disable max-len */
|
|
17
17
|
/**
|
package/lib/reduceRightP.js
CHANGED
|
@@ -10,8 +10,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
10
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
// in older ramda versions the order of the arguments is flipped
|
|
17
17
|
var flipArgs = (0, _ramda.pipe)((0, _ramda.reduceRight)(_ramda.concat, ''), (0, _ramda.equals)('ba'))(['a', 'b']);
|
package/lib/renameKey.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
var _ramda = require("ramda");
|
|
6
|
+
var _renameKeys2 = _interopRequireDefault(require("./renameKeys"));
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new object with the own properties of the provided object, but a
|
|
14
|
+
* single key is renamed from `oldKey` to `newKey`.
|
|
15
|
+
*
|
|
16
|
+
* Keep in mind that in the case of keys conflict is behavior undefined and
|
|
17
|
+
* the result may vary between various JS engines!
|
|
18
|
+
*
|
|
19
|
+
* @func renameKey
|
|
20
|
+
* @memberOf RA
|
|
21
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/4.1.0|v4.1.0}
|
|
22
|
+
* @category Object
|
|
23
|
+
* @sig (String a, String b) => a -> b -> {a: *} -> {b: *}
|
|
24
|
+
* @param {!string} oldKey
|
|
25
|
+
* @param {!string} newKey
|
|
26
|
+
* @param {!Object} obj
|
|
27
|
+
* @return {!Object} New object with renamed key
|
|
28
|
+
* @see {@link https://github.com/ramda/ramda/wiki/Cookbook#rename-key-of-an-object|Ramda Cookbook}, {@link RA.renameKeyWith|renameKeyWith}
|
|
29
|
+
* @example
|
|
30
|
+
*
|
|
31
|
+
* const input = { firstName: 'Elisia', age: 22, type: 'human' };
|
|
32
|
+
*
|
|
33
|
+
* RA.renameKey('firstName', 'name')(input);
|
|
34
|
+
* //=> { name: 'Elisia', age: 22, type: 'human' }
|
|
35
|
+
*/
|
|
36
|
+
var renameKey = (0, _ramda.curry)(function (oldKey, newKey, obj) {
|
|
37
|
+
return (0, _renameKeys2["default"])(_defineProperty({}, oldKey, newKey), obj);
|
|
38
|
+
});
|
|
39
|
+
var _default = renameKey;
|
|
40
|
+
exports["default"] = _default;
|
package/lib/seq.js
CHANGED
package/lib/sortByProps.js
CHANGED
|
@@ -6,7 +6,7 @@ var _ramda = require("ramda");
|
|
|
6
6
|
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
7
7
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
8
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
10
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
/**
|
package/lib/spreadProp.js
CHANGED
|
@@ -24,7 +24,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
24
24
|
* RA.spreadProp('b', { a: 1, b: { c: 3, d: 4 } }); // => { a: 1, c: 3, d: 4 };
|
|
25
25
|
*/
|
|
26
26
|
var spreadProp = (0, _ramda.curry)(function (prop, obj) {
|
|
27
|
-
return (0, _spreadPath["default"])((0, _ramda.of)(prop), obj);
|
|
27
|
+
return (0, _spreadPath["default"])((0, _ramda.of)(Array, prop), obj);
|
|
28
28
|
});
|
|
29
29
|
var _default = spreadProp;
|
|
30
30
|
exports["default"] = _default;
|
package/lib/toInteger32.js
CHANGED
|
@@ -19,8 +19,7 @@ var _ramda = require("ramda");
|
|
|
19
19
|
*
|
|
20
20
|
* RA.toInteger32(2 ** 35); // => 0
|
|
21
21
|
* RA.toInteger32(2 ** 30); // => 1073741824
|
|
22
|
-
*/
|
|
23
|
-
// eslint-disable-next-line no-bitwise
|
|
22
|
+
*/ // eslint-disable-next-line no-bitwise
|
|
24
23
|
var toInteger32 = (0, _ramda.curryN)(1, function (val) {
|
|
25
24
|
return val >> 0;
|
|
26
25
|
});
|
package/lib/toUinteger32.js
CHANGED
|
@@ -21,9 +21,7 @@ var _ramda = require("ramda");
|
|
|
21
21
|
* RA.toInteger32(2 ** 35); // => 0
|
|
22
22
|
* RA.toInteger32(2 ** 31); // => 2147483648
|
|
23
23
|
* RA.toInteger32(2 ** 30); // => 1073741824
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
// eslint-disable-next-line no-bitwise
|
|
24
|
+
*/ // eslint-disable-next-line no-bitwise
|
|
27
25
|
var toUinteger32 = (0, _ramda.curryN)(1, function (val) {
|
|
28
26
|
return val >>> 0;
|
|
29
27
|
});
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"cookbook",
|
|
15
15
|
"functional"
|
|
16
16
|
],
|
|
17
|
-
"version": "
|
|
17
|
+
"version": "4.1.0",
|
|
18
18
|
"homepage": "https://github.com/char0n/ramda-adjunct",
|
|
19
19
|
"license": "BSD-3-Clause",
|
|
20
20
|
"repository": {
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
"test:web": "testem ci",
|
|
96
|
-
"test:ramda": "bnr test:ramda0.
|
|
97
|
-
"test:ramda0.
|
|
96
|
+
"test:ramda": "bnr test:ramda0.29.0",
|
|
97
|
+
"test:ramda0.29.0": "npm install ramda@0.29.0 && npm test",
|
|
98
98
|
"test:bundle-create": "webpack --config webpack.config-test.web.js --progress",
|
|
99
99
|
"test:bundle-clean": "rimraf tmp-test-bundle.js",
|
|
100
100
|
"coverage": {
|
|
@@ -121,64 +121,63 @@
|
|
|
121
121
|
"clean": "rimraf .nyc_output .tmp docs coverage tmp-test-bundle.js dist lib es"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
|
-
"ramda": ">= 0.
|
|
124
|
+
"ramda": ">= 0.29.0"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
|
-
"@babel/cli": "7.
|
|
128
|
-
"@babel/core": "=7.
|
|
129
|
-
"@babel/plugin-transform-modules-commonjs": "=7.
|
|
130
|
-
"@babel/preset-env": "=7.
|
|
131
|
-
"@babel/register": "7.
|
|
132
|
-
"@commitlint/cli": "=17.
|
|
133
|
-
"@commitlint/config-conventional": "=17.
|
|
134
|
-
"@typescript-eslint/eslint-plugin": "=
|
|
135
|
-
"@typescript-eslint/parser": "=
|
|
127
|
+
"@babel/cli": "7.22.10",
|
|
128
|
+
"@babel/core": "=7.22.10",
|
|
129
|
+
"@babel/plugin-transform-modules-commonjs": "=7.22.5",
|
|
130
|
+
"@babel/preset-env": "=7.22.10",
|
|
131
|
+
"@babel/register": "7.22.5",
|
|
132
|
+
"@commitlint/cli": "=17.7.1",
|
|
133
|
+
"@commitlint/config-conventional": "=17.7.0",
|
|
134
|
+
"@typescript-eslint/eslint-plugin": "=6.4.0",
|
|
135
|
+
"@typescript-eslint/parser": "=6.4.0",
|
|
136
136
|
"assert": "=2.0.0",
|
|
137
|
-
"babel-loader": "=9.1.
|
|
137
|
+
"babel-loader": "=9.1.3",
|
|
138
138
|
"babel-plugin-annotate-pure-calls": "0.4.0",
|
|
139
139
|
"babel-plugin-istanbul": "6.1.1",
|
|
140
140
|
"better-npm-run": "0.1.1",
|
|
141
141
|
"chai": "4.3.7",
|
|
142
142
|
"codecov": "3.8.3",
|
|
143
|
-
"conventional-changelog-cli": "
|
|
144
|
-
"core-js": "=3.
|
|
143
|
+
"conventional-changelog-cli": "3.0.0",
|
|
144
|
+
"core-js": "=3.32.0",
|
|
145
145
|
"docdash": "git+https://github.com/char0n/docdash.git#534b44382138a55dd8d93642c979e51e46471185",
|
|
146
|
-
"eslint": "=8.
|
|
146
|
+
"eslint": "=8.47.0",
|
|
147
147
|
"eslint-config-airbnb-base": "=15.0.0",
|
|
148
|
-
"eslint-config-prettier": "=
|
|
149
|
-
"eslint-plugin-dtslint": "=3.0.
|
|
150
|
-
"eslint-plugin-import": "=2.
|
|
148
|
+
"eslint-config-prettier": "=9.0.0",
|
|
149
|
+
"eslint-plugin-dtslint": "=3.0.2",
|
|
150
|
+
"eslint-plugin-import": "=2.28.0",
|
|
151
151
|
"eslint-plugin-mocha": "=10.1.0",
|
|
152
|
-
"eslint-plugin-prettier": "
|
|
152
|
+
"eslint-plugin-prettier": "5.0.0",
|
|
153
153
|
"eslint-plugin-ramda": "2.5.1",
|
|
154
|
-
"fantasy-land": "5.0.
|
|
154
|
+
"fantasy-land": "5.0.1",
|
|
155
155
|
"fantasy-laws": "=2.0.1",
|
|
156
156
|
"folktale": "=2.3.2",
|
|
157
|
-
"glob": "=
|
|
158
|
-
"husky": "8.0.
|
|
157
|
+
"glob": "=10.3.3",
|
|
158
|
+
"husky": "8.0.3",
|
|
159
159
|
"istanbul": "=0.4.5",
|
|
160
|
-
"jsdoc": "=4.0.
|
|
160
|
+
"jsdoc": "=4.0.2",
|
|
161
161
|
"jsverify": "0.8.4",
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"mocha": "
|
|
165
|
-
"mocha-junit-reporter": "2.2.0",
|
|
162
|
+
"lint-staged": "14.0.0",
|
|
163
|
+
"mocha": "=10.2.0",
|
|
164
|
+
"mocha-junit-reporter": "2.2.1",
|
|
166
165
|
"mocha-multi-reporters": "1.5.1",
|
|
167
166
|
"monet": "0.9.3",
|
|
168
167
|
"nyc": "15.1.0",
|
|
169
|
-
"prettier": "=
|
|
168
|
+
"prettier": "=3.0.2",
|
|
170
169
|
"process": "=0.11.10",
|
|
171
|
-
"ramda": "=0.
|
|
170
|
+
"ramda": "=0.29.0",
|
|
172
171
|
"ramda-fantasy": "=0.8.0",
|
|
173
|
-
"regenerator-runtime": "=0.
|
|
174
|
-
"rimraf": "
|
|
172
|
+
"regenerator-runtime": "=0.14.0",
|
|
173
|
+
"rimraf": "5.0.1",
|
|
175
174
|
"sanctuary-show": "3.0.0",
|
|
176
|
-
"sinon": "=15.
|
|
177
|
-
"terser-webpack-plugin": "5.3.
|
|
178
|
-
"testem": "=3.10.
|
|
179
|
-
"typescript": "=
|
|
180
|
-
"webpack": "=5.
|
|
181
|
-
"webpack-cli": "5.
|
|
175
|
+
"sinon": "=15.2.0",
|
|
176
|
+
"terser-webpack-plugin": "5.3.9",
|
|
177
|
+
"testem": "=3.10.1",
|
|
178
|
+
"typescript": "=5.1.6",
|
|
179
|
+
"webpack": "=5.88.2",
|
|
180
|
+
"webpack-cli": "5.1.4",
|
|
182
181
|
"taffydb": "npm:@jsdoc/salty@0.2.1"
|
|
183
182
|
},
|
|
184
183
|
"browserslist": "> 0.25%, ie 10, ie 11, not op_mini all",
|
package/src/concatAll.js
CHANGED
|
@@ -24,7 +24,8 @@ const leftIdentitySemigroup = { concat: identity };
|
|
|
24
24
|
*
|
|
25
25
|
* concatAll([[1], [2], [3]]); //=> [1, 2, 3]
|
|
26
26
|
* concatAll(['1', '2', '3']); //=> '123'
|
|
27
|
-
* concatAll([]); //=> undefined
|
|
27
|
+
* concatAll([]); //=> undefined
|
|
28
|
+
* concatAll(null); //=> undefined
|
|
28
29
|
*/
|
|
29
30
|
const concatAll = pipe(
|
|
30
31
|
reduce(concat, leftIdentitySemigroup),
|
package/src/ensureArray.js
CHANGED
package/src/flattenProp.js
CHANGED
|
@@ -23,6 +23,6 @@ import flattenPath from './flattenPath';
|
|
|
23
23
|
* { a: 1, b: { c: 3, d: 4 } }
|
|
24
24
|
* ); // => { a: 1, c: 3, d: 4, b: { c: 3, d: 4 } };
|
|
25
25
|
*/
|
|
26
|
-
const flattenProp = curry((prop, obj) => flattenPath(of(prop), obj));
|
|
26
|
+
const flattenProp = curry((prop, obj) => flattenPath(of(Array, prop), obj));
|
|
27
27
|
|
|
28
28
|
export default flattenProp;
|
package/src/index.js
CHANGED
|
@@ -170,6 +170,7 @@ export { default as findOr } from './findOr';
|
|
|
170
170
|
export { default as invoke } from './invoke';
|
|
171
171
|
export { default as invokeArgs } from './invokeArgs';
|
|
172
172
|
export { default as paths } from './paths';
|
|
173
|
+
export { default as renameKey } from './renameKey';
|
|
173
174
|
export { default as renameKeys } from './renameKeys';
|
|
174
175
|
export { default as renameKeysWith } from './renameKeysWith';
|
|
175
176
|
export { default as renameKeyWith } from './renameKeyWith';
|
package/src/isFalse.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { identical } from 'ramda';
|
|
1
|
+
import { identical, curryN } from 'ramda';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if input value is the Boolean primitive `false`. Will return false for all values created
|
|
@@ -26,6 +26,6 @@ import { identical } from 'ramda';
|
|
|
26
26
|
* RA.isFalse(new Boolean(false)); // => false
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
const isFalse = identical(false);
|
|
29
|
+
const isFalse = curryN(1, identical(false));
|
|
30
30
|
|
|
31
31
|
export default isFalse;
|
package/src/isNegativeZero.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { identical } from 'ramda';
|
|
1
|
+
import { identical, curryN } from 'ramda';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if value is a negative zero (-0).
|
|
@@ -18,6 +18,6 @@ import { identical } from 'ramda';
|
|
|
18
18
|
* RA.isNegativeZero(0); //=> false
|
|
19
19
|
* RA.isNegativeZero(null); //=> false
|
|
20
20
|
*/
|
|
21
|
-
const isNegativeZero = identical(-0);
|
|
21
|
+
const isNegativeZero = curryN(1, identical(-0));
|
|
22
22
|
|
|
23
23
|
export default isNegativeZero;
|
package/src/isPositiveZero.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { identical } from 'ramda';
|
|
1
|
+
import { identical, curryN } from 'ramda';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if value is a positive zero (+0).
|
|
@@ -18,6 +18,6 @@ import { identical } from 'ramda';
|
|
|
18
18
|
* RA.isPositiveZero(-0); //=> false
|
|
19
19
|
* RA.isPositiveZero(null); //=> false
|
|
20
20
|
*/
|
|
21
|
-
const isPositiveZero = identical(+0);
|
|
21
|
+
const isPositiveZero = curryN(1, identical(+0));
|
|
22
22
|
|
|
23
23
|
export default isPositiveZero;
|
package/src/isTrue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { identical } from 'ramda';
|
|
1
|
+
import { identical, curryN } from 'ramda';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if input value is the Boolean primitive `true`. Will return false for Boolean objects
|
|
@@ -22,6 +22,6 @@ import { identical } from 'ramda';
|
|
|
22
22
|
* RA.isTrue(new Boolean(true)); // => false
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const isTrue = identical(true);
|
|
25
|
+
const isTrue = curryN(1, identical(true));
|
|
26
26
|
|
|
27
27
|
export default isTrue;
|
package/src/lensTraverse.js
CHANGED
|
@@ -18,8 +18,10 @@ import Identity from './fantasy-land/Identity';
|
|
|
18
18
|
* @since {@link https://char0n.github.io/ramda-adjunct/2.7.0|2.7.0}
|
|
19
19
|
* @category Relation
|
|
20
20
|
* @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
21
|
+
* @sig fantasy-land/of :: TypeRep f => f ~> a → f a
|
|
21
22
|
* @sig Applicative f => (a -> f a) -> Lens s a
|
|
22
|
-
* @
|
|
23
|
+
* @sig Applicative f => TypeRep f -> Lens s a
|
|
24
|
+
* @param {!Object|!Function} TypeRepresentative with an `of` or `fantasy-land/of` method
|
|
23
25
|
* @return {!function} The Traversable lens
|
|
24
26
|
* @see {@link http://ramdajs.com/docs/#lens|R.lens}, {@link http://ramdajs.com/docs/#traverse|R.traverse}
|
|
25
27
|
*
|
|
@@ -35,10 +37,20 @@ import Identity from './fantasy-land/Identity';
|
|
|
35
37
|
*
|
|
36
38
|
* R.set(maybeLens, Maybe.Just(1), [Maybe.just(2), Maybe.Just(3)]); // => Maybe.Just([1, 1])
|
|
37
39
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
/* eslint-disable no-nested-ternary */
|
|
41
|
+
const lensTraverse = curryN(1, (F) => {
|
|
42
|
+
const of =
|
|
43
|
+
typeof F['fantasy-land/of'] === 'function'
|
|
44
|
+
? F['fantasy-land/of']
|
|
45
|
+
: typeof F.of === 'function'
|
|
46
|
+
? F.of
|
|
47
|
+
: F;
|
|
48
|
+
const TypeRep = { 'fantasy-land/of': of };
|
|
49
|
+
|
|
50
|
+
return curry((toFunctorFn, target) =>
|
|
51
|
+
Identity.of(traverse(TypeRep, pipe(toFunctorFn, prop('value')), target))
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
/* eslint-enable */
|
|
43
55
|
|
|
44
56
|
export default lensTraverse;
|
package/src/mergeProp.js
CHANGED
|
@@ -25,6 +25,6 @@ import mergePath from './mergePath';
|
|
|
25
25
|
* { outer: { foo: 2 } }
|
|
26
26
|
* ); //=> { outer: { foo: 3, bar: 4 } };
|
|
27
27
|
*/
|
|
28
|
-
const mergeProp = curry((p, subj, obj) => mergePath(of(p), subj, obj));
|
|
28
|
+
const mergeProp = curry((p, subj, obj) => mergePath(of(Array, p), subj, obj));
|
|
29
29
|
|
|
30
30
|
export default mergeProp;
|
package/src/pathNotEq.js
CHANGED
|
@@ -9,10 +9,10 @@ import { pathEq, complement } from 'ramda';
|
|
|
9
9
|
* @memberOf RA
|
|
10
10
|
* @since {@link https://char0n.github.io/ramda-adjunct/2.4.0|v2.4.0}
|
|
11
11
|
* @category Relation
|
|
12
|
-
* @sig [Idx] =>
|
|
13
|
-
* @sig Idx = String | Int
|
|
14
|
-
* @param {Array} path The path of the nested property to use
|
|
12
|
+
* @sig a => [Idx] => {a} => Boolean
|
|
13
|
+
* @sig Idx = String | Int | Symbol
|
|
15
14
|
* @param {a} val The value to compare the nested property with
|
|
15
|
+
* @param {Array} path The path of the nested property to use
|
|
16
16
|
* @param {Object} object The object to check the nested property in
|
|
17
17
|
* @return {boolean} Returns Boolean `false` if the value equals the nested object property, `true` otherwise
|
|
18
18
|
* @see {@link http://ramdajs.com/docs/#pathEq|R.pathEq}
|
|
@@ -22,7 +22,7 @@ import { pathEq, complement } from 'ramda';
|
|
|
22
22
|
* const user2 = { address: { zipCode: 55555 } };
|
|
23
23
|
* const user3 = { name: 'Bob' };
|
|
24
24
|
* const users = [ user1, user2, user3 ];
|
|
25
|
-
* const isFamous =
|
|
25
|
+
* const isFamous = RA.pathNotEq(90210, ['address', 'zipCode']);
|
|
26
26
|
* R.filter(isFamous, users); //=> [ user2, user3 ]
|
|
27
27
|
*/
|
|
28
28
|
/* eslint-enable max-len */
|
package/src/propNotEq.js
CHANGED
|
@@ -8,9 +8,9 @@ import { propEq, complement } from 'ramda';
|
|
|
8
8
|
* @memberOf RA
|
|
9
9
|
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
|
10
10
|
* @category Relation
|
|
11
|
-
* @sig
|
|
12
|
-
* @param {String} name The property to pick
|
|
11
|
+
* @sig a -> String -> Object -> Boolean
|
|
13
12
|
* @param {a} val The value to compare to
|
|
13
|
+
* @param {String} name The property to pick
|
|
14
14
|
* @param {Object} object The object, that presumably contains value under the property
|
|
15
15
|
* @return {boolean} Comparison result
|
|
16
16
|
* @see {@link http://ramdajs.com/docs/#propEq|R.propEq}
|
|
@@ -21,7 +21,7 @@ import { propEq, complement } from 'ramda';
|
|
|
21
21
|
* const rusty = { name: 'Rusty', age: 10, hair: 'brown' };
|
|
22
22
|
* const alois = { name: 'Alois', age: 15, disposition: 'surly' };
|
|
23
23
|
* const kids = [abby, fred, rusty, alois];
|
|
24
|
-
* const hasNotBrownHair = RA.propNotEq('
|
|
24
|
+
* const hasNotBrownHair = RA.propNotEq('brown', 'hair');
|
|
25
25
|
*
|
|
26
26
|
* R.filter(hasNotBrownHair, kids); //=> [abby, alois]
|
|
27
27
|
*/
|
package/src/renameKey.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { curry } from 'ramda';
|
|
2
|
+
|
|
3
|
+
import renameKeys from './renameKeys';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new object with the own properties of the provided object, but a
|
|
7
|
+
* single key is renamed from `oldKey` to `newKey`.
|
|
8
|
+
*
|
|
9
|
+
* Keep in mind that in the case of keys conflict is behavior undefined and
|
|
10
|
+
* the result may vary between various JS engines!
|
|
11
|
+
*
|
|
12
|
+
* @func renameKey
|
|
13
|
+
* @memberOf RA
|
|
14
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/4.1.0|v4.1.0}
|
|
15
|
+
* @category Object
|
|
16
|
+
* @sig (String a, String b) => a -> b -> {a: *} -> {b: *}
|
|
17
|
+
* @param {!string} oldKey
|
|
18
|
+
* @param {!string} newKey
|
|
19
|
+
* @param {!Object} obj
|
|
20
|
+
* @return {!Object} New object with renamed key
|
|
21
|
+
* @see {@link https://github.com/ramda/ramda/wiki/Cookbook#rename-key-of-an-object|Ramda Cookbook}, {@link RA.renameKeyWith|renameKeyWith}
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* const input = { firstName: 'Elisia', age: 22, type: 'human' };
|
|
25
|
+
*
|
|
26
|
+
* RA.renameKey('firstName', 'name')(input);
|
|
27
|
+
* //=> { name: 'Elisia', age: 22, type: 'human' }
|
|
28
|
+
*/
|
|
29
|
+
const renameKey = curry((oldKey, newKey, obj) =>
|
|
30
|
+
renameKeys({ [oldKey]: newKey }, obj)
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export default renameKey;
|
package/src/spreadProp.js
CHANGED
|
@@ -20,6 +20,6 @@ import spreadPath from './spreadPath';
|
|
|
20
20
|
*
|
|
21
21
|
* RA.spreadProp('b', { a: 1, b: { c: 3, d: 4 } }); // => { a: 1, c: 3, d: 4 };
|
|
22
22
|
*/
|
|
23
|
-
const spreadProp = curry((prop, obj) => spreadPath(of(prop), obj));
|
|
23
|
+
const spreadProp = curry((prop, obj) => spreadPath(of(Array, prop), obj));
|
|
24
24
|
|
|
25
25
|
export default spreadProp;
|
package/types/index.d.ts
CHANGED
|
@@ -622,6 +622,34 @@ export function renameKeys<MAP extends Dictionary<string>>(
|
|
|
622
622
|
obj: OBJ
|
|
623
623
|
) => PickRenameMulti<MAP, OBJ>;
|
|
624
624
|
|
|
625
|
+
|
|
626
|
+
type Keyable = string | number | symbol
|
|
627
|
+
type RenameObjectKey<
|
|
628
|
+
OKey extends keyof OBJ,
|
|
629
|
+
OBJ extends { readonly [s in OKey]: any },
|
|
630
|
+
NKey extends Keyable,
|
|
631
|
+
> = Omit<OBJ, OKey> & Record<NKey, OBJ[OKey]>
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Creates a new object with the own properties of the provided object, but a
|
|
635
|
+
* single key is renamed from `oldKey` to `newKey`.
|
|
636
|
+
*/
|
|
637
|
+
function renameKey<
|
|
638
|
+
OKey extends Keyable,
|
|
639
|
+
>(oldKey: OKey):
|
|
640
|
+
<NKey extends Keyable>(newKey: NKey) =>
|
|
641
|
+
<OBJ extends { readonly [s in OKey]: any }>(obj: OBJ) => RenameObjectKey<OKey, OBJ, NKey>;
|
|
642
|
+
function renameKey<
|
|
643
|
+
OKey extends Keyable,
|
|
644
|
+
NKey extends Keyable,
|
|
645
|
+
>(oldKey: OKey, newKey: NKey):
|
|
646
|
+
<OBJ extends { readonly [s in OKey]: any }>(obj: OBJ) => RenameObjectKey<OKey, OBJ, NKey>;
|
|
647
|
+
function renameKey<
|
|
648
|
+
OKey extends keyof OBJ,
|
|
649
|
+
OBJ extends { readonly [s in OKey]: any },
|
|
650
|
+
NKey extends Keyable,
|
|
651
|
+
>(oldKey: OKey, newKey: NKey, obj: OBJ): RenameObjectKey<OKey, OBJ, NKey>
|
|
652
|
+
|
|
625
653
|
/**
|
|
626
654
|
* Creates a new object with the own properties of the provided object, and the
|
|
627
655
|
* keys copied according to the keysMap object as `{oldKey: newKey}`.
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
18
|