Thanks to visit codestin.com Credit goes to github.com
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.
1 parent 3fc8331 commit 12ecce5Copy full SHA for 12ecce5
‎src/util/lang.js
@@ -126,14 +126,13 @@ export function _toString (value) {
126
*/
127
128
export function toNumber (value) {
129
- if (typeof value !== 'string') {
+ if (typeof value !== 'string' || value.trim() === '') {
130
return value
131
- } else {
132
- var parsed = Number(value)
133
- return isNaN(parsed)
134
- ? value
135
- : parsed
136
}
+ var parsed = Number(value)
+ return isNaN(parsed)
+ ? value
+ : parsed
137
138
139
/**
0 commit comments