We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3e8a542 + e0101ce commit 184bb28Copy full SHA for 184bb28
src/util/common.js
@@ -1,6 +1,7 @@
1
import fetch from 'isomorphic-fetch';
2
import _isNaN from 'lodash/isNaN';
3
import _toNumber from 'lodash/toNumber';
4
+import _isNumber from 'lodash/isNumber';
5
import _cuid from 'cuid';
6
import _uid from 'uid';
7
@@ -44,10 +45,10 @@ const Common = {
44
45
if (Array.isArray(str)) {
46
return str.map((x) => Common.toNumber(x));
47
}
- if (typeof str === 'string' && str.trim() === '') {
48
- return str;
+ if (!_isNaN(parseInt(str, 10))) {
49
+ return _toNumber(str);
50
- return _toNumber(str) || '';
51
+ return str;
52
},
53
generateId() {
54
return _uid(8) + _cuid();
0 commit comments