ansuko 1.3.8 → 1.3.11
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/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ declare const isEmpty: (value: unknown) => boolean;
|
|
|
55
55
|
* @example toNumber('abc') // null
|
|
56
56
|
* @category Core Functions
|
|
57
57
|
*/
|
|
58
|
-
declare const toNumber: (value: unknown, toFixed?:
|
|
58
|
+
declare const toNumber: (value: unknown, toFixed?: unknown) => number | null;
|
|
59
59
|
/**
|
|
60
60
|
* Converts various inputs to boolean. Numbers: 0 -> false, non-zero -> true.
|
|
61
61
|
* Strings: 'true'|'t'|'y'|'yes'|'ok' -> true; 'false'|'f'|'n'|'no'|'ng' -> false.
|
package/dist/index.js
CHANGED
|
@@ -160,12 +160,13 @@ const toNumber = (value, toFixed) => {
|
|
|
160
160
|
else {
|
|
161
161
|
v = _.toNumber(v);
|
|
162
162
|
}
|
|
163
|
+
if (!_.isNaN(v) && !_.isNil(toFixed)) {
|
|
164
|
+
const f = _.toNumber(toFixed);
|
|
165
|
+
v = parseFloat(v.toFixed(f));
|
|
166
|
+
}
|
|
163
167
|
if (_.isNaN(v)) {
|
|
164
168
|
return null;
|
|
165
169
|
}
|
|
166
|
-
if (toFixed !== undefined) {
|
|
167
|
-
return parseFloat(v.toFixed(toFixed));
|
|
168
|
-
}
|
|
169
170
|
return v;
|
|
170
171
|
};
|
|
171
172
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ansuko",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "A modern JavaScript/TypeScript utility library that extends lodash with practical, intuitive behaviors. Fixes lodash quirks, adds Promise support, Japanese text processing, and GeoJSON utilities.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lodash",
|