ramda-adjunct 5.1.0 → 6.0.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 +10 -1
- package/README.md +2 -2
- package/dist/RA.node.js +5644 -5736
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +5650 -5742
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +11760 -11501
- package/dist/RA.web.standalone.min.js +1 -1
- package/es/copyKeys.js +2 -3
- package/es/index.js +0 -1
- package/es/internal/ap.js +1 -1
- package/es/internal/ponyfills/Math.trunc.js +0 -2
- package/es/internal/ponyfills/Number.isFinite.js +0 -2
- package/es/internal/ponyfills/Number.isNaN.js +0 -2
- package/es/internal/ponyfills/Promise.any.js +1 -1
- package/es/internal/ponyfills/String.padEnd.js +0 -1
- package/es/internal/ponyfills/String.padStart.js +0 -1
- package/es/internal/ponyfills/String.repeat.js +1 -1
- package/es/isArrayLike.js +1 -2
- package/es/isMap.js +3 -3
- package/es/isNotAsyncFunction.js +1 -2
- package/es/isNotFunction.js +1 -2
- package/es/isNotGeneratorFunction.js +1 -2
- package/es/isNotObj.js +1 -2
- package/es/isNotObjLike.js +1 -2
- package/es/isNotPlainObj.js +1 -2
- package/es/isObj.js +1 -2
- package/es/isObjLike.js +1 -2
- package/es/isPlainObj.js +1 -2
- package/es/isSentinelValue.js +1 -1
- package/es/isValidDate.js +1 -2
- package/es/lensTraverse.js +1 -3
- package/es/mergeProp.js +2 -2
- package/es/nand.js +1 -2
- package/es/neither.js +1 -2
- package/es/nor.js +1 -2
- package/es/notBoth.js +1 -2
- package/es/omitBy.js +1 -2
- package/es/pathNotEq.js +1 -2
- package/es/reduceP.js +0 -1
- package/es/reduceRightP.js +0 -1
- package/es/renameKey.js +1 -2
- package/es/resolveP.js +1 -2
- package/es/seq.js +0 -2
- package/es/sortByProps.js +1 -1
- package/es/stubUndefined.js +1 -2
- package/es/toInteger32.js +1 -1
- package/es/toUinteger32.js +0 -1
- package/lib/anyP.js +1 -2
- package/lib/copyKeys.js +2 -4
- package/lib/fantasy-land/Identity.js +1 -2
- package/lib/fantasy-land/traits.js +1 -2
- package/lib/index.js +2 -4
- package/lib/internal/ap.js +2 -3
- package/lib/internal/ponyfills/Math.trunc.js +0 -2
- package/lib/internal/ponyfills/Number.isFinite.js +0 -1
- package/lib/internal/ponyfills/Number.isNaN.js +0 -1
- package/lib/internal/ponyfills/Promise.any.js +1 -1
- package/lib/internal/ponyfills/String.padEnd.js +0 -1
- package/lib/internal/ponyfills/String.padStart.js +0 -1
- package/lib/internal/ponyfills/String.repeat.js +1 -1
- package/lib/isArrayLike.js +1 -2
- package/lib/isMap.js +3 -3
- package/lib/isNotAsyncFunction.js +1 -2
- package/lib/isNotFunction.js +1 -2
- package/lib/isNotGeneratorFunction.js +1 -2
- package/lib/isNotObj.js +1 -2
- package/lib/isNotObjLike.js +1 -2
- package/lib/isNotPlainObj.js +1 -2
- package/lib/isObj.js +1 -2
- package/lib/isObjLike.js +1 -2
- package/lib/isPlainObj.js +1 -2
- package/lib/isSentinelValue.js +1 -1
- package/lib/isValidDate.js +1 -2
- package/lib/lensTraverse.js +1 -2
- package/lib/mergeProp.js +2 -2
- package/lib/nand.js +1 -1
- package/lib/neither.js +1 -2
- package/lib/nor.js +1 -1
- package/lib/notBoth.js +1 -2
- package/lib/omitBy.js +1 -2
- package/lib/pathNotEq.js +1 -2
- package/lib/reduceP.js +0 -1
- package/lib/reduceRightP.js +0 -1
- package/lib/renameKey.js +1 -3
- package/lib/resolveP.js +1 -2
- package/lib/seq.js +0 -2
- package/lib/sortByProps.js +1 -1
- package/lib/stubUndefined.js +1 -1
- package/lib/toInteger32.js +1 -1
- package/lib/toUinteger32.js +0 -1
- package/package.json +63 -86
- package/types/index.d.ts +12 -21
- package/es/renameKeys.js +0 -39
- package/lib/renameKeys.js +0 -44
package/lib/isObjLike.js
CHANGED
|
@@ -6,7 +6,6 @@ var _ramda = require("ramda");
|
|
|
6
6
|
var _isNotNull = _interopRequireDefault(require("./isNotNull.js"));
|
|
7
7
|
var _isOfTypeObject = _interopRequireDefault(require("./internal/isOfTypeObject.js"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
-
/* eslint-disable max-len */
|
|
10
9
|
/**
|
|
11
10
|
* Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".
|
|
12
11
|
*
|
|
@@ -27,6 +26,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
27
26
|
* RA.isObjLike(null); //=> false
|
|
28
27
|
* RA.isObjLike(undefined); //=> false
|
|
29
28
|
*/
|
|
30
|
-
|
|
29
|
+
|
|
31
30
|
var isObjLike = (0, _ramda.curryN)(1, (0, _ramda.both)(_isNotNull["default"], _isOfTypeObject["default"]));
|
|
32
31
|
var _default = exports["default"] = isObjLike;
|
package/lib/isPlainObj.js
CHANGED
|
@@ -11,7 +11,6 @@ var isObject = (0, _ramda.pipe)(_ramda.type, (0, _ramda.identical)('Object'));
|
|
|
11
11
|
var isObjectConstructor = (0, _ramda.pipe)(_ramda.toString, (0, _ramda.equals)((0, _ramda.toString)(Object)));
|
|
12
12
|
var hasObjectConstructor = (0, _ramda.pathSatisfies)((0, _ramda.both)(_isFunction["default"], isObjectConstructor), ['constructor']);
|
|
13
13
|
|
|
14
|
-
/* eslint-disable max-len */
|
|
15
14
|
/**
|
|
16
15
|
* Check to see if an object is a plain object (created using `{}`, `new Object()` or `Object.create(null)`).
|
|
17
16
|
*
|
|
@@ -38,7 +37,7 @@ var hasObjectConstructor = (0, _ramda.pathSatisfies)((0, _ramda.both)(_isFunctio
|
|
|
38
37
|
* RA.isPlainObj(Object.create(null); //=> true
|
|
39
38
|
* RA.isPlainObj(new Object()); //=> true
|
|
40
39
|
*/
|
|
41
|
-
|
|
40
|
+
|
|
42
41
|
var isPlainObj = (0, _ramda.curryN)(1, function (val) {
|
|
43
42
|
if (!(0, _isObjLike["default"])(val) || !isObject(val)) {
|
|
44
43
|
return false;
|
package/lib/isSentinelValue.js
CHANGED
|
@@ -23,7 +23,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
23
23
|
* RA.isSentinelValue(1); //=> false
|
|
24
24
|
* RA.isSentinelValue([-1]); //=> false
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
var isSentinelValue = (0, _ramda.curryN)(1, function (val) {
|
|
28
28
|
return (0, _isInteger["default"])(val) && ~val === 0;
|
|
29
29
|
});
|
package/lib/isValidDate.js
CHANGED
|
@@ -6,7 +6,6 @@ var _ramda = require("ramda");
|
|
|
6
6
|
var _isDate = _interopRequireDefault(require("./isDate.js"));
|
|
7
7
|
var _isNotNaN = _interopRequireDefault(require("./isNotNaN.js"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
-
/* eslint-disable max-len */
|
|
10
9
|
/**
|
|
11
10
|
* Checks if value is valid `Date` object.
|
|
12
11
|
*
|
|
@@ -23,6 +22,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
23
22
|
* RA.isValidDate(new Date()); //=> true
|
|
24
23
|
* RA.isValidDate(new Date('a')); //=> false
|
|
25
24
|
*/
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
var isValidDate = (0, _ramda.curryN)(1, (0, _ramda.both)(_isDate["default"], (0, _ramda.pipe)((0, _ramda.invoker)(0, 'getTime'), _isNotNaN["default"])));
|
|
28
27
|
var _default = exports["default"] = isValidDate;
|
package/lib/lensTraverse.js
CHANGED
|
@@ -40,7 +40,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
40
40
|
*
|
|
41
41
|
* R.set(maybeLens, Maybe.Just(1), [Maybe.just(2), Maybe.Just(3)]); // => Maybe.Just([1, 1])
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
var lensTraverse = (0, _ramda.curryN)(1, function (F) {
|
|
45
45
|
var of = typeof F['fantasy-land/of'] === 'function' ? F['fantasy-land/of'] : typeof F.of === 'function' ? F.of : F;
|
|
46
46
|
var TypeRep = {
|
|
@@ -50,5 +50,4 @@ var lensTraverse = (0, _ramda.curryN)(1, function (F) {
|
|
|
50
50
|
return _Identity["default"].of((0, _ramda.traverse)(TypeRep, (0, _ramda.pipe)(toFunctorFn, (0, _ramda.prop)('value')), target));
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
|
-
/* eslint-enable */
|
|
54
53
|
var _default = exports["default"] = lensTraverse;
|
package/lib/mergeProp.js
CHANGED
|
@@ -14,9 +14,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
14
14
|
* @memberOf RA
|
|
15
15
|
* @since {@link https://char0n.github.io/ramda-adjunct/1.18.0|v1.18.0}
|
|
16
16
|
* @category Object
|
|
17
|
-
* @sig
|
|
17
|
+
* @sig k -> {a} -> {k: {a}} -> {k: {a}}
|
|
18
18
|
* @see {@link RA.mergePath|mergePath}
|
|
19
|
-
* @param {!
|
|
19
|
+
* @param {!string} p The property of the destination object
|
|
20
20
|
* @param {!Object} source The source object
|
|
21
21
|
* @param {!Object} obj The object that has destination object under corresponding property
|
|
22
22
|
* @return {!Object} The new version of object
|
package/lib/nand.js
CHANGED
|
@@ -25,5 +25,5 @@ var _ramda = require("ramda");
|
|
|
25
25
|
* RA.nand(0, 1.0); //=> true
|
|
26
26
|
* RA.nand(0, 0); //=> true
|
|
27
27
|
*/
|
|
28
|
-
var nand = (0, _ramda.complement)(_ramda.and);
|
|
28
|
+
var nand = (0, _ramda.complement)(_ramda.and);
|
|
29
29
|
var _default = exports["default"] = nand;
|
package/lib/neither.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
/**
|
|
8
7
|
* A function which calls the two provided functions and returns the complement of `||`ing the
|
|
9
8
|
* results.
|
|
@@ -35,6 +34,6 @@ var _ramda = require("ramda");
|
|
|
35
34
|
* f(11); //=> false
|
|
36
35
|
* f(9); //=> true
|
|
37
36
|
*/
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
var neither = (0, _ramda.curry)((0, _ramda.compose)(_ramda.complement, _ramda.either));
|
|
40
39
|
var _default = exports["default"] = neither;
|
package/lib/nor.js
CHANGED
|
@@ -26,5 +26,5 @@ var _ramda = require("ramda");
|
|
|
26
26
|
* RA.nor(0, 1); //=> false
|
|
27
27
|
* RA.nor(0, 0); //=> true
|
|
28
28
|
*/
|
|
29
|
-
var nor = (0, _ramda.complement)(_ramda.or);
|
|
29
|
+
var nor = (0, _ramda.complement)(_ramda.or);
|
|
30
30
|
var _default = exports["default"] = nor;
|
package/lib/notBoth.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
/**
|
|
8
7
|
* A function which calls the two provided functions and returns the complement of `&&`ing the
|
|
9
8
|
* results.
|
|
@@ -35,6 +34,6 @@ var _ramda = require("ramda");
|
|
|
35
34
|
* f(11); //=> true
|
|
36
35
|
* f(9); //=> true
|
|
37
36
|
*/
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
var notBoth = (0, _ramda.curry)((0, _ramda.compose)(_ramda.complement, _ramda.both));
|
|
40
39
|
var _default = exports["default"] = notBoth;
|
package/lib/omitBy.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
/**
|
|
8
7
|
* Returns a partial copy of an object containing only the keys
|
|
9
8
|
* that don't satisfy the supplied predicate.
|
|
@@ -22,6 +21,6 @@ var _ramda = require("ramda");
|
|
|
22
21
|
* const isLowerCase = (val, key) => key.toLowerCase() === key;
|
|
23
22
|
* RA.omitBy(isLowerCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}
|
|
24
23
|
*/
|
|
25
|
-
|
|
24
|
+
|
|
26
25
|
var omitBy = (0, _ramda.useWith)(_ramda.pickBy, [_ramda.complement, _ramda.identity]);
|
|
27
26
|
var _default = exports["default"] = omitBy;
|
package/lib/pathNotEq.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
/**
|
|
8
7
|
* Determines whether a nested path on an object doesn't have a specific value,
|
|
9
8
|
* in R.equals terms. Most likely used to filter a list.
|
|
@@ -28,6 +27,6 @@ var _ramda = require("ramda");
|
|
|
28
27
|
* const isFamous = RA.pathNotEq(90210, ['address', 'zipCode']);
|
|
29
28
|
* R.filter(isFamous, users); //=> [ user2, user3 ]
|
|
30
29
|
*/
|
|
31
|
-
|
|
30
|
+
|
|
32
31
|
var pathNotEq = (0, _ramda.complement)(_ramda.pathEq);
|
|
33
32
|
var _default = exports["default"] = pathNotEq;
|
package/lib/reduceP.js
CHANGED
|
@@ -13,7 +13,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
13
13
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
14
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
15
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
-
/* eslint-disable max-len */
|
|
17
16
|
/**
|
|
18
17
|
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
|
|
19
18
|
* which produces promises (or a mix of promises and values),
|
package/lib/reduceRightP.js
CHANGED
|
@@ -16,7 +16,6 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
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']);
|
|
18
18
|
|
|
19
|
-
/* eslint-disable max-len */
|
|
20
19
|
/**
|
|
21
20
|
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
|
|
22
21
|
* which produces promises (or a mix of promises and values),
|
package/lib/renameKey.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
|
-
var _renameKeys2 = _interopRequireDefault(require("./renameKeys.js"));
|
|
7
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
8
6
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
7
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
@@ -34,6 +32,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
34
32
|
* //=> { name: 'Elisia', age: 22, type: 'human' }
|
|
35
33
|
*/
|
|
36
34
|
var renameKey = (0, _ramda.curry)(function (oldKey, newKey, obj) {
|
|
37
|
-
return (0,
|
|
35
|
+
return (0, _ramda.renameKeys)(_defineProperty({}, oldKey, newKey), obj);
|
|
38
36
|
});
|
|
39
37
|
var _default = exports["default"] = renameKey;
|
package/lib/resolveP.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
/**
|
|
8
7
|
* Composable shortcut for `Promise.resolve`.
|
|
9
8
|
*
|
|
@@ -25,6 +24,6 @@ var _ramda = require("ramda");
|
|
|
25
24
|
* RA.resolveP('a'); //=> Promise('a')
|
|
26
25
|
* RA.resolveP([1, 2, 3]); //=> Promise([1, 2, 3])
|
|
27
26
|
*/
|
|
28
|
-
|
|
27
|
+
|
|
29
28
|
var resolveP = (0, _ramda.bind)(Promise.resolve, Promise);
|
|
30
29
|
var _default = exports["default"] = resolveP;
|
package/lib/seq.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
/**
|
|
8
7
|
* Runs the given list of functions in order with the supplied object, then returns the object.
|
|
9
8
|
* Also known as the normal order sequencing combinator.
|
|
@@ -34,7 +33,6 @@ var _ramda = require("ramda");
|
|
|
34
33
|
* R.toUpper
|
|
35
34
|
* )('test'); //=> 'PREFIX TEST'
|
|
36
35
|
*/
|
|
37
|
-
/* eslint-enable max-len */
|
|
38
36
|
|
|
39
37
|
var seq = (0, _ramda.curry)(function (fns, x) {
|
|
40
38
|
return (0, _ramda.tap)(function (tx) {
|
package/lib/sortByProps.js
CHANGED
|
@@ -34,7 +34,7 @@ var sortByProps = (0, _ramda.curry)(function (props, list) {
|
|
|
34
34
|
var firstTruthy = function firstTruthy(_ref) {
|
|
35
35
|
var _ref2 = _toArray(_ref),
|
|
36
36
|
head = _ref2[0],
|
|
37
|
-
tail = _ref2.slice(1);
|
|
37
|
+
tail = _arrayLikeToArray(_ref2).slice(1);
|
|
38
38
|
return (0, _ramda.reduce)(_ramda.either, head, tail);
|
|
39
39
|
};
|
|
40
40
|
var makeComparator = function makeComparator(propName) {
|
package/lib/stubUndefined.js
CHANGED
|
@@ -17,5 +17,5 @@ var _ramda = require("ramda");
|
|
|
17
17
|
* RA.stubUndefined(); //=> undefined
|
|
18
18
|
* RA.stubUndefined(1, 2, 3); //=> undefined
|
|
19
19
|
*/
|
|
20
|
-
var stubUndefined = (0, _ramda.always)(void 0);
|
|
20
|
+
var stubUndefined = (0, _ramda.always)(void 0);
|
|
21
21
|
var _default = exports["default"] = stubUndefined;
|
package/lib/toInteger32.js
CHANGED
package/lib/toUinteger32.js
CHANGED
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"cookbook",
|
|
15
15
|
"functional"
|
|
16
16
|
],
|
|
17
|
-
"version": "
|
|
17
|
+
"version": "6.0.0",
|
|
18
18
|
"homepage": "https://github.com/char0n/ramda-adjunct",
|
|
19
19
|
"license": "BSD-3-Clause",
|
|
20
20
|
"repository": {
|
|
@@ -76,117 +76,94 @@
|
|
|
76
76
|
"./dist/*": "./dist/*"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
|
-
"docs": "better-npm-run docs",
|
|
80
|
-
"lint": "better-npm-run lint",
|
|
81
|
-
"lint:fix": "better-npm-run lint:fix",
|
|
82
|
-
"changelog": "better-npm-run changelog",
|
|
83
|
-
"test": "mocha",
|
|
84
|
-
"test:web": "better-npm-run test:web",
|
|
85
|
-
"test:ramda": "bnr test:ramda",
|
|
86
|
-
"test:types": "eslint --no-eslintrc --no-ignore -c ./types/dtslint.eslint.cjs ./types/test/*.ts",
|
|
87
|
-
"test:bundle-create": "better-npm-run test:bundle-create",
|
|
88
|
-
"test:bundle-clean": "better-npm-run test:bundle-clean",
|
|
89
|
-
"coverage": "better-npm-run coverage",
|
|
90
|
-
"build": "better-npm-run build",
|
|
91
|
-
"build:es": "better-npm-run build:es",
|
|
92
|
-
"build:commonjs": "better-npm-run build:commonjs",
|
|
93
|
-
"build:umd": "better-npm-run build:umd",
|
|
94
|
-
"prepublishOnly": "better-npm-run prepublishOnly",
|
|
95
|
-
"clean": "better-npm-run clean",
|
|
96
|
-
"prepare": "husky"
|
|
97
|
-
},
|
|
98
|
-
"betterScripts": {
|
|
99
79
|
"docs": "jsdoc -c jsdoc.json && node ./scripts/jsdoc-inject-dist.cjs",
|
|
100
|
-
"lint": "eslint
|
|
101
|
-
"lint:fix": "eslint --fix
|
|
80
|
+
"lint": "eslint .",
|
|
81
|
+
"lint:fix": "eslint --fix .",
|
|
102
82
|
"changelog": "conventional-changelog -p angular -i ./CHANGELOG.md -s",
|
|
83
|
+
"test": "mocha",
|
|
103
84
|
"test:web": "testem ci",
|
|
104
|
-
"test:ramda": "
|
|
105
|
-
"test:
|
|
85
|
+
"test:ramda": "npm i --no-save ramda@0.32.0 && npm test",
|
|
86
|
+
"test:types": "tsd",
|
|
106
87
|
"test:bundle-create": "webpack --config webpack.config-test.web.cjs --progress",
|
|
107
88
|
"test:bundle-clean": "rimraf tmp-test-bundle.js",
|
|
108
|
-
"coverage":
|
|
109
|
-
"command": "nyc mocha",
|
|
110
|
-
"env": {
|
|
111
|
-
"BABEL_ENV": "coverage"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
89
|
+
"coverage": "c8 mocha",
|
|
114
90
|
"build": "npm run build:es && npm run build:commonjs && npm run build:umd",
|
|
115
|
-
"build:es":
|
|
116
|
-
|
|
117
|
-
"env": {
|
|
118
|
-
"BABEL_ENV": "es"
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"build:commonjs": {
|
|
122
|
-
"command": "babel src --out-dir lib && echo '{\"type\": \"commonjs\"}' > ./lib/package.json",
|
|
123
|
-
"env": {
|
|
124
|
-
"BABEL_ENV": "commonjs"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
91
|
+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
|
|
92
|
+
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib && echo '{\"type\": \"commonjs\"}' > ./lib/package.json",
|
|
127
93
|
"build:umd": "webpack --config webpack.config.cjs --progress && echo '{\"type\": \"commonjs\"}' > ./dist/package.json",
|
|
128
94
|
"prepublishOnly": "npm run clean && npm run lint && npm run test && npm run build && npm run docs",
|
|
129
|
-
"clean": "rimraf .nyc_output .tmp docs coverage tmp-test-bundle.js dist lib es"
|
|
95
|
+
"clean": "rimraf .nyc_output .tmp docs coverage tmp-test-bundle.js dist lib es",
|
|
96
|
+
"prepare": "husky"
|
|
130
97
|
},
|
|
131
98
|
"peerDependencies": {
|
|
132
|
-
"ramda": ">= 0.
|
|
99
|
+
"ramda": ">= 0.32.0"
|
|
133
100
|
},
|
|
134
101
|
"devDependencies": {
|
|
135
|
-
"@babel/cli": "7.
|
|
136
|
-
"@babel/core": "=7.
|
|
137
|
-
"@babel/plugin-transform-modules-commonjs": "=7.
|
|
138
|
-
"@babel/preset-env": "=7.
|
|
139
|
-
"@babel/register": "7.
|
|
140
|
-
"@commitlint/cli": "=
|
|
141
|
-
"@commitlint/config-conventional": "=
|
|
142
|
-
"@
|
|
143
|
-
"@typescript-eslint/
|
|
102
|
+
"@babel/cli": "7.28.3",
|
|
103
|
+
"@babel/core": "=7.28.5",
|
|
104
|
+
"@babel/plugin-transform-modules-commonjs": "=7.27.1",
|
|
105
|
+
"@babel/preset-env": "=7.28.5",
|
|
106
|
+
"@babel/register": "7.28.3",
|
|
107
|
+
"@commitlint/cli": "=20.2.0",
|
|
108
|
+
"@commitlint/config-conventional": "=20.2.0",
|
|
109
|
+
"@eslint/js": "^9.39.1",
|
|
110
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
111
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
144
112
|
"assert": "=2.1.0",
|
|
145
|
-
"babel-loader": "=
|
|
146
|
-
"babel-plugin-annotate-pure-calls": "0.
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"chai": "5.1.1",
|
|
150
|
-
"codecov": "3.8.3",
|
|
151
|
-
"core-js": "=3.38.0",
|
|
113
|
+
"babel-loader": "=10.0.0",
|
|
114
|
+
"babel-plugin-annotate-pure-calls": "0.5.0",
|
|
115
|
+
"c8": "10.1.3",
|
|
116
|
+
"chai": "6.2.1",
|
|
152
117
|
"conventional-changelog-cli": "5.0.0",
|
|
118
|
+
"core-js": "=3.47.0",
|
|
119
|
+
"cross-env": "7.0.3",
|
|
153
120
|
"docdash": "git+https://github.com/char0n/docdash.git#534b44382138a55dd8d93642c979e51e46471185",
|
|
154
|
-
"eslint": "
|
|
155
|
-
"eslint-config-
|
|
156
|
-
"eslint-
|
|
157
|
-
"eslint-plugin-
|
|
158
|
-
"eslint-plugin-
|
|
159
|
-
"eslint-plugin-
|
|
160
|
-
"eslint-plugin-prettier": "5.2.1",
|
|
161
|
-
"eslint-plugin-ramda": "2.5.1",
|
|
121
|
+
"eslint": "^9.39.1",
|
|
122
|
+
"eslint-config-prettier": "^10.1.8",
|
|
123
|
+
"eslint-plugin-import-x": "^4.16.0",
|
|
124
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
125
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
126
|
+
"eslint-plugin-ramda": "^2.5.1",
|
|
162
127
|
"fantasy-land": "5.0.1",
|
|
163
128
|
"fantasy-laws": "=2.0.1",
|
|
164
129
|
"folktale": "=2.3.2",
|
|
165
|
-
"glob": "=
|
|
166
|
-
"husky": "9.1.
|
|
167
|
-
"
|
|
168
|
-
"jsdoc": "=4.0.3",
|
|
130
|
+
"glob": "=13.0.0",
|
|
131
|
+
"husky": "9.1.7",
|
|
132
|
+
"jsdoc": "=4.0.5",
|
|
169
133
|
"jsverify": "0.8.4",
|
|
170
|
-
"lint-staged": "
|
|
171
|
-
"mocha": "=
|
|
134
|
+
"lint-staged": "16.2.7",
|
|
135
|
+
"mocha": "=11.7.5",
|
|
172
136
|
"mocha-junit-reporter": "2.2.1",
|
|
173
137
|
"mocha-multi-reporters": "1.5.1",
|
|
174
138
|
"monet": "0.9.3",
|
|
175
|
-
"
|
|
176
|
-
"prettier": "=3.3.3",
|
|
139
|
+
"prettier": "=3.7.4",
|
|
177
140
|
"process": "=0.11.10",
|
|
178
|
-
"ramda": "=0.
|
|
141
|
+
"ramda": "=0.32.0",
|
|
179
142
|
"ramda-fantasy": "=0.8.0",
|
|
180
143
|
"regenerator-runtime": "=0.14.1",
|
|
181
|
-
"rimraf": "6.
|
|
144
|
+
"rimraf": "6.1.2",
|
|
182
145
|
"sanctuary-show": "3.0.0",
|
|
183
|
-
"sinon": "=
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
146
|
+
"sinon": "=21.0.0",
|
|
147
|
+
"taffydb": "npm:@jsdoc/salty@0.2.9",
|
|
148
|
+
"terser-webpack-plugin": "5.3.16",
|
|
149
|
+
"testem": "=3.17.0",
|
|
150
|
+
"tsd": "0.32.0",
|
|
151
|
+
"typescript": "=5.9.3",
|
|
152
|
+
"webpack": "=5.103.0",
|
|
153
|
+
"webpack-cli": "6.0.1"
|
|
154
|
+
},
|
|
155
|
+
"tsd": {
|
|
156
|
+
"directory": "types/test",
|
|
157
|
+
"typingsFile": "types/index.d.ts",
|
|
158
|
+
"compilerOptions": {
|
|
159
|
+
"strict": true,
|
|
160
|
+
"baseUrl": ".",
|
|
161
|
+
"paths": {
|
|
162
|
+
"ramda-adjunct": [
|
|
163
|
+
"types/index.d.ts"
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
190
167
|
},
|
|
191
168
|
"browserslist": "> 0.25%, ie 10, ie 11, not op_mini all",
|
|
192
169
|
"tonicExampleFilename": "tonicExample.js",
|
package/types/index.d.ts
CHANGED
|
@@ -608,15 +608,6 @@ type PickRenameMulti<
|
|
|
608
608
|
> = {
|
|
609
609
|
[P in keyof T as P extends keyof R ? R[P] : P]: T[P];
|
|
610
610
|
};
|
|
611
|
-
export function renameKeys<
|
|
612
|
-
MAP extends Dictionary<string>,
|
|
613
|
-
OBJ extends { readonly [s in keyof MAP]: any },
|
|
614
|
-
>(keysMap: MAP, obj: OBJ): PickRenameMulti<MAP, OBJ>;
|
|
615
|
-
export function renameKeys<MAP extends Dictionary<string>>(
|
|
616
|
-
keysMap: MAP
|
|
617
|
-
): <OBJ extends { readonly [s in keyof MAP]: any }>(
|
|
618
|
-
obj: OBJ
|
|
619
|
-
) => PickRenameMulti<MAP, OBJ>;
|
|
620
611
|
|
|
621
612
|
type Keyable = string | number | symbol;
|
|
622
613
|
type RenameObjectKey<
|
|
@@ -998,17 +989,17 @@ export function lensTraverse(of: Function): Function;
|
|
|
998
989
|
* in R.equals terms, to the given value; false otherwise.
|
|
999
990
|
*/
|
|
1000
991
|
export function propNotEq(
|
|
1001
|
-
prop: string | number,
|
|
1002
992
|
value: any,
|
|
993
|
+
prop: string | number,
|
|
1003
994
|
obj: object
|
|
1004
995
|
): boolean;
|
|
1005
996
|
export function propNotEq(
|
|
1006
|
-
|
|
1007
|
-
|
|
997
|
+
value: any,
|
|
998
|
+
prop: string | number
|
|
1008
999
|
): (obj: object) => boolean;
|
|
1009
|
-
export function propNotEq(
|
|
1010
|
-
(
|
|
1011
|
-
(
|
|
1000
|
+
export function propNotEq(value: any): {
|
|
1001
|
+
(prop: string | number, obj: object): boolean;
|
|
1002
|
+
(prop: string | number): (obj: object) => boolean;
|
|
1012
1003
|
};
|
|
1013
1004
|
|
|
1014
1005
|
/**
|
|
@@ -1016,17 +1007,17 @@ export function propNotEq(prop: string | number): {
|
|
|
1016
1007
|
* in R.equals terms. Most likely used to filter a list.
|
|
1017
1008
|
*/
|
|
1018
1009
|
export function pathNotEq(
|
|
1019
|
-
path: Array<string | number>,
|
|
1020
1010
|
value: any,
|
|
1011
|
+
path: Array<string | number>,
|
|
1021
1012
|
obj: object
|
|
1022
1013
|
): boolean;
|
|
1023
1014
|
export function pathNotEq(
|
|
1024
|
-
|
|
1025
|
-
|
|
1015
|
+
value: any,
|
|
1016
|
+
path: Array<string | number>
|
|
1026
1017
|
): (obj: object) => boolean;
|
|
1027
|
-
export function pathNotEq(
|
|
1028
|
-
(
|
|
1029
|
-
(
|
|
1018
|
+
export function pathNotEq(value: any): {
|
|
1019
|
+
(path: Array<string | number>, obj: object): boolean;
|
|
1020
|
+
(path: Array<string | number>): (obj: object) => boolean;
|
|
1030
1021
|
};
|
|
1031
1022
|
|
|
1032
1023
|
/**
|
package/es/renameKeys.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { curry, has } from 'ramda';
|
|
2
|
-
import renameKeysWith from './renameKeysWith.js';
|
|
3
|
-
var valueOrKey = function valueOrKey(keysMap) {
|
|
4
|
-
return function (key) {
|
|
5
|
-
if (has(key, keysMap)) {
|
|
6
|
-
return keysMap[key];
|
|
7
|
-
}
|
|
8
|
-
return key;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Creates a new object with the own properties of the provided object, but the
|
|
14
|
-
* keys renamed according to the keysMap object as `{oldKey: newKey}`.
|
|
15
|
-
* When some key is not found in the keysMap, then it's passed as-is.
|
|
16
|
-
*
|
|
17
|
-
* Keep in mind that in the case of keys conflict is behaviour undefined and
|
|
18
|
-
* the result may vary between various JS engines!
|
|
19
|
-
*
|
|
20
|
-
* @func renameKeys
|
|
21
|
-
* @memberOf RA
|
|
22
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.5.0|v1.5.0}
|
|
23
|
-
* @category Object
|
|
24
|
-
* @sig {a: b} -> {a: *} -> {b: *}
|
|
25
|
-
* @param {!Object} keysMap
|
|
26
|
-
* @param {!Object} obj
|
|
27
|
-
* @return {!Object} New object with renamed keys
|
|
28
|
-
* @see {@link https://github.com/ramda/ramda/wiki/Cookbook#rename-keys-of-an-object|Ramda Cookbook}, {@link RA.renameKeysWith|renameKeysWith}
|
|
29
|
-
* @example
|
|
30
|
-
*
|
|
31
|
-
* const input = { firstName: 'Elisia', age: 22, type: 'human' };
|
|
32
|
-
*
|
|
33
|
-
* RA.renameKeys({ firstName: 'name', type: 'kind', foo: 'bar' })(input);
|
|
34
|
-
* //=> { name: 'Elisia', age: 22, kind: 'human' }
|
|
35
|
-
*/
|
|
36
|
-
var renameKeys = curry(function (keysMap, obj) {
|
|
37
|
-
return renameKeysWith(valueOrKey(keysMap), obj);
|
|
38
|
-
});
|
|
39
|
-
export default renameKeys;
|
package/lib/renameKeys.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
5
|
-
var _ramda = require("ramda");
|
|
6
|
-
var _renameKeysWith = _interopRequireDefault(require("./renameKeysWith.js"));
|
|
7
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
8
|
-
var valueOrKey = function valueOrKey(keysMap) {
|
|
9
|
-
return function (key) {
|
|
10
|
-
if ((0, _ramda.has)(key, keysMap)) {
|
|
11
|
-
return keysMap[key];
|
|
12
|
-
}
|
|
13
|
-
return key;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new object with the own properties of the provided object, but the
|
|
19
|
-
* keys renamed according to the keysMap object as `{oldKey: newKey}`.
|
|
20
|
-
* When some key is not found in the keysMap, then it's passed as-is.
|
|
21
|
-
*
|
|
22
|
-
* Keep in mind that in the case of keys conflict is behaviour undefined and
|
|
23
|
-
* the result may vary between various JS engines!
|
|
24
|
-
*
|
|
25
|
-
* @func renameKeys
|
|
26
|
-
* @memberOf RA
|
|
27
|
-
* @since {@link https://char0n.github.io/ramda-adjunct/1.5.0|v1.5.0}
|
|
28
|
-
* @category Object
|
|
29
|
-
* @sig {a: b} -> {a: *} -> {b: *}
|
|
30
|
-
* @param {!Object} keysMap
|
|
31
|
-
* @param {!Object} obj
|
|
32
|
-
* @return {!Object} New object with renamed keys
|
|
33
|
-
* @see {@link https://github.com/ramda/ramda/wiki/Cookbook#rename-keys-of-an-object|Ramda Cookbook}, {@link RA.renameKeysWith|renameKeysWith}
|
|
34
|
-
* @example
|
|
35
|
-
*
|
|
36
|
-
* const input = { firstName: 'Elisia', age: 22, type: 'human' };
|
|
37
|
-
*
|
|
38
|
-
* RA.renameKeys({ firstName: 'name', type: 'kind', foo: 'bar' })(input);
|
|
39
|
-
* //=> { name: 'Elisia', age: 22, kind: 'human' }
|
|
40
|
-
*/
|
|
41
|
-
var renameKeys = (0, _ramda.curry)(function (keysMap, obj) {
|
|
42
|
-
return (0, _renameKeysWith["default"])(valueOrKey(keysMap), obj);
|
|
43
|
-
});
|
|
44
|
-
var _default = exports["default"] = renameKeys;
|