ramda-adjunct 2.35.0 → 2.36.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 -0
- package/README.md +2 -4
- package/dist/RA.node.js +104 -35
- package/dist/RA.node.min.js +1 -1
- package/dist/RA.web.js +104 -35
- package/dist/RA.web.min.js +1 -1
- package/dist/RA.web.standalone.js +105 -36
- package/dist/RA.web.standalone.min.js +1 -1
- package/es/copyKeys.js +2 -2
- package/es/fantasy-land/Identity.js +1 -1
- package/es/index.js +4 -2
- package/es/internal/isCoercible.js +6 -0
- package/es/internal/isOfTypeObject.js +1 -1
- package/es/internal/ponyfills/Promise.any.js +8 -4
- package/es/isArrayLike.js +1 -1
- package/es/isNotNilOrEmpty.js +1 -1
- package/es/isSymbol.js +1 -1
- package/es/toNumber.js +22 -0
- package/lib/anyP.js +1 -1
- package/lib/copyKeys.js +2 -2
- package/lib/fantasy-land/Identity.js +2 -2
- package/lib/fantasy-land/mapping.js +1 -1
- package/lib/fantasy-land/traits.js +2 -2
- package/lib/fantasy-land/util.js +1 -1
- package/lib/index.js +7 -3
- package/lib/internal/ap.js +1 -1
- package/lib/internal/isCoercible.js +18 -0
- package/lib/internal/isOfTypeObject.js +1 -1
- package/lib/internal/ponyfills/Promise.any.js +8 -4
- package/lib/isArrayLike.js +1 -1
- package/lib/isFinite.js +1 -1
- package/lib/isInteger.js +1 -1
- package/lib/isNaN.js +1 -1
- package/lib/isNotNilOrEmpty.js +1 -1
- package/lib/isSafeInteger.js +1 -1
- package/lib/isSymbol.js +1 -1
- package/lib/padCharsEnd.js +1 -1
- package/lib/padCharsStart.js +1 -1
- package/lib/repeatStr.js +1 -1
- package/lib/replaceAll.js +1 -1
- package/lib/sign.js +1 -1
- package/lib/thenCatchP.js +1 -1
- package/lib/toArray.js +1 -1
- package/lib/toNumber.js +31 -0
- package/lib/trimEnd.js +1 -1
- package/lib/trimStart.js +1 -1
- package/lib/trunc.js +1 -1
- package/package.json +26 -25
- package/src/index.js +2 -1
- package/src/internal/isCoercible.js +12 -0
- package/src/internal/ponyfills/Promise.any.js +1 -1
- package/src/isNotNilOrEmpty.js +1 -1
- package/src/toNumber.js +24 -0
- package/types/index.d.ts +5 -0
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"cookbook",
|
|
15
15
|
"functional"
|
|
16
16
|
],
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.36.0",
|
|
18
18
|
"homepage": "https://github.com/char0n/ramda-adjunct",
|
|
19
19
|
"license": "BSD-3-Clause",
|
|
20
20
|
"repository": {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
"test:web": "testem ci",
|
|
96
|
-
"test:ramda": "bnr test:ramda0.27.1 && bnr test:ramda0.27.0 && bnr test:ramda0.26.1 && bnr test:ramda0.26.0 && bnr test:ramda0.25.0 && bnr test:ramda0.24.1 && bnr test:ramda0.24.0 && bnr test:ramda0.23.0 && bnr test:ramda0.22.1 && bnr test:ramda0.22.0 && bnr test:ramda0.21.0 && bnr test:ramda0.20.1 && bnr test:ramda0.20.0 && bnr test:ramda0.19.1 && bnr test:ramda0.19.0",
|
|
96
|
+
"test:ramda": "bnr test:ramda0.27.2 && bnr test:ramda0.27.1 && bnr test:ramda0.27.0 && bnr test:ramda0.26.1 && bnr test:ramda0.26.0 && bnr test:ramda0.25.0 && bnr test:ramda0.24.1 && bnr test:ramda0.24.0 && bnr test:ramda0.23.0 && bnr test:ramda0.22.1 && bnr test:ramda0.22.0 && bnr test:ramda0.21.0 && bnr test:ramda0.20.1 && bnr test:ramda0.20.0 && bnr test:ramda0.19.1 && bnr test:ramda0.19.0",
|
|
97
97
|
"test:ramda0.19.0": "npm install ramda@0.19.0 && npm test",
|
|
98
98
|
"test:ramda0.19.1": "npm install ramda@0.19.1 && npm test",
|
|
99
99
|
"test:ramda0.20.0": "npm install ramda@0.20.0 && npm test",
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"test:ramda0.26.1": "npm install ramda@0.26.1 && npm test",
|
|
110
110
|
"test:ramda0.27.0": "npm install ramda@0.27.0 && npm test",
|
|
111
111
|
"test:ramda0.27.1": "npm install ramda@0.27.1 && npm test",
|
|
112
|
+
"test:ramda0.27.2": "npm install ramda@0.27.1 && npm test",
|
|
112
113
|
"test:bundle-create": "webpack --config webpack.config-test.web.js --progress",
|
|
113
114
|
"test:bundle-clean": "rimraf tmp-test-bundle.js",
|
|
114
115
|
"coverage": {
|
|
@@ -136,16 +137,16 @@
|
|
|
136
137
|
},
|
|
137
138
|
"readme": "README.md",
|
|
138
139
|
"peerDependencies": {
|
|
139
|
-
"ramda": ">= 0.19.0 <= 0.27.
|
|
140
|
+
"ramda": ">= 0.19.0 <= 0.27.2"
|
|
140
141
|
},
|
|
141
142
|
"devDependencies": {
|
|
142
|
-
"@babel/cli": "7.
|
|
143
|
-
"@babel/core": "=7.
|
|
144
|
-
"@babel/plugin-transform-modules-commonjs": "7.
|
|
145
|
-
"@babel/preset-env": "=7.
|
|
146
|
-
"@babel/register": "7.
|
|
147
|
-
"@commitlint/cli": "=
|
|
148
|
-
"@commitlint/config-conventional": "=
|
|
143
|
+
"@babel/cli": "7.16.8",
|
|
144
|
+
"@babel/core": "=7.16.7",
|
|
145
|
+
"@babel/plugin-transform-modules-commonjs": "7.16.8",
|
|
146
|
+
"@babel/preset-env": "=7.16.8",
|
|
147
|
+
"@babel/register": "7.16.9",
|
|
148
|
+
"@commitlint/cli": "=16.0.2",
|
|
149
|
+
"@commitlint/config-conventional": "=16.0.0",
|
|
149
150
|
"assert": "=2.0.0",
|
|
150
151
|
"babel-loader": "8.2.3",
|
|
151
152
|
"babel-plugin-annotate-pure-calls": "0.4.0",
|
|
@@ -153,15 +154,15 @@
|
|
|
153
154
|
"better-npm-run": "0.1.1",
|
|
154
155
|
"chai": "4.3.4",
|
|
155
156
|
"codecov": "3.8.3",
|
|
156
|
-
"conventional-changelog-cli": "2.
|
|
157
|
-
"core-js": "=3.
|
|
157
|
+
"conventional-changelog-cli": "2.2.2",
|
|
158
|
+
"core-js": "=3.20.3",
|
|
158
159
|
"docdash": "git+https://github.com/char0n/docdash.git#534b44382138a55dd8d93642c979e51e46471185",
|
|
159
|
-
"dtslint": "=4.2.
|
|
160
|
-
"eslint": "7.
|
|
161
|
-
"eslint-config-airbnb-base": "
|
|
160
|
+
"dtslint": "=4.2.1",
|
|
161
|
+
"eslint": "=8.7.0",
|
|
162
|
+
"eslint-config-airbnb-base": "=15.0.0",
|
|
162
163
|
"eslint-config-prettier": "=8.3.0",
|
|
163
|
-
"eslint-plugin-import": "=2.25.
|
|
164
|
-
"eslint-plugin-mocha": "
|
|
164
|
+
"eslint-plugin-import": "=2.25.4",
|
|
165
|
+
"eslint-plugin-mocha": "10.0.3",
|
|
165
166
|
"eslint-plugin-prettier": "4.0.0",
|
|
166
167
|
"eslint-plugin-ramda": "2.5.1",
|
|
167
168
|
"fantasy-land": "5.0.0",
|
|
@@ -173,25 +174,25 @@
|
|
|
173
174
|
"jsdoc": "=3.6.7",
|
|
174
175
|
"jsverify": "0.8.4",
|
|
175
176
|
"license-cli": "1.1.6",
|
|
176
|
-
"lint-staged": "
|
|
177
|
-
"mocha": "=9.1.
|
|
177
|
+
"lint-staged": "12.1.7",
|
|
178
|
+
"mocha": "=9.1.4",
|
|
178
179
|
"mocha-junit-reporter": "2.0.2",
|
|
179
180
|
"mocha-multi-reporters": "1.5.1",
|
|
180
|
-
"monet": "0.9.
|
|
181
|
+
"monet": "0.9.3",
|
|
181
182
|
"nyc": "15.1.0",
|
|
182
|
-
"prettier": "=2.
|
|
183
|
+
"prettier": "=2.5.1",
|
|
183
184
|
"process": "=0.11.10",
|
|
184
|
-
"ramda": "0.27.
|
|
185
|
+
"ramda": "0.27.2",
|
|
185
186
|
"ramda-fantasy": "=0.8.0",
|
|
186
187
|
"regenerator-runtime": "=0.13.9",
|
|
187
188
|
"rimraf": "3.0.2",
|
|
188
189
|
"sanctuary-show": "2.0.0",
|
|
189
190
|
"sinon": "=11.1.2",
|
|
190
|
-
"terser-webpack-plugin": "5.
|
|
191
|
+
"terser-webpack-plugin": "5.3.0",
|
|
191
192
|
"testem": "=3.6.0",
|
|
192
193
|
"tslint": "=6.1.3",
|
|
193
|
-
"typescript": "=4.
|
|
194
|
-
"webpack": "=5.
|
|
194
|
+
"typescript": "=4.5.4",
|
|
195
|
+
"webpack": "=5.66.0",
|
|
195
196
|
"webpack-cli": "4.9.1"
|
|
196
197
|
},
|
|
197
198
|
"browserslist": "> 0.25%, ie 10, ie 11, not op_mini all",
|
package/src/index.js
CHANGED
|
@@ -114,7 +114,7 @@ export { default as resolveP } from './resolveP';
|
|
|
114
114
|
export { default as rejectP } from './rejectP';
|
|
115
115
|
export { default as delayP } from './delayP';
|
|
116
116
|
export { default as thenP } from './thenP';
|
|
117
|
-
export { default as then } from './thenP';
|
|
117
|
+
export { default as then } from './thenP'; // eslint-disable-line no-restricted-exports
|
|
118
118
|
export { default as thenCatchP } from './thenCatchP';
|
|
119
119
|
export { default as allSettledP } from './allSettledP';
|
|
120
120
|
export { default as Y } from './Y';
|
|
@@ -225,6 +225,7 @@ export { default as toInteger32 } from './toInteger32';
|
|
|
225
225
|
export { default as toInt32 } from './toInteger32'; // alias of toInteger32
|
|
226
226
|
export { default as toUinteger32 } from './toUinteger32';
|
|
227
227
|
export { default as toUint32 } from './toUinteger32'; // alias of to toUinteger32
|
|
228
|
+
export { default as toNumber } from './toNumber';
|
|
228
229
|
// String
|
|
229
230
|
export { default as replaceAll } from './replaceAll';
|
|
230
231
|
export { default as escapeRegExp } from './escapeRegExp';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { both, hasIn } from 'ramda';
|
|
2
|
+
|
|
3
|
+
import isObj from '../isObj';
|
|
4
|
+
import isSymbol from '../isSymbol';
|
|
5
|
+
import neither from '../neither';
|
|
6
|
+
|
|
7
|
+
const isCoercible = neither(
|
|
8
|
+
isSymbol,
|
|
9
|
+
both(isObj, neither(hasIn('toString'), hasIn('valueOf')))
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export default isCoercible;
|
package/src/isNotNilOrEmpty.js
CHANGED
|
@@ -3,7 +3,7 @@ import { complement } from 'ramda';
|
|
|
3
3
|
import isNilOrEmpty from './isNilOrEmpty';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Returns `
|
|
6
|
+
* Returns `false` if the given value is its type's empty value, `null` or `undefined`.
|
|
7
7
|
*
|
|
8
8
|
* @func isNotNilOrEmpty
|
|
9
9
|
* @memberOf RA
|
package/src/toNumber.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ifElse, always } from 'ramda';
|
|
2
|
+
|
|
3
|
+
import isCoercible from './internal/isCoercible';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts value to a number.
|
|
7
|
+
*
|
|
8
|
+
* @func toNumber
|
|
9
|
+
* @memberOf RA
|
|
10
|
+
* @since {@link https://char0n.github.io/ramda-adjunct/2.36.0|v2.36.0}
|
|
11
|
+
* @category Type
|
|
12
|
+
* @param {*} val The value to convert
|
|
13
|
+
* @return {Number}
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* RA.toNumber(3.2); //=> 3.2
|
|
17
|
+
* RA.toNumber(Number.MIN_VALUE); //=> 5e-324
|
|
18
|
+
* RA.toNumber(Infinity); //=> Infinity
|
|
19
|
+
* RA.toNumber('3.2'); //=> 3.2
|
|
20
|
+
* RA.toNumber(Symbol('3.2')); //=> NaN
|
|
21
|
+
*/
|
|
22
|
+
const toNumber = ifElse(isCoercible, Number, always(NaN));
|
|
23
|
+
|
|
24
|
+
export default toNumber;
|
package/types/index.d.ts
CHANGED
|
@@ -1538,6 +1538,11 @@ declare namespace RamdaAdjunct {
|
|
|
1538
1538
|
toUinteger32(val: number): number;
|
|
1539
1539
|
toUint32(val: number): number; // alias
|
|
1540
1540
|
|
|
1541
|
+
/**
|
|
1542
|
+
* Converts value to a number.
|
|
1543
|
+
*/
|
|
1544
|
+
toNumber(val: any): number;
|
|
1545
|
+
|
|
1541
1546
|
/**
|
|
1542
1547
|
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
|
|
1543
1548
|
*
|