diff options
Diffstat (limited to 'vendor/github.com/robertkrimen/otto/builtin.go')
-rw-r--r-- | vendor/github.com/robertkrimen/otto/builtin.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vendor/github.com/robertkrimen/otto/builtin.go b/vendor/github.com/robertkrimen/otto/builtin.go index 83f715083..256ee3c55 100644 --- a/vendor/github.com/robertkrimen/otto/builtin.go +++ b/vendor/github.com/robertkrimen/otto/builtin.go @@ -70,7 +70,7 @@ func digitValue(chr rune) int { } func builtinGlobal_parseInt(call FunctionCall) Value { - input := strings.TrimSpace(call.Argument(0).string()) + input := strings.Trim(call.Argument(0).string(), builtinString_trim_whitespace) if len(input) == 0 { return NaNValue() } @@ -153,7 +153,8 @@ var parseFloat_matchValid = regexp.MustCompile(`[0-9eE\+\-\.]|Infinity`) func builtinGlobal_parseFloat(call FunctionCall) Value { // Caveat emptor: This implementation does NOT match the specification - input := strings.TrimSpace(call.Argument(0).string()) + input := strings.Trim(call.Argument(0).string(), builtinString_trim_whitespace) + if parseFloat_matchBadSpecial.MatchString(input) { return NaNValue() } |