liuxiulin il y a 4 mois
Parent
commit
d78a52e6b2
52 fichiers modifiés avec 779 ajouts et 563 suppressions
  1. 4 2
      go.mod
  2. 2 2
      go.sum
  3. 27 19
      vendor/github.com/robertkrimen/otto/.golangci.yml
  4. 176 119
      vendor/github.com/robertkrimen/otto/README.md
  5. 1 1
      vendor/github.com/robertkrimen/otto/ast/comments.go
  6. 46 50
      vendor/github.com/robertkrimen/otto/ast/node.go
  7. 4 5
      vendor/github.com/robertkrimen/otto/builtin.go
  8. 13 13
      vendor/github.com/robertkrimen/otto/builtin_array.go
  9. 20 20
      vendor/github.com/robertkrimen/otto/builtin_date.go
  10. 1 1
      vendor/github.com/robertkrimen/otto/builtin_function.go
  11. 22 22
      vendor/github.com/robertkrimen/otto/builtin_json.go
  12. 1 1
      vendor/github.com/robertkrimen/otto/builtin_math.go
  13. 11 0
      vendor/github.com/robertkrimen/otto/builtin_object.go
  14. 18 6
      vendor/github.com/robertkrimen/otto/builtin_string.go
  15. 5 5
      vendor/github.com/robertkrimen/otto/cmpl_evaluate_statement.go
  16. 17 19
      vendor/github.com/robertkrimen/otto/cmpl_parse.go
  17. 2 2
      vendor/github.com/robertkrimen/otto/console.go
  18. 5 5
      vendor/github.com/robertkrimen/otto/error.go
  19. 3 3
      vendor/github.com/robertkrimen/otto/evaluate.go
  20. 4 4
      vendor/github.com/robertkrimen/otto/file/file.go
  21. 1 1
      vendor/github.com/robertkrimen/otto/global.go
  22. 114 0
      vendor/github.com/robertkrimen/otto/inline.go
  23. 7 10
      vendor/github.com/robertkrimen/otto/object.go
  24. 1 1
      vendor/github.com/robertkrimen/otto/object_class.go
  25. 12 13
      vendor/github.com/robertkrimen/otto/otto.go
  26. 4 4
      vendor/github.com/robertkrimen/otto/otto_.go
  27. 3 3
      vendor/github.com/robertkrimen/otto/parser/error.go
  28. 16 18
      vendor/github.com/robertkrimen/otto/parser/expression.go
  29. 66 19
      vendor/github.com/robertkrimen/otto/parser/lexer.go
  30. 21 30
      vendor/github.com/robertkrimen/otto/parser/parser.go
  31. 11 14
      vendor/github.com/robertkrimen/otto/parser/regexp.go
  32. 2 3
      vendor/github.com/robertkrimen/otto/parser/scope.go
  33. 3 3
      vendor/github.com/robertkrimen/otto/parser/statement.go
  34. 10 10
      vendor/github.com/robertkrimen/otto/property.go
  35. 1 1
      vendor/github.com/robertkrimen/otto/registry/registry.go
  36. 4 4
      vendor/github.com/robertkrimen/otto/result.go
  37. 10 11
      vendor/github.com/robertkrimen/otto/runtime.go
  38. 2 3
      vendor/github.com/robertkrimen/otto/scope.go
  39. 1 1
      vendor/github.com/robertkrimen/otto/script.go
  40. 8 8
      vendor/github.com/robertkrimen/otto/stash.go
  41. 4 4
      vendor/github.com/robertkrimen/otto/token/token.go
  42. 4 10
      vendor/github.com/robertkrimen/otto/type_arguments.go
  43. 11 11
      vendor/github.com/robertkrimen/otto/type_date.go
  44. 7 8
      vendor/github.com/robertkrimen/otto/type_function.go
  45. 3 3
      vendor/github.com/robertkrimen/otto/type_go_array.go
  46. 1 1
      vendor/github.com/robertkrimen/otto/type_go_map.go
  47. 4 4
      vendor/github.com/robertkrimen/otto/type_go_struct.go
  48. 6 6
      vendor/github.com/robertkrimen/otto/type_reference.go
  49. 3 3
      vendor/github.com/robertkrimen/otto/type_regexp.go
  50. 3 3
      vendor/github.com/robertkrimen/otto/type_string.go
  51. 52 52
      vendor/github.com/robertkrimen/otto/value.go
  52. 2 2
      vendor/modules.txt

+ 4 - 2
go.mod

@@ -1,6 +1,8 @@
 module sparrow
 
-go 1.21.4
+go 1.22
+
+toolchain go1.22.11
 
 require (
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
@@ -17,7 +19,7 @@ require (
 	github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11
 	github.com/opentracing/opentracing-go v1.2.0
 	github.com/prometheus/client_golang v1.18.0
-	github.com/robertkrimen/otto v0.3.0
+	github.com/robertkrimen/otto v0.5.1
 	github.com/robfig/cron v1.2.0
 	github.com/satori/go.uuid v1.2.0
 	github.com/segmentio/kafka-go v0.4.47

+ 2 - 2
go.sum

@@ -238,8 +238,8 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c
 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
 github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
-github.com/robertkrimen/otto v0.3.0 h1:5RI+8860NSxvXywDY9ddF5HcPw0puRsd8EgbXV0oqRE=
-github.com/robertkrimen/otto v0.3.0/go.mod h1:uW9yN1CYflmUQYvAMS0m+ZiNo3dMzRUDQJX0jWbzgxw=
+github.com/robertkrimen/otto v0.5.1 h1:avDI4ToRk8k1hppLdYFTuuzND41n37vPGJU7547dGf0=
+github.com/robertkrimen/otto v0.5.1/go.mod h1:bS433I4Q9p+E5pZLu7r17vP6FkE6/wLxBdmKjoqJXF8=
 github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
 github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
 github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=

+ 27 - 19
vendor/github.com/robertkrimen/otto/.golangci.yml

@@ -1,14 +1,12 @@
 run:
-  deadline: 6m
-  skip-dirs:
-    - terst
-  skip-files:
-    - dbg/dbg.go
-    - token/token_const.go
+  timeout: 6m
 
 linters-settings:
   govet:
-    check-shadowing: false
+    settings:
+      shadow:
+        strict: true
+    enable-all: true
   goconst:
     min-len: 2
     min-occurrences: 4
@@ -17,6 +15,9 @@ linters-settings:
     rules:
     - name: var-naming
       disabled: true
+  gosec:
+    excludes:
+      - G115 # Too many false positives.
 
 linters:
   enable-all: true
@@ -25,14 +26,13 @@ linters:
     - lll
     - gochecknoglobals
     - gochecknoinits
-    - scopelint
     - funlen
     - godox
-    - exhaustivestruct
-    - goerr113
+    - err113
     - wsl
     - nlreturn
     - gomnd
+    - mnd
     - paralleltest
     - wrapcheck
     - testpackage
@@ -46,20 +46,28 @@ linters:
     - maintidx
     - ireturn
     - exhaustruct
-    - nosnakecase
     - dupword
-    - structcheck
-    - deadcode
-    - golint
-    - varcheck
-    - ifshort
-    - interfacer
-    - maligned
     # Just causes noise
     - depguard
+    # Deprecated
+    - execinquery
+    # Not needed in go 1.22+
+    - exportloopref
 
 issues:
   exclude-use-default: false
   max-same-issues: 0
   exclude:
-  - Deferring unsafe method "Close" on type "io\.ReadCloser"
+    - Deferring unsafe method "Close" on type "io\.ReadCloser"
+  exclude-dirs:
+    - terst
+  exclude-files:
+    - dbg/dbg.go
+    - token/token_const.go
+  exclude-rules:
+    # Field alignment in tests isn't a performance issue.
+    - text: fieldalignment
+      path: _test\.go
+    - text: Error return value of `fmt\.Fprint.*` is not checked
+      path: tools/tester/main.go
+

+ 176 - 119
vendor/github.com/robertkrimen/otto/README.md

@@ -1,12 +1,12 @@
 # otto
---
-```go
-import "github.com/robertkrimen/otto"
-```
+
+[![GoDoc Reference](https://pkg.go.dev/badge/github.com/robertkrimen/otto.svg)](https://pkg.go.dev/github.com/robertkrimen/otto)
+
+## Basic Usage
 
 Package otto is a JavaScript parser and interpreter written natively in Go.
 
-http://godoc.org/github.com/robertkrimen/otto
+To use import it with the following:
 
 ```go
 import (
@@ -29,7 +29,7 @@ Get a value out of the VM
 ```go
 if value, err := vm.Get("abc"); err == nil {
     if value_int, err := value.ToInteger(); err == nil {
-	fmt.Printf("", value_int, err)
+        fmt.Printf("", value_int, err)
     }
 }
 ```
@@ -104,12 +104,12 @@ result, _ = vm.Run(`
 `)
 ```
 
-### Parser
+## Parser
 
 A separate parser is available in the parser package if you're just interested
 in building an AST.
 
-http://godoc.org/github.com/robertkrimen/otto/parser
+[![GoDoc Reference](https://pkg.go.dev/badge/github.com/robertkrimen/otto/parser.svg)](https://pkg.go.dev/github.com/robertkrimen/otto/parser)
 
 Parse and return an AST
 
@@ -133,18 +133,22 @@ src := `
 program, err := parser.ParseFile(nil, filename, src, 0)
 ```
 
-### otto
+## Setup
 
-You can run (Go) JavaScript from the commandline with:
-http://github.com/robertkrimen/otto/tree/master/otto
+You can run (Go) JavaScript from the command line with
+[otto](http://github.com/robertkrimen/otto/tree/master/otto).
 
-    $ go get -v github.com/robertkrimen/otto/otto
+```shell
+go install github.com/robertkrimen/otto/otto@latest
+```
 
 Run JavaScript by entering some source on stdin or by giving otto a filename:
 
-    $ otto example.js
+```shell
+otto example.js
+```
 
-### underscore
+## Underscore
 
 Optionally include the JavaScript utility-belt library, underscore, with this
 import:
@@ -158,41 +162,39 @@ import (
 // Now every otto runtime will come loaded with underscore
 ```
 
-For more information: http://github.com/robertkrimen/otto/tree/master/underscore
-
+For more information: [underscore](http://github.com/robertkrimen/otto/tree/master/underscore)
 
-### Caveat Emptor
+## Caveat Emptor
 
 The following are some limitations with otto:
 
-    * "use strict" will parse, but does nothing.
-    * The regular expression engine (re2/regexp) is not fully compatible with the ECMA5 specification.
-    * Otto targets ES5. ES6 features (eg: Typed Arrays) are not supported.
-
+* `use strict` will parse, but does nothing.
+* The regular expression engine ([re2/regexp](https://pkg.go.dev/regexp)) is not fully compatible with the ECMA5 specification.
+* Otto targets ES5. Some ES6 features e.g. Typed Arrays are not supported, PR's to add functionality are always welcome.
 
 ### Regular Expression Incompatibility
 
 Go translates JavaScript-style regular expressions into something that is
 "regexp" compatible via `parser.TransformRegExp`. Unfortunately, RegExp requires
-backtracking for some patterns, and backtracking is not supported by the
-standard Go engine: https://code.google.com/p/re2/wiki/Syntax
+backtracking for some patterns, and backtracking is not supported by Go
+[re2](https://github.com/google/re2/wiki/syntax).
 
 Therefore, the following syntax is incompatible:
 
-    (?=)  // Lookahead (positive), currently a parsing error
-    (?!)  // Lookahead (backhead), currently a parsing error
-    \1    // Backreference (\1, \2, \3, ...), currently a parsing error
+```plaintext
+(?=)  // Lookahead (positive), currently a parsing error
+(?!)  // Lookahead (backhead), currently a parsing error
+\1    // Backreference (\1, \2, \3, ...), currently a parsing error
+```
 
-A brief discussion of these limitations: "Regexp (?!re)"
-https://groups.google.com/forum/?fromgroups=#%21topic/golang-nuts/7qgSDWPIh_E
+A brief discussion of these limitations: [Regexp (?!re)](https://groups.google.com/forum/?fromgroups=#%21topic/golang-nuts/7qgSDWPIh_E)
 
-More information about re2: https://code.google.com/p/re2/
+More information [about re2](https://github.com/google/re2)
 
-In addition to the above, re2 (Go) has a different definition for \s: [\t\n\f\r
-]. The JavaScript definition, on the other hand, also includes \v, Unicode
+In addition to the above, re2 (Go) has a different definition for `\s`: `[\t\n\f\r
+]`. The JavaScript definition, on the other hand, also includes `\v`, Unicode
 "Separator, Space", etc.
 
-
 ### Halting Problem
 
 If you want to stop long running executions (like third-party code), you can use
@@ -254,24 +256,20 @@ func runUnsafe(unsafe string) {
 }
 ```
 
-Where is setTimeout/setInterval?
+Where is `setTimeout` / `setInterval`?
 
-These timing functions are not actually part of the ECMA-262 specification.
+These timing functions are not actually part of the [ECMA-262 specification](https://ecma-international.org/publications-and-standards/standards/ecma-262/).
 Typically, they belong to the `window` object (in the browser). It would not be
 difficult to provide something like these via Go, but you probably want to wrap
 otto in an event loop in that case.
 
-For an example of how this could be done in Go with otto, see natto:
-
-http://github.com/robertkrimen/natto
+For an example of how this could be done in Go with otto, see [natto](http://github.com/robertkrimen/natto).
 
 Here is some more discussion of the issue:
 
-* http://book.mixu.net/node/ch2.html
-
-* http://en.wikipedia.org/wiki/Reentrancy_%28computing%29
-
-* http://aaroncrane.co.uk/2009/02/perl_safe_signals/
+* [What is Node.js?](http://book.mixu.net/node/ch2.html)
+* [Reentrancy (computing)](http://en.wikipedia.org/wiki/Reentrancy_%28computing%29)
+* [Perl Safe Signals](https://metacpan.org/pod/Perl::Unsafe::Signals)
 
 ## Usage
 
@@ -279,93 +277,103 @@ Here is some more discussion of the issue:
 var ErrVersion = errors.New("version mismatch")
 ```
 
-#### type Error
+### type Error
 
 ```go
-type Error struct {
-}
+type Error struct {}
 ```
 
-An Error represents a runtime error, e.g. a TypeError, a ReferenceError, etc.
+An Error represents a runtime error, e.g. a `TypeError`, a `ReferenceError`, etc.
 
-#### func (Error) Error
+### func (Error) Error
 
 ```go
 func (err Error) Error() string
 ```
+
 Error returns a description of the error
 
+```plaintext
     TypeError: 'def' is not a function
+```
 
-#### func (Error) String
+### func (Error) String
 
 ```go
 func (err Error) String() string
 ```
+
 String returns a description of the error and a trace of where the error
 occurred.
 
+```plaintext
     TypeError: 'def' is not a function
         at xyz (<anonymous>:3:9)
         at <anonymous>:7:1/
+```
 
-#### type FunctionCall
+### type FunctionCall
 
 ```go
 type FunctionCall struct {
-	This         Value
-	ArgumentList []Value
-	Otto         *Otto
+    This         Value
+    ArgumentList []Value
+    Otto         *Otto
 }
 ```
 
 FunctionCall is an encapsulation of a JavaScript function call.
 
-#### func (FunctionCall) Argument
+### func (FunctionCall) Argument
 
 ```go
 func (self FunctionCall) Argument(index int) Value
 ```
+
 Argument will return the value of the argument at the given index.
 
 If no such argument exists, undefined is returned.
 
-#### type Object
+### type Object
 
 ```go
-type Object struct {
-}
+type Object struct {}
 ```
 
 Object is the representation of a JavaScript object.
 
-#### func (Object) Call
+### func (Object) Call
 
 ```go
 func (self Object) Call(name string, argumentList ...interface{}) (Value, error)
 ```
+
 Call a method on the object.
 
 It is essentially equivalent to:
 
-    var method, _ := object.Get(name)
-    method.Call(object, argumentList...)
+```go
+var method, _ := object.Get(name)
+method.Call(object, argumentList...)
+```
 
 An undefined value and an error will result if:
 
-    1. There is an error during conversion of the argument list
-    2. The property is not actually a function
-    3. An (uncaught) exception is thrown
+1. There is an error during conversion of the argument list
+2. The property is not actually a function
+3. An (uncaught) exception is thrown
 
-#### func (Object) Class
+### func (Object) Class
 
 ```go
 func (self Object) Class() string
 ```
+
 Class will return the class string of the object.
 
 The return value will (generally) be one of:
 
+```plaintext
     Object
     Function
     Array
@@ -374,65 +382,72 @@ The return value will (generally) be one of:
     Boolean
     Date
     RegExp
+```
 
-#### func (Object) Get
+### func (Object) Get
 
 ```go
 func (self Object) Get(name string) (Value, error)
 ```
+
 Get the value of the property with the given name.
 
-#### func (Object) Keys
+### func (Object) Keys
 
 ```go
 func (self Object) Keys() []string
 ```
+
 Get the keys for the object
 
 Equivalent to calling Object.keys on the object
 
-#### func (Object) Set
+### func (Object) Set
 
 ```go
 func (self Object) Set(name string, value interface{}) error
 ```
+
 Set the property of the given name to the given value.
 
 An error will result if the setting the property triggers an exception (i.e.
 read-only), or there is an error during conversion of the given value.
 
-#### func (Object) Value
+### func (Object) Value
 
 ```go
 func (self Object) Value() Value
 ```
+
 Value will return self as a value.
 
-#### type Otto
+### type Otto
 
 ```go
 type Otto struct {
-	// Interrupt is a channel for interrupting the runtime. You can use this to halt a long running execution, for example.
-	// See "Halting Problem" for more information.
-	Interrupt chan func()
+    // Interrupt is a channel for interrupting the runtime. You can use this to halt a long running execution, for example.
+    // See "Halting Problem" for more information.
+    Interrupt chan func()
 }
 ```
 
 Otto is the representation of the JavaScript runtime. Each instance of Otto has
 a self-contained namespace.
 
-#### func  New
+### func New
 
 ```go
 func New() *Otto
 ```
+
 New will allocate a new JavaScript runtime
 
-#### func  Run
+### func Run
 
 ```go
 func Run(src interface{}) (*Otto, Value, error)
 ```
+
 Run will allocate a new JavaScript runtime, run the given source on the
 allocated runtime, and return the runtime, resulting value, and error (if any).
 
@@ -444,11 +459,12 @@ src may also be a Script.
 src may also be a Program, but if the AST has been modified, then runtime
 behavior is undefined.
 
-#### func (Otto) Call
+### func (Otto) Call
 
 ```go
 func (self Otto) Call(source string, this interface{}, argumentList ...interface{}) (Value, error)
 ```
+
 Call the given JavaScript with a given this and arguments.
 
 If this is nil, then some special handling takes place to determine the proper
@@ -471,11 +487,12 @@ value, _ := vm.Call("new Object", nil, "Hello, World.")
 value, _ := vm.Call(`[ 1, 2, 3, undefined, 4 ].concat`, nil, 5, 6, 7, "abc")
 ```
 
-#### func (*Otto) Compile
+### func (*Otto) Compile
 
 ```go
 func (self *Otto) Compile(filename string, src interface{}) (*Script, error)
 ```
+
 Compile will parse the given source and return a Script value or nil and an
 error if there was a problem during compilation.
 
@@ -484,11 +501,12 @@ script, err := vm.Compile("", `var abc; if (!abc) abc = 0; abc += 2; abc;`)
 vm.Run(script)
 ```
 
-#### func (*Otto) Copy
+### func (*Otto) Copy
 
 ```go
 func (in *Otto) Copy() *Otto
 ```
+
 Copy will create a copy/clone of the runtime.
 
 Copy is useful for saving some time when creating many similar runtimes.
@@ -498,21 +516,23 @@ scope, stash, etc. into a new runtime.
 
 Be on the lookout for memory leaks or inadvertent sharing of resources.
 
-#### func (Otto) Get
+### func (Otto) Get
 
 ```go
 func (self Otto) Get(name string) (Value, error)
 ```
+
 Get the value of the top-level binding of the given name.
 
 If there is an error (like the binding does not exist), then the value will be
 undefined.
 
-#### func (Otto) Object
+### func (Otto) Object
 
 ```go
 func (self Otto) Object(source string) (*Object, error)
 ```
+
 Object will run the given source and return the result as an object.
 
 For example, accessing an existing object:
@@ -537,11 +557,12 @@ object.Set("volume", 11)
 If there is an error (like the source does not result in an object), then nil
 and an error is returned.
 
-#### func (Otto) Run
+### func (Otto) Run
 
 ```go
 func (self Otto) Run(src interface{}) (Value, error)
 ```
+
 Run will run the given source (parsing it first if necessary), returning the
 resulting value and error (if any)
 
@@ -556,11 +577,12 @@ src may also be a Script.
 src may also be a Program, but if the AST has been modified, then runtime
 behavior is undefined.
 
-#### func (Otto) Set
+### func (Otto) Set
 
 ```go
 func (self Otto) Set(name string, value interface{}) error
 ```
+
 Set the top-level binding of the given name to the given value.
 
 Set will automatically apply ToValue to the given value in order to convert it
@@ -571,44 +593,44 @@ fails), then an error is returned.
 
 If the top-level binding does not exist, it will be created.
 
-#### func (Otto) ToValue
+### func (Otto) ToValue
 
 ```go
 func (self Otto) ToValue(value interface{}) (Value, error)
 ```
+
 ToValue will convert an interface{} value to a value digestible by
 otto/JavaScript.
 
-#### type Script
+### type Script
 
 ```go
-type Script struct {
-}
+type Script struct {}
 ```
 
 Script is a handle for some (reusable) JavaScript. Passing a Script value to a
 run method will evaluate the JavaScript.
 
-#### func (*Script) String
+### func (*Script) String
 
 ```go
 func (self *Script) String() string
 ```
 
-#### type Value
+### type Value
 
 ```go
-type Value struct {
-}
+type Value struct {}
 ```
 
 Value is the representation of a JavaScript value.
 
-#### func  FalseValue
+### func FalseValue
 
 ```go
 func FalseValue() Value
 ```
+
 FalseValue will return a value representing false.
 
 It is equivalent to:
@@ -617,11 +639,12 @@ It is equivalent to:
 ToValue(false)
 ```
 
-#### func  NaNValue
+### func  NaNValue
 
 ```go
 func NaNValue() Value
 ```
+
 NaNValue will return a value representing NaN.
 
 It is equivalent to:
@@ -630,29 +653,32 @@ It is equivalent to:
 ToValue(math.NaN())
 ```
 
-#### func  NullValue
+### func  NullValue
 
 ```go
 func NullValue() Value
 ```
+
 NullValue will return a Value representing null.
 
-#### func  ToValue
+### func  ToValue
 
 ```go
 func ToValue(value interface{}) (Value, error)
 ```
+
 ToValue will convert an interface{} value to a value digestible by
 otto/JavaScript
 
 This function will not work for advanced types (struct, map, slice/array, etc.)
 and you should use Otto.ToValue instead.
 
-#### func  TrueValue
+### func  TrueValue
 
 ```go
 func TrueValue() Value
 ```
+
 TrueValue will return a value representing true.
 
 It is equivalent to:
@@ -661,39 +687,45 @@ It is equivalent to:
 ToValue(true)
 ```
 
-#### func  UndefinedValue
+### func UndefinedValue
 
 ```go
 func UndefinedValue() Value
 ```
+
 UndefinedValue will return a Value representing undefined.
 
-#### func (Value) Call
+### func (Value) Call
 
 ```go
 func (value Value) Call(this Value, argumentList ...interface{}) (Value, error)
 ```
+
 Call the value as a function with the given this value and argument list and
 return the result of invocation. It is essentially equivalent to:
 
+```js
     value.apply(thisValue, argumentList)
+```
 
 An undefined value and an error will result if:
 
-    1. There is an error during conversion of the argument list
-    2. The value is not actually a function
-    3. An (uncaught) exception is thrown
+1. There is an error during conversion of the argument list
+2. The value is not actually a function
+3. An (uncaught) exception is thrown
 
-#### func (Value) Class
+### func (Value) Class
 
 ```go
 func (value Value) Class() string
 ```
+
 Class will return the class string of the value or the empty string if value is
 not an object.
 
 The return value will (generally) be one of:
 
+```plaintext
     Object
     Function
     Array
@@ -702,12 +734,14 @@ The return value will (generally) be one of:
     Boolean
     Date
     RegExp
+```
 
-#### func (Value) Export
+### func (Value) Export
 
 ```go
 func (self Value) Export() (interface{}, error)
 ```
+
 Export will attempt to convert the value to a Go representation and return it
 via an interface{} kind.
 
@@ -716,6 +750,7 @@ compatibility.
 
 If a reasonable conversion is not possible, then the original value is returned.
 
+```plaintext
     undefined   -> nil (FIXME?: Should be Value{})
     null        -> nil
     boolean     -> bool
@@ -723,155 +758,177 @@ If a reasonable conversion is not possible, then the original value is returned.
     string      -> string
     Array       -> []interface{}
     Object      -> map[string]interface{}
+```
 
-#### func (Value) IsBoolean
+### func (Value) IsBoolean
 
 ```go
 func (value Value) IsBoolean() bool
 ```
+
 IsBoolean will return true if value is a boolean (primitive).
 
-#### func (Value) IsDefined
+### func (Value) IsDefined
 
 ```go
 func (value Value) IsDefined() bool
 ```
+
 IsDefined will return false if the value is undefined, and true otherwise.
 
-#### func (Value) IsFunction
+### func (Value) IsFunction
 
 ```go
 func (value Value) IsFunction() bool
 ```
+
 IsFunction will return true if value is a function.
 
-#### func (Value) IsNaN
+### func (Value) IsNaN
 
 ```go
 func (value Value) IsNaN() bool
 ```
+
 IsNaN will return true if value is NaN (or would convert to NaN).
 
-#### func (Value) IsNull
+### func (Value) IsNull
 
 ```go
 func (value Value) IsNull() bool
 ```
+
 IsNull will return true if the value is null, and false otherwise.
 
-#### func (Value) IsNumber
+### func (Value) IsNumber
 
 ```go
 func (value Value) IsNumber() bool
 ```
+
 IsNumber will return true if value is a number (primitive).
 
-#### func (Value) IsObject
+### func (Value) IsObject
 
 ```go
 func (value Value) IsObject() bool
 ```
+
 IsObject will return true if value is an object.
 
-#### func (Value) IsPrimitive
+### func (Value) IsPrimitive
 
 ```go
 func (value Value) IsPrimitive() bool
 ```
+
 IsPrimitive will return true if value is a primitive (any kind of primitive).
 
-#### func (Value) IsString
+### func (Value) IsString
 
 ```go
 func (value Value) IsString() bool
 ```
+
 IsString will return true if value is a string (primitive).
 
-#### func (Value) IsUndefined
+### func (Value) IsUndefined
 
 ```go
 func (value Value) IsUndefined() bool
 ```
+
 IsUndefined will return true if the value is undefined, and false otherwise.
 
-#### func (Value) Object
+### func (Value) Object
 
 ```go
 func (value Value) Object() *Object
 ```
+
 Object will return the object of the value, or nil if value is not an object.
 
 This method will not do any implicit conversion. For example, calling this
 method on a string primitive value will not return a String object.
 
-#### func (Value) String
+### func (Value) String
 
 ```go
 func (value Value) String() string
 ```
+
 String will return the value as a string.
 
 This method will make return the empty string if there is an error.
 
-#### func (Value) ToBoolean
+### func (Value) ToBoolean
 
 ```go
 func (value Value) ToBoolean() (bool, error)
 ```
+
 ToBoolean will convert the value to a boolean (bool).
 
+```plaintext
     ToValue(0).ToBoolean() => false
     ToValue("").ToBoolean() => false
     ToValue(true).ToBoolean() => true
     ToValue(1).ToBoolean() => true
     ToValue("Nothing happens").ToBoolean() => true
+```
 
 If there is an error during the conversion process (like an uncaught exception),
 then the result will be false and an error.
 
-#### func (Value) ToFloat
+### func (Value) ToFloat
 
 ```go
 func (value Value) ToFloat() (float64, error)
 ```
+
 ToFloat will convert the value to a number (float64).
 
+```plaintext
     ToValue(0).ToFloat() => 0.
     ToValue(1.1).ToFloat() => 1.1
     ToValue("11").ToFloat() => 11.
+```
 
 If there is an error during the conversion process (like an uncaught exception),
 then the result will be 0 and an error.
 
-#### func (Value) ToInteger
+### func (Value) ToInteger
 
 ```go
 func (value Value) ToInteger() (int64, error)
 ```
+
 ToInteger will convert the value to a number (int64).
 
+```plaintext
     ToValue(0).ToInteger() => 0
     ToValue(1.1).ToInteger() => 1
     ToValue("11").ToInteger() => 11
+```
 
 If there is an error during the conversion process (like an uncaught exception),
 then the result will be 0 and an error.
 
-#### func (Value) ToString
+### func (Value) ToString
 
 ```go
 func (value Value) ToString() (string, error)
 ```
+
 ToString will convert the value to a string (string).
 
+```plaintext
     ToValue(0).ToString() => "0"
     ToValue(false).ToString() => "false"
     ToValue(1.1).ToString() => "1.1"
     ToValue("11").ToString() => "11"
     ToValue('Nothing happens.').ToString() => "Nothing happens."
+```
 
 If there is an error during the conversion process (like an uncaught exception),
 then the result will be the empty string ("") and an error.
-
---
-**godocdown** http://github.com/robertkrimen/godocdown

+ 1 - 1
vendor/github.com/robertkrimen/otto/ast/comments.go

@@ -38,8 +38,8 @@ const (
 
 // Comment contains the data of the comment.
 type Comment struct {
-	Begin    file.Idx
 	Text     string
+	Begin    file.Idx
 	Position CommentPosition
 }
 

+ 46 - 50
vendor/github.com/robertkrimen/otto/ast/node.go

@@ -24,9 +24,9 @@ type Expression interface {
 
 // ArrayLiteral represents an array literal.
 type ArrayLiteral struct {
+	Value        []Expression
 	LeftBracket  file.Idx
 	RightBracket file.Idx
-	Value        []Expression
 }
 
 // Idx0 implements Node.
@@ -44,9 +44,9 @@ func (*ArrayLiteral) expression() {}
 
 // AssignExpression represents an assignment expression.
 type AssignExpression struct {
-	Operator token.Token
 	Left     Expression
 	Right    Expression
+	Operator token.Token
 }
 
 // Idx0 implements Node.
@@ -83,9 +83,9 @@ func (*BadExpression) expression() {}
 
 // BinaryExpression represents a binary expression.
 type BinaryExpression struct {
-	Operator   token.Token
 	Left       Expression
 	Right      Expression
+	Operator   token.Token
 	Comparison bool
 }
 
@@ -104,8 +104,8 @@ func (*BinaryExpression) expression() {}
 
 // BooleanLiteral represents a boolean expression.
 type BooleanLiteral struct {
-	Idx     file.Idx
 	Literal string
+	Idx     file.Idx
 	Value   bool
 }
 
@@ -146,8 +146,8 @@ func (*BracketExpression) expression() {}
 // CallExpression represents a call expression.
 type CallExpression struct {
 	Callee           Expression
-	LeftParenthesis  file.Idx
 	ArgumentList     []Expression
+	LeftParenthesis  file.Idx
 	RightParenthesis file.Idx
 }
 
@@ -224,13 +224,12 @@ func (*EmptyExpression) expression() {}
 
 // FunctionLiteral represents a function literal.
 type FunctionLiteral struct {
-	Function      file.Idx
-	Name          *Identifier
-	ParameterList *ParameterList
-	Body          Statement
-	Source        string
-
+	Body            Statement
+	Name            *Identifier
+	ParameterList   *ParameterList
+	Source          string
 	DeclarationList []Declaration
+	Function        file.Idx
 }
 
 // Idx0 implements Node.
@@ -267,10 +266,10 @@ func (*Identifier) expression() {}
 
 // NewExpression represents a new expression.
 type NewExpression struct {
-	New              file.Idx
 	Callee           Expression
-	LeftParenthesis  file.Idx
 	ArgumentList     []Expression
+	New              file.Idx
+	LeftParenthesis  file.Idx
 	RightParenthesis file.Idx
 }
 
@@ -292,8 +291,8 @@ func (*NewExpression) expression() {}
 
 // NullLiteral represents a null literal.
 type NullLiteral struct {
-	Idx     file.Idx
 	Literal string
+	Idx     file.Idx
 }
 
 // Idx0 implements Node.
@@ -311,9 +310,9 @@ func (*NullLiteral) expression() {}
 
 // NumberLiteral represents a number literal.
 type NumberLiteral struct {
-	Idx     file.Idx
-	Literal string
 	Value   interface{}
+	Literal string
+	Idx     file.Idx
 }
 
 // Idx0 implements Node.
@@ -331,9 +330,9 @@ func (*NumberLiteral) expression() {}
 
 // ObjectLiteral represents an object literal.
 type ObjectLiteral struct {
+	Value      []Property
 	LeftBrace  file.Idx
 	RightBrace file.Idx
-	Value      []Property
 }
 
 // Idx0 implements Node.
@@ -351,25 +350,25 @@ func (*ObjectLiteral) expression() {}
 
 // ParameterList represents a parameter list.
 type ParameterList struct {
-	Opening file.Idx
 	List    []*Identifier
+	Opening file.Idx
 	Closing file.Idx
 }
 
 // Property represents a property.
 type Property struct {
+	Value Expression
 	Key   string
 	Kind  string
-	Value Expression
 }
 
 // RegExpLiteral represents a regular expression literal.
 type RegExpLiteral struct {
-	Idx     file.Idx
 	Literal string
 	Pattern string
 	Flags   string
 	Value   string
+	Idx     file.Idx
 }
 
 // Idx0 implements Node.
@@ -405,9 +404,9 @@ func (*SequenceExpression) expression() {}
 
 // StringLiteral represents a string literal.
 type StringLiteral struct {
-	Idx     file.Idx
 	Literal string
 	Value   string
+	Idx     file.Idx
 }
 
 // Idx0 implements Node.
@@ -443,9 +442,9 @@ func (*ThisExpression) expression() {}
 
 // UnaryExpression represents a unary expression.
 type UnaryExpression struct {
-	Operator token.Token
-	Idx      file.Idx // If a prefix operation
 	Operand  Expression
+	Operator token.Token
+	Idx      file.Idx
 	Postfix  bool
 }
 
@@ -470,9 +469,9 @@ func (*UnaryExpression) expression() {}
 
 // VariableExpression represents a variable expression.
 type VariableExpression struct {
+	Initializer Expression
 	Name        string
 	Idx         file.Idx
-	Initializer Expression
 }
 
 // Idx0 implements Node.
@@ -518,8 +517,8 @@ func (*BadStatement) statement() {}
 
 // BlockStatement represents a block statement.
 type BlockStatement struct {
-	LeftBrace  file.Idx
 	List       []Statement
+	LeftBrace  file.Idx
 	RightBrace file.Idx
 }
 
@@ -538,9 +537,9 @@ func (*BlockStatement) statement() {}
 
 // BranchStatement represents a branch statement.
 type BranchStatement struct {
+	Label *Identifier
 	Idx   file.Idx
 	Token token.Token
-	Label *Identifier
 }
 
 // Idx0 implements Node.
@@ -561,9 +560,9 @@ func (*BranchStatement) statement() {}
 
 // CaseStatement represents a case statement.
 type CaseStatement struct {
-	Case       file.Idx
 	Test       Expression
 	Consequent []Statement
+	Case       file.Idx
 }
 
 // Idx0 implements Node.
@@ -581,9 +580,9 @@ func (*CaseStatement) statement() {}
 
 // CatchStatement represents a catch statement.
 type CatchStatement struct {
-	Catch     file.Idx
-	Parameter *Identifier
 	Body      Statement
+	Parameter *Identifier
+	Catch     file.Idx
 }
 
 // Idx0 implements Node.
@@ -619,9 +618,9 @@ func (*DebuggerStatement) statement() {}
 
 // DoWhileStatement represents a do while statement.
 type DoWhileStatement struct {
-	Do               file.Idx
 	Test             Expression
 	Body             Statement
+	Do               file.Idx
 	RightParenthesis file.Idx
 }
 
@@ -676,10 +675,10 @@ func (*ExpressionStatement) statement() {}
 
 // ForInStatement represents a for in statement.
 type ForInStatement struct {
-	For    file.Idx
 	Into   Expression
 	Source Expression
 	Body   Statement
+	For    file.Idx
 }
 
 // Idx0 implements Node.
@@ -697,11 +696,11 @@ func (*ForInStatement) statement() {}
 
 // ForStatement represents a for statement.
 type ForStatement struct {
-	For         file.Idx
 	Initializer Expression
 	Update      Expression
 	Test        Expression
 	Body        Statement
+	For         file.Idx
 }
 
 // Idx0 implements Node.
@@ -737,10 +736,10 @@ func (*FunctionStatement) statement() {}
 
 // IfStatement represents a if statement.
 type IfStatement struct {
-	If         file.Idx
 	Test       Expression
 	Consequent Statement
 	Alternate  Statement
+	If         file.Idx
 }
 
 // Idx0 implements Node.
@@ -761,9 +760,9 @@ func (*IfStatement) statement() {}
 
 // LabelledStatement represents a labelled statement.
 type LabelledStatement struct {
+	Statement Statement
 	Label     *Identifier
 	Colon     file.Idx
-	Statement Statement
 }
 
 // Idx0 implements Node.
@@ -781,8 +780,8 @@ func (*LabelledStatement) statement() {}
 
 // ReturnStatement represents a return statement.
 type ReturnStatement struct {
-	Return   file.Idx
 	Argument Expression
+	Return   file.Idx
 }
 
 // Idx0 implements Node.
@@ -803,10 +802,10 @@ func (*ReturnStatement) statement() {}
 
 // SwitchStatement represents a switch statement.
 type SwitchStatement struct {
-	Switch       file.Idx
 	Discriminant Expression
-	Default      int
 	Body         []*CaseStatement
+	Switch       file.Idx
+	Default      int
 	RightBrace   file.Idx
 }
 
@@ -825,8 +824,8 @@ func (*SwitchStatement) statement() {}
 
 // ThrowStatement represents a throw statement.
 type ThrowStatement struct {
-	Throw    file.Idx
 	Argument Expression
+	Throw    file.Idx
 }
 
 // Idx0 implements Node.
@@ -844,10 +843,10 @@ func (*ThrowStatement) statement() {}
 
 // TryStatement represents a try statement.
 type TryStatement struct {
-	Try     file.Idx
 	Body    Statement
-	Catch   *CatchStatement
 	Finally Statement
+	Catch   *CatchStatement
+	Try     file.Idx
 }
 
 // Idx0 implements Node.
@@ -868,8 +867,8 @@ func (*TryStatement) statement() {}
 
 // VariableStatement represents a variable statement.
 type VariableStatement struct {
-	Var  file.Idx
 	List []Expression
+	Var  file.Idx
 }
 
 // Idx0 implements Node.
@@ -887,9 +886,9 @@ func (*VariableStatement) statement() {}
 
 // WhileStatement represents a while statement.
 type WhileStatement struct {
-	While file.Idx
 	Test  Expression
 	Body  Statement
+	While file.Idx
 }
 
 // Idx0 implements Node.
@@ -907,9 +906,9 @@ func (*WhileStatement) statement() {}
 
 // WithStatement represents a with statement.
 type WithStatement struct {
-	With   file.Idx
 	Object Expression
 	Body   Statement
+	With   file.Idx
 }
 
 // Idx0 implements Node.
@@ -939,8 +938,8 @@ func (*FunctionDeclaration) declaration() {}
 
 // VariableDeclaration represents a variable declaration.
 type VariableDeclaration struct {
-	Var  file.Idx
 	List []*VariableExpression
+	Var  file.Idx
 }
 
 // declaration implements Declaration.
@@ -948,13 +947,10 @@ func (*VariableDeclaration) declaration() {}
 
 // Program represents a full program.
 type Program struct {
-	Body []Statement
-
+	File            *file.File
+	Comments        CommentMap
+	Body            []Statement
 	DeclarationList []Declaration
-
-	File *file.File
-
-	Comments CommentMap
 }
 
 // Idx0 implements Node.

+ 4 - 5
vendor/github.com/robertkrimen/otto/builtin.go

@@ -147,11 +147,11 @@ func builtinGlobalParseFloat(call FunctionCall) Value {
 	value, err := strconv.ParseFloat(input, 64)
 	if err != nil {
 		for end := len(input); end > 0; end-- {
-			input := input[0:end]
-			if !parseFloatMatchValid.MatchString(input) {
+			val := input[0:end]
+			if !parseFloatMatchValid.MatchString(val) {
 				return NaNValue()
 			}
-			value, err = strconv.ParseFloat(input, 64)
+			value, err = strconv.ParseFloat(val, 64)
 			if err == nil {
 				break
 			}
@@ -200,8 +200,7 @@ func encodeDecodeURI(call FunctionCall, escape *regexp.Regexp) Value {
 		}
 		index++
 		size := utf8.EncodeRune(encode, decode[0])
-		encode := encode[0:size]
-		output = append(output, encode...)
+		output = append(output, encode[0:size]...)
 	}
 
 	bytes := escape.ReplaceAllFunc(output, func(target []byte) []byte {

+ 13 - 13
vendor/github.com/robertkrimen/otto/builtin_array.go

@@ -43,7 +43,7 @@ func builtinArrayToLocaleString(call FunctionCall) Value {
 		return stringValue("")
 	}
 	stringList := make([]string, 0, length)
-	for index := int64(0); index < length; index++ {
+	for index := range length {
 		value := thisObject.get(arrayIndexToString(index))
 		stringValue := ""
 		switch value.kind {
@@ -71,7 +71,7 @@ func builtinArrayConcat(call FunctionCall) Value {
 			obj := item.object()
 			if isArray(obj) {
 				length := obj.get(propertyLength).number().int64
-				for index := int64(0); index < length; index++ {
+				for index := range length {
 					name := strconv.FormatInt(index, 10)
 					if obj.hasProperty(name) {
 						valueArray = append(valueArray, obj.get(name))
@@ -151,7 +151,7 @@ func builtinArrayJoin(call FunctionCall) Value {
 		return stringValue("")
 	}
 	stringList := make([]string, 0, length)
-	for index := int64(0); index < length; index++ {
+	for index := range length {
 		value := thisObject.get(arrayIndexToString(index))
 		stringValue := ""
 		switch value.kind {
@@ -175,7 +175,7 @@ func builtinArraySplice(call FunctionCall) Value {
 	}
 	valueArray := make([]Value, deleteCount)
 
-	for index := int64(0); index < deleteCount; index++ {
+	for index := range deleteCount {
 		indexString := arrayIndexToString(start + index)
 		if thisObject.hasProperty(indexString) {
 			valueArray[index] = thisObject.get(indexString)
@@ -236,7 +236,7 @@ func builtinArraySplice(call FunctionCall) Value {
 		}
 	}
 
-	for index := int64(0); index < itemCount; index++ {
+	for index := range itemCount {
 		thisObject.put(arrayIndexToString(index+start), itemList[index], true)
 	}
 	thisObject.put(propertyLength, int64Value(length+itemCount-deleteCount), true)
@@ -257,7 +257,7 @@ func builtinArraySlice(call FunctionCall) Value {
 	sliceLength := end - start
 	sliceValueArray := make([]Value, sliceLength)
 
-	for index := int64(0); index < sliceLength; index++ {
+	for index := range sliceLength {
 		from := arrayIndexToString(index + start)
 		if thisObject.hasProperty(from) {
 			sliceValueArray[index] = thisObject.get(from)
@@ -283,7 +283,7 @@ func builtinArrayUnshift(call FunctionCall) Value {
 		}
 	}
 
-	for index := int64(0); index < itemCount; index++ {
+	for index := range itemCount {
 		thisObject.put(arrayIndexToString(index), itemList[index], true)
 	}
 
@@ -339,9 +339,9 @@ func builtinArrayReverse(call FunctionCall) Value {
 func sortCompare(thisObject *object, index0, index1 uint, compare *object) int {
 	j := struct {
 		name    string
+		value   string
 		exists  bool
 		defined bool
-		value   string
 	}{}
 	k := j
 	j.name = arrayIndexToString(int64(index0))
@@ -531,7 +531,7 @@ func builtinArrayEvery(call FunctionCall) Value {
 	if iterator := call.Argument(0); iterator.isCallable() {
 		length := int64(toUint32(thisObject.get(propertyLength)))
 		callThis := call.Argument(1)
-		for index := int64(0); index < length; index++ {
+		for index := range length {
 			if key := arrayIndexToString(index); thisObject.hasProperty(key) {
 				if value := thisObject.get(key); iterator.call(call.runtime, callThis, value, int64Value(index), this).bool() {
 					continue
@@ -550,7 +550,7 @@ func builtinArraySome(call FunctionCall) Value {
 	if iterator := call.Argument(0); iterator.isCallable() {
 		length := int64(toUint32(thisObject.get(propertyLength)))
 		callThis := call.Argument(1)
-		for index := int64(0); index < length; index++ {
+		for index := range length {
 			if key := arrayIndexToString(index); thisObject.hasProperty(key) {
 				if value := thisObject.get(key); iterator.call(call.runtime, callThis, value, int64Value(index), this).bool() {
 					return trueValue
@@ -568,7 +568,7 @@ func builtinArrayForEach(call FunctionCall) Value {
 	if iterator := call.Argument(0); iterator.isCallable() {
 		length := int64(toUint32(thisObject.get(propertyLength)))
 		callThis := call.Argument(1)
-		for index := int64(0); index < length; index++ {
+		for index := range length {
 			if key := arrayIndexToString(index); thisObject.hasProperty(key) {
 				iterator.call(call.runtime, callThis, thisObject.get(key), int64Value(index), this)
 			}
@@ -585,7 +585,7 @@ func builtinArrayMap(call FunctionCall) Value {
 		length := int64(toUint32(thisObject.get(propertyLength)))
 		callThis := call.Argument(1)
 		values := make([]Value, length)
-		for index := int64(0); index < length; index++ {
+		for index := range length {
 			if key := arrayIndexToString(index); thisObject.hasProperty(key) {
 				values[index] = iterator.call(call.runtime, callThis, thisObject.get(key), index, this)
 			} else {
@@ -604,7 +604,7 @@ func builtinArrayFilter(call FunctionCall) Value {
 		length := int64(toUint32(thisObject.get(propertyLength)))
 		callThis := call.Argument(1)
 		values := make([]Value, 0)
-		for index := int64(0); index < length; index++ {
+		for index := range length {
 			if key := arrayIndexToString(index); thisObject.hasProperty(key) {
 				value := thisObject.get(key)
 				if iterator.call(call.runtime, callThis, value, index, this).bool() {

+ 20 - 20
vendor/github.com/robertkrimen/otto/builtin_date.go

@@ -22,12 +22,12 @@ var utcTimeZone = time.FixedZone("GMT", 0)
 
 func builtinDate(call FunctionCall) Value {
 	date := &dateObject{}
-	date.Set(newDateTime([]Value{}, time.Local)) //nolint: gosmopolitan
+	date.Set(newDateTime([]Value{}, time.Local)) //nolint:gosmopolitan
 	return stringValue(date.Time().Format(builtinDateDateTimeLayout))
 }
 
 func builtinNewDate(obj *object, argumentList []Value) Value {
-	return objectValue(obj.runtime.newDate(newDateTime(argumentList, time.Local))) //nolint: gosmopolitan
+	return objectValue(obj.runtime.newDate(newDateTime(argumentList, time.Local))) //nolint:gosmopolitan
 }
 
 func builtinDateToString(call FunctionCall) Value {
@@ -35,7 +35,7 @@ func builtinDateToString(call FunctionCall) Value {
 	if date.isNaN {
 		return stringValue("Invalid Date")
 	}
-	return stringValue(date.Time().Local().Format(builtinDateDateTimeLayout)) //nolint: gosmopolitan
+	return stringValue(date.Time().Local().Format(builtinDateDateTimeLayout)) //nolint:gosmopolitan
 }
 
 func builtinDateToDateString(call FunctionCall) Value {
@@ -43,7 +43,7 @@ func builtinDateToDateString(call FunctionCall) Value {
 	if date.isNaN {
 		return stringValue("Invalid Date")
 	}
-	return stringValue(date.Time().Local().Format(builtinDateDateLayout)) //nolint: gosmopolitan
+	return stringValue(date.Time().Local().Format(builtinDateDateLayout)) //nolint:gosmopolitan
 }
 
 func builtinDateToTimeString(call FunctionCall) Value {
@@ -51,7 +51,7 @@ func builtinDateToTimeString(call FunctionCall) Value {
 	if date.isNaN {
 		return stringValue("Invalid Date")
 	}
-	return stringValue(date.Time().Local().Format(builtinDateTimeLayout)) //nolint: gosmopolitan
+	return stringValue(date.Time().Local().Format(builtinDateTimeLayout)) //nolint:gosmopolitan
 }
 
 func builtinDateToUTCString(call FunctionCall) Value {
@@ -129,7 +129,7 @@ func builtinDateBeforeSet(call FunctionCall, argumentLimit int, timeLocal bool)
 	}
 
 	valueList := make([]int, argumentLimit)
-	for index := 0; index < argumentLimit; index++ {
+	for index := range argumentLimit {
 		value := call.ArgumentList[index]
 		nm := value.number()
 		switch nm.kind {
@@ -142,7 +142,7 @@ func builtinDateBeforeSet(call FunctionCall, argumentLimit int, timeLocal bool)
 	}
 	baseTime := date.Time()
 	if timeLocal {
-		baseTime = baseTime.Local() //nolint: gosmopolitan
+		baseTime = baseTime.Local() //nolint:gosmopolitan
 	}
 	ecmaTime := newEcmaTime(baseTime)
 	return obj, &date, &ecmaTime, valueList
@@ -168,7 +168,7 @@ func builtinDateToLocaleString(call FunctionCall) Value {
 	if date.isNaN {
 		return stringValue("Invalid Date")
 	}
-	return stringValue(date.Time().Local().Format("2006-01-02 15:04:05")) //nolint: gosmopolitan
+	return stringValue(date.Time().Local().Format("2006-01-02 15:04:05")) //nolint:gosmopolitan
 }
 
 // This is a placeholder.
@@ -177,7 +177,7 @@ func builtinDateToLocaleDateString(call FunctionCall) Value {
 	if date.isNaN {
 		return stringValue("Invalid Date")
 	}
-	return stringValue(date.Time().Local().Format("2006-01-02")) //nolint: gosmopolitan
+	return stringValue(date.Time().Local().Format("2006-01-02")) //nolint:gosmopolitan
 }
 
 // This is a placeholder.
@@ -186,7 +186,7 @@ func builtinDateToLocaleTimeString(call FunctionCall) Value {
 	if date.isNaN {
 		return stringValue("Invalid Date")
 	}
-	return stringValue(date.Time().Local().Format("15:04:05")) //nolint: gosmopolitan
+	return stringValue(date.Time().Local().Format("15:04:05")) //nolint:gosmopolitan
 }
 
 func builtinDateValueOf(call FunctionCall) Value {
@@ -204,7 +204,7 @@ func builtinDateGetYear(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(date.Time().Local().Year() - 1900) //nolint: gosmopolitan
+	return intValue(date.Time().Local().Year() - 1900) //nolint:gosmopolitan
 }
 
 func builtinDateGetFullYear(call FunctionCall) Value {
@@ -214,7 +214,7 @@ func builtinDateGetFullYear(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(date.Time().Local().Year()) //nolint: gosmopolitan
+	return intValue(date.Time().Local().Year()) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCFullYear(call FunctionCall) Value {
@@ -230,7 +230,7 @@ func builtinDateGetMonth(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(dateFromGoMonth(date.Time().Local().Month())) //nolint: gosmopolitan
+	return intValue(dateFromGoMonth(date.Time().Local().Month())) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCMonth(call FunctionCall) Value {
@@ -246,7 +246,7 @@ func builtinDateGetDate(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(date.Time().Local().Day()) //nolint: gosmopolitan
+	return intValue(date.Time().Local().Day()) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCDate(call FunctionCall) Value {
@@ -263,7 +263,7 @@ func builtinDateGetDay(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(dateFromGoDay(date.Time().Local().Weekday())) //nolint: gosmopolitan
+	return intValue(dateFromGoDay(date.Time().Local().Weekday())) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCDay(call FunctionCall) Value {
@@ -279,7 +279,7 @@ func builtinDateGetHours(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(date.Time().Local().Hour()) //nolint: gosmopolitan
+	return intValue(date.Time().Local().Hour()) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCHours(call FunctionCall) Value {
@@ -295,7 +295,7 @@ func builtinDateGetMinutes(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(date.Time().Local().Minute()) //nolint: gosmopolitan
+	return intValue(date.Time().Local().Minute()) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCMinutes(call FunctionCall) Value {
@@ -311,7 +311,7 @@ func builtinDateGetSeconds(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(date.Time().Local().Second()) //nolint: gosmopolitan
+	return intValue(date.Time().Local().Second()) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCSeconds(call FunctionCall) Value {
@@ -327,7 +327,7 @@ func builtinDateGetMilliseconds(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	return intValue(date.Time().Local().Nanosecond() / (100 * 100 * 100)) //nolint: gosmopolitan
+	return intValue(date.Time().Local().Nanosecond() / (100 * 100 * 100)) //nolint:gosmopolitan
 }
 
 func builtinDateGetUTCMilliseconds(call FunctionCall) Value {
@@ -343,7 +343,7 @@ func builtinDateGetTimezoneOffset(call FunctionCall) Value {
 	if date.isNaN {
 		return NaNValue()
 	}
-	timeLocal := date.Time().Local() //nolint: gosmopolitan
+	timeLocal := date.Time().Local() //nolint:gosmopolitan
 	// Is this kosher?
 	timeLocalAsUTC := time.Date(
 		timeLocal.Year(),

+ 1 - 1
vendor/github.com/robertkrimen/otto/builtin_function.go

@@ -85,7 +85,7 @@ func builtinFunctionApply(call FunctionCall) Value {
 	thisObject := call.thisObject()
 	length := int64(toUint32(arrayObject.get(propertyLength)))
 	valueArray := make([]Value, length)
-	for index := int64(0); index < length; index++ {
+	for index := range length {
 		valueArray[index] = arrayObject.get(arrayIndexToString(index))
 	}
 	return thisObject.call(this, valueArray, false, nativeFrame)

+ 22 - 22
vendor/github.com/robertkrimen/otto/builtin_json.go

@@ -8,8 +8,8 @@ import (
 )
 
 type builtinJSONParseContext struct {
-	call    FunctionCall
 	reviver Value
+	call    FunctionCall
 }
 
 func builtinJSONParse(call FunctionCall) Value {
@@ -44,22 +44,22 @@ func builtinJSONReviveWalk(ctx builtinJSONParseContext, holder *object, name str
 	if obj := value.object(); obj != nil {
 		if isArray(obj) {
 			length := int64(objectLength(obj))
-			for index := int64(0); index < length; index++ {
-				name := arrayIndexToString(index)
-				value := builtinJSONReviveWalk(ctx, obj, name)
-				if value.IsUndefined() {
-					obj.delete(name, false)
+			for index := range length {
+				idxName := arrayIndexToString(index)
+				idxValue := builtinJSONReviveWalk(ctx, obj, idxName)
+				if idxValue.IsUndefined() {
+					obj.delete(idxName, false)
 				} else {
-					obj.defineProperty(name, value, 0o111, false)
+					obj.defineProperty(idxName, idxValue, 0o111, false)
 				}
 			}
 		} else {
 			obj.enumerate(false, func(name string) bool {
-				value := builtinJSONReviveWalk(ctx, obj, name)
-				if value.IsUndefined() {
+				enumVal := builtinJSONReviveWalk(ctx, obj, name)
+				if enumVal.IsUndefined() {
 					obj.delete(name, false)
 				} else {
-					obj.defineProperty(name, value, 0o111, false)
+					obj.defineProperty(name, enumVal, 0o111, false)
 				}
 				return true
 			})
@@ -99,11 +99,11 @@ func builtinJSONParseWalk(ctx builtinJSONParseContext, rawValue interface{}) (Va
 }
 
 type builtinJSONStringifyContext struct {
-	call             FunctionCall
-	stack            []*object
-	propertyList     []string
 	replacerFunction *Value
 	gap              string
+	stack            []*object
+	propertyList     []string
+	call             FunctionCall
 }
 
 func builtinJSONStringify(call FunctionCall) Value {
@@ -241,19 +241,19 @@ func builtinJSONStringifyWalk(ctx builtinJSONStringifyContext, key string, holde
 	case valueNull:
 		return nil, true
 	case valueObject:
-		holder := value.object()
+		objHolder := value.object()
 		if value := value.object(); nil != value {
 			for _, obj := range ctx.stack {
-				if holder == obj {
+				if objHolder == obj {
 					panic(ctx.call.runtime.panicTypeError("Converting circular structure to JSON"))
 				}
 			}
 			ctx.stack = append(ctx.stack, value)
 			defer func() { ctx.stack = ctx.stack[:len(ctx.stack)-1] }()
 		}
-		if isArray(holder) {
+		if isArray(objHolder) {
 			var length uint32
-			switch value := holder.get(propertyLength).value.(type) {
+			switch value := objHolder.get(propertyLength).value.(type) {
 			case uint32:
 				length = value
 			case int:
@@ -266,15 +266,15 @@ func builtinJSONStringifyWalk(ctx builtinJSONStringifyContext, key string, holde
 			array := make([]interface{}, length)
 			for index := range array {
 				name := arrayIndexToString(int64(index))
-				value, _ := builtinJSONStringifyWalk(ctx, name, holder)
+				value, _ := builtinJSONStringifyWalk(ctx, name, objHolder)
 				array[index] = value
 			}
 			return array, true
-		} else if holder.class != classFunctionName {
+		} else if objHolder.class != classFunctionName {
 			obj := map[string]interface{}{}
 			if ctx.propertyList != nil {
 				for _, name := range ctx.propertyList {
-					value, exists := builtinJSONStringifyWalk(ctx, name, holder)
+					value, exists := builtinJSONStringifyWalk(ctx, name, objHolder)
 					if exists {
 						obj[name] = value
 					}
@@ -282,8 +282,8 @@ func builtinJSONStringifyWalk(ctx builtinJSONStringifyContext, key string, holde
 			} else {
 				// Go maps are without order, so this doesn't conform to the ECMA ordering
 				// standard, but oh well...
-				holder.enumerate(false, func(name string) bool {
-					value, exists := builtinJSONStringifyWalk(ctx, name, holder)
+				objHolder.enumerate(false, func(name string) bool {
+					value, exists := builtinJSONStringifyWalk(ctx, name, objHolder)
 					if exists {
 						obj[name] = value
 					}

+ 1 - 1
vendor/github.com/robertkrimen/otto/builtin_math.go

@@ -166,7 +166,7 @@ func builtinMathRandom(call FunctionCall) Value {
 	if call.runtime.random != nil {
 		v = call.runtime.random()
 	} else {
-		v = rand.Float64() //nolint: gosec
+		v = rand.Float64() //nolint:gosec
 	}
 	return float64Value(v)
 }

+ 11 - 0
vendor/github.com/robertkrimen/otto/builtin_object.go

@@ -273,6 +273,17 @@ func builtinObjectKeys(call FunctionCall) Value {
 	panic(call.runtime.panicTypeError("Object.Keys is nil"))
 }
 
+func builtinObjectValues(call FunctionCall) Value {
+	if obj, values := call.Argument(0).object(), []Value(nil); nil != obj {
+		obj.enumerate(false, func(name string) bool {
+			values = append(values, obj.get(name))
+			return true
+		})
+		return objectValue(call.runtime.newArrayOf(values))
+	}
+	panic(call.runtime.panicTypeError("Object.Values is nil"))
+}
+
 func builtinObjectGetOwnPropertyNames(call FunctionCall) Value {
 	if obj, propertyNames := call.Argument(0).object(), []Value(nil); nil != obj {
 		obj.enumerate(true, func(name string) bool {

+ 18 - 6
vendor/github.com/robertkrimen/otto/builtin_string.go

@@ -163,7 +163,7 @@ func builtinStringMatch(call FunctionCall) Value {
 	}
 	matchCount := len(result)
 	valueArray := make([]Value, matchCount)
-	for index := 0; index < matchCount; index++ {
+	for index := range matchCount {
 		valueArray[index] = stringValue(target[result[index][0]:result[index][1]])
 	}
 	matcher.put("lastIndex", intValue(result[matchCount-1][1]), true)
@@ -246,7 +246,7 @@ func builtinStringReplace(call FunctionCall) Value {
 			}
 			matchCount := len(match) / 2
 			argumentList := make([]Value, matchCount+2)
-			for index := 0; index < matchCount; index++ {
+			for index := range matchCount {
 				offset := 2 * index
 				if match[offset] != -1 {
 					argumentList[index] = stringValue(target[match[offset]:match[offset+1]])
@@ -254,7 +254,9 @@ func builtinStringReplace(call FunctionCall) Value {
 					argumentList[index] = Value{}
 				}
 			}
-			argumentList[matchCount+0] = intValue(match[0])
+			// Replace expects rune offsets not byte offsets.
+			startIndex := utf8.RuneCountInString(target[0:match[0]])
+			argumentList[matchCount+0] = intValue(startIndex)
 			argumentList[matchCount+1] = stringValue(target)
 			replacement := replace.call(Value{}, argumentList, false, nativeFrame).string()
 			result = append(result, []byte(replacement)...)
@@ -394,16 +396,18 @@ func builtinStringSplit(call FunctionCall) Value {
 	}
 }
 
+// builtinStringSlice returns the string sliced by the given values
+// which are rune not byte offsets, as per String.prototype.slice.
 func builtinStringSlice(call FunctionCall) Value {
 	checkObjectCoercible(call.runtime, call.This)
-	target := call.This.string()
+	target := []rune(call.This.string())
 
 	length := int64(len(target))
 	start, end := rangeStartEnd(call.ArgumentList, length, false)
 	if end-start <= 0 {
 		return stringValue("")
 	}
-	return stringValue(target[start:end])
+	return stringValue(string(target[start:end]))
 }
 
 func builtinStringSubstring(call FunctionCall) Value {
@@ -473,6 +477,14 @@ func builtinStringTrim(call FunctionCall) Value {
 		builtinStringTrimWhitespace))
 }
 
+func builtinStringTrimStart(call FunctionCall) Value {
+	return builtinStringTrimLeft(call)
+}
+
+func builtinStringTrimEnd(call FunctionCall) Value {
+	return builtinStringTrimRight(call)
+}
+
 // Mozilla extension, not ECMAScript 5.
 func builtinStringTrimLeft(call FunctionCall) Value {
 	checkObjectCoercible(call.runtime, call.This)
@@ -489,7 +501,7 @@ func builtinStringTrimRight(call FunctionCall) Value {
 
 func builtinStringLocaleCompare(call FunctionCall) Value {
 	checkObjectCoercible(call.runtime, call.This)
-	this := call.This.string() //nolint: ifshort
+	this := call.This.string() //nolint:ifshort
 	that := call.Argument(0).string()
 	if this < that {
 		return intValue(-1)

+ 5 - 5
vendor/github.com/robertkrimen/otto/cmpl_evaluate_statement.go

@@ -134,7 +134,7 @@ func (rt *runtime) cmplEvaluateNodeStatementList(list []nodeStatement) Value {
 }
 
 func (rt *runtime) cmplEvaluateNodeDoWhileStatement(node *nodeDoWhileStatement) Value {
-	labels := append(rt.labels, "") //nolint: gocritic
+	labels := append(rt.labels, "") //nolint:gocritic
 	rt.labels = nil
 
 	test := node.test
@@ -169,7 +169,7 @@ resultBreak:
 }
 
 func (rt *runtime) cmplEvaluateNodeForInStatement(node *nodeForInStatement) Value {
-	labels := append(rt.labels, "") //nolint: gocritic
+	labels := append(rt.labels, "") //nolint:gocritic
 	rt.labels = nil
 
 	source := rt.cmplEvaluateNodeExpression(node.source)
@@ -231,7 +231,7 @@ func (rt *runtime) cmplEvaluateNodeForInStatement(node *nodeForInStatement) Valu
 }
 
 func (rt *runtime) cmplEvaluateNodeForStatement(node *nodeForStatement) Value {
-	labels := append(rt.labels, "") //nolint: gocritic
+	labels := append(rt.labels, "") //nolint:gocritic
 	rt.labels = nil
 
 	initializer := node.initializer
@@ -304,7 +304,7 @@ func (rt *runtime) cmplEvaluateNodeIfStatement(node *nodeIfStatement) Value {
 }
 
 func (rt *runtime) cmplEvaluateNodeSwitchStatement(node *nodeSwitchStatement) Value {
-	labels := append(rt.labels, "") //nolint: gocritic
+	labels := append(rt.labels, "") //nolint:gocritic
 	rt.labels = nil
 
 	discriminantResult := rt.cmplEvaluateNodeExpression(node.discriminant)
@@ -384,7 +384,7 @@ func (rt *runtime) cmplEvaluateNodeTryStatement(node *nodeTryStatement) Value {
 func (rt *runtime) cmplEvaluateModeWhileStatement(node *nodeWhileStatement) Value {
 	test := node.test
 	body := node.body
-	labels := append(rt.labels, "") //nolint: gocritic
+	labels := append(rt.labels, "") //nolint:gocritic
 	rt.labels = nil
 
 	result := emptyValue

+ 17 - 19
vendor/github.com/robertkrimen/otto/cmpl_parse.go

@@ -391,12 +391,10 @@ func (cmpl *compiler) parse() *nodeProgram {
 }
 
 type nodeProgram struct {
-	body []nodeStatement
-
+	file         *file.File
+	body         []nodeStatement
 	varList      []string
 	functionList []*nodeFunctionLiteral
-
-	file *file.File
 }
 
 type node interface{}
@@ -412,22 +410,22 @@ type (
 	}
 
 	nodeAssignExpression struct {
-		operator token.Token
 		left     nodeExpression
 		right    nodeExpression
+		operator token.Token
 	}
 
 	nodeBinaryExpression struct {
-		operator   token.Token
 		left       nodeExpression
 		right      nodeExpression
+		operator   token.Token
 		comparison bool
 	}
 
 	nodeBracketExpression struct {
-		idx    file.Idx
 		left   nodeExpression
 		member nodeExpression
+		idx    file.Idx
 	}
 
 	nodeCallExpression struct {
@@ -442,24 +440,24 @@ type (
 	}
 
 	nodeDotExpression struct {
-		idx        file.Idx
 		left       nodeExpression
 		identifier string
+		idx        file.Idx
 	}
 
 	nodeFunctionLiteral struct {
-		name          string
 		body          nodeStatement
+		file          *file.File
+		name          string
 		source        string
 		parameterList []string
 		varList       []string
 		functionList  []*nodeFunctionLiteral
-		file          *file.File
 	}
 
 	nodeIdentifier struct {
-		idx  file.Idx
 		name string
+		idx  file.Idx
 	}
 
 	nodeLiteral struct {
@@ -476,9 +474,9 @@ type (
 	}
 
 	nodeProperty struct {
+		value nodeExpression
 		key   string
 		kind  string
-		value nodeExpression
 	}
 
 	nodeRegExpLiteral struct {
@@ -493,15 +491,15 @@ type (
 	nodeThisExpression struct{}
 
 	nodeUnaryExpression struct {
-		operator token.Token
 		operand  nodeExpression
+		operator token.Token
 		postfix  bool
 	}
 
 	nodeVariableExpression struct {
-		idx         file.Idx
-		name        string
 		initializer nodeExpression
+		name        string
+		idx         file.Idx
 	}
 )
 
@@ -516,8 +514,8 @@ type (
 	}
 
 	nodeBranchStatement struct {
-		branch token.Token
 		label  string
+		branch token.Token
 	}
 
 	nodeCaseStatement struct {
@@ -526,8 +524,8 @@ type (
 	}
 
 	nodeCatchStatement struct {
-		parameter string
 		body      nodeStatement
+		parameter string
 	}
 
 	nodeDebuggerStatement struct{}
@@ -563,8 +561,8 @@ type (
 	}
 
 	nodeLabelledStatement struct {
-		label     string
 		statement nodeStatement
+		label     string
 	}
 
 	nodeReturnStatement struct {
@@ -573,8 +571,8 @@ type (
 
 	nodeSwitchStatement struct {
 		discriminant nodeExpression
-		defaultIdx   int
 		body         []*nodeCaseStatement
+		defaultIdx   int
 	}
 
 	nodeThrowStatement struct {

+ 2 - 2
vendor/github.com/robertkrimen/otto/console.go

@@ -15,12 +15,12 @@ func formatForConsole(argumentList []Value) string {
 }
 
 func builtinConsoleLog(call FunctionCall) Value {
-	fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList))
+	fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList)) //nolint:errcheck // Nothing we can do if this fails.
 	return Value{}
 }
 
 func builtinConsoleError(call FunctionCall) Value {
-	fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList))
+	fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList)) //nolint:errcheck // Nothing we can do if this fails.
 	return Value{}
 }
 

+ 5 - 5
vendor/github.com/robertkrimen/otto/error.go

@@ -50,13 +50,13 @@ func (e ottoError) formatWithStack() string {
 }
 
 type frame struct {
-	native     bool
+	fn         interface{}
+	file       *file.File
 	nativeFile string
+	callee     string
 	nativeLine int
-	file       *file.File
 	offset     int
-	callee     string
-	fn         interface{}
+	native     bool
 }
 
 var nativeFrame = frame{}
@@ -148,7 +148,7 @@ func newError(rt *runtime, name string, stackFramesToPop int, in ...interface{})
 	if rt != nil && rt.scope != nil {
 		curScope := rt.scope
 
-		for i := 0; i < stackFramesToPop; i++ {
+		for range stackFramesToPop {
 			if curScope.outer != nil {
 				curScope = curScope.outer
 			}

+ 3 - 3
vendor/github.com/robertkrimen/otto/evaluate.go

@@ -8,7 +8,7 @@ import (
 	"github.com/robertkrimen/otto/token"
 )
 
-func (rt *runtime) evaluateMultiply(left float64, right float64) Value { //nolint: unused
+func (rt *runtime) evaluateMultiply(left float64, right float64) Value { //nolint:unused
 	// TODO 11.5.1
 	return Value{}
 }
@@ -44,7 +44,7 @@ func (rt *runtime) evaluateDivide(left float64, right float64) Value {
 	return float64Value(left / right)
 }
 
-func (rt *runtime) evaluateModulo(left float64, right float64) Value { //nolint: unused
+func (rt *runtime) evaluateModulo(left float64, right float64) Value { //nolint:unused
 	// TODO 11.5.3
 	return Value{}
 }
@@ -255,7 +255,7 @@ func (rt *runtime) calculateComparison(comparator token.Token, left Value, right
 			panic(fmt.Sprintf("unknown types for equal: %v ==? %v", x, y))
 		}
 	default:
-		panic(fmt.Sprintf("unknown comparator %s", comparator.String()))
+		panic("unknown comparator " + comparator.String())
 	}
 
 	if kindEqualKind {

+ 4 - 4
vendor/github.com/robertkrimen/otto/file/file.go

@@ -49,9 +49,9 @@ func (p *Position) String() string {
 }
 
 // A FileSet represents a set of source files.
-type FileSet struct { //nolint: golint
-	files []*File
+type FileSet struct {
 	last  *File
+	files []*File
 }
 
 // AddFile adds a new file with the given filename and src.
@@ -99,10 +99,10 @@ func (fs *FileSet) Position(idx Idx) *Position {
 
 // File represents a file to parse.
 type File struct {
+	sm   *sourcemap.Consumer
 	name string
 	src  string
-	base int // This will always be 1 or greater
-	sm   *sourcemap.Consumer
+	base int
 }
 
 // NewFile returns a new file with the given filename, src and base.

+ 1 - 1
vendor/github.com/robertkrimen/otto/global.go

@@ -79,7 +79,7 @@ func (o *object) primitiveValue() Value {
 	return Value{}
 }
 
-func (o *object) hasPrimitive() bool { //nolint: unused
+func (o *object) hasPrimitive() bool { //nolint:unused
 	switch o.value.(type) {
 	case Value, stringObjecter:
 		return true

+ 114 - 0
vendor/github.com/robertkrimen/otto/inline.go

@@ -902,6 +902,43 @@ func (rt *runtime) newContext() {
 					},
 				},
 			},
+			"values": {
+				mode: 0o101,
+				value: Value{
+					kind: valueObject,
+					value: &object{
+						runtime:     rt,
+						class:       classFunctionName,
+						objectClass: classObject,
+						prototype:   rt.global.FunctionPrototype,
+						extensible:  true,
+						property: map[string]property{
+							propertyLength: {
+								mode: 0,
+								value: Value{
+									kind:  valueNumber,
+									value: 1,
+								},
+							},
+							propertyName: {
+								mode: 0,
+								value: Value{
+									kind:  valueString,
+									value: "values",
+								},
+							},
+						},
+						propertyOrder: []string{
+							propertyLength,
+							propertyName,
+						},
+						value: nativeFunctionObject{
+							name: "values",
+							call: builtinObjectValues,
+						},
+					},
+				},
+			},
 			"getOwnPropertyNames": {
 				mode: 0o101,
 				value: Value{
@@ -955,6 +992,7 @@ func (rt *runtime) newContext() {
 			"isFrozen",
 			"freeze",
 			"keys",
+			"values",
 			"getOwnPropertyNames",
 		},
 	}
@@ -2595,6 +2633,80 @@ func (rt *runtime) newContext() {
 					},
 				},
 			},
+			"trimStart": {
+				mode: 0o101,
+				value: Value{
+					kind: valueObject,
+					value: &object{
+						runtime:     rt,
+						class:       classFunctionName,
+						objectClass: classObject,
+						prototype:   rt.global.FunctionPrototype,
+						extensible:  true,
+						property: map[string]property{
+							propertyLength: {
+								mode: 0,
+								value: Value{
+									kind:  valueNumber,
+									value: 0,
+								},
+							},
+							propertyName: {
+								mode: 0,
+								value: Value{
+									kind:  valueString,
+									value: "trimStart",
+								},
+							},
+						},
+						propertyOrder: []string{
+							propertyLength,
+							propertyName,
+						},
+						value: nativeFunctionObject{
+							name: "trimStart",
+							call: builtinStringTrimStart,
+						},
+					},
+				},
+			},
+			"trimEnd": {
+				mode: 0o101,
+				value: Value{
+					kind: valueObject,
+					value: &object{
+						runtime:     rt,
+						class:       classFunctionName,
+						objectClass: classObject,
+						prototype:   rt.global.FunctionPrototype,
+						extensible:  true,
+						property: map[string]property{
+							propertyLength: {
+								mode: 0,
+								value: Value{
+									kind:  valueNumber,
+									value: 0,
+								},
+							},
+							propertyName: {
+								mode: 0,
+								value: Value{
+									kind:  valueString,
+									value: "trimEnd",
+								},
+							},
+						},
+						propertyOrder: []string{
+							propertyLength,
+							propertyName,
+						},
+						value: nativeFunctionObject{
+							name: "trimEnd",
+							call: builtinStringTrimEnd,
+						},
+					},
+				},
+			},
 			"toLocaleLowerCase": {
 				mode: 0o101,
 				value: Value{
@@ -2802,6 +2914,8 @@ func (rt *runtime) newContext() {
 			"trim",
 			"trimLeft",
 			"trimRight",
+			"trimStart",
+			"trimEnd",
 			"toLocaleLowerCase",
 			"toLocaleUpperCase",
 			"toLowerCase",

+ 7 - 10
vendor/github.com/robertkrimen/otto/object.go

@@ -1,17 +1,14 @@
 package otto
 
 type object struct {
-	runtime *runtime
-
-	class       string
-	objectClass *objectClass
-	value       interface{}
-
-	prototype  *object
-	extensible bool
-
+	value         interface{}
+	runtime       *runtime
+	objectClass   *objectClass
+	prototype     *object
 	property      map[string]property
+	class         string
 	propertyOrder []string
+	extensible    bool
 }
 
 func newObject(rt *runtime, class string) *object {
@@ -101,7 +98,7 @@ func (o *object) String() string {
 	return o.DefaultValue(defaultValueHintString).string()
 }
 
-func (o *object) defineProperty(name string, value Value, mode propertyMode, throw bool) bool { //nolint: unparam
+func (o *object) defineProperty(name string, value Value, mode propertyMode, throw bool) bool { //nolint:unparam
 	return o.defineOwnProperty(name, property{value, mode}, throw)
 }
 

+ 1 - 1
vendor/github.com/robertkrimen/otto/object_class.go

@@ -198,7 +198,7 @@ func objectCanPut(obj *object, name string) bool {
 	return canPut
 }
 
-func objectCanPutDetails(obj *object, name string) (canPut bool, prop *property, setter *object) { //nolint: nonamedreturns
+func objectCanPutDetails(obj *object, name string) (canPut bool, prop *property, setter *object) { //nolint:nonamedreturns
 	prop = obj.getOwnProperty(name)
 	if prop != nil {
 		switch propertyValue := prop.value.(type) {

+ 12 - 13
vendor/github.com/robertkrimen/otto/otto.go

@@ -221,7 +221,7 @@ package otto
 
 import (
 	"encoding/json"
-	"fmt"
+	"errors"
 	"strings"
 
 	"github.com/robertkrimen/otto/file"
@@ -417,13 +417,13 @@ func (o Otto) MakeTypeError(message string) Value {
 // Context is a structure that contains information about the current execution
 // context.
 type Context struct {
+	This       Value
+	Symbols    map[string]Value
 	Filename   string
-	Line       int
-	Column     int
 	Callee     string
-	Symbols    map[string]Value
-	This       Value
 	Stacktrace []string
+	Line       int
+	Column     int
 }
 
 // Context returns the current execution context of the vm, traversing up to
@@ -552,12 +552,11 @@ func (o Otto) Call(source string, this interface{}, argumentList ...interface{})
 		program, err := o.runtime.cmplParse("", source+"()", nil)
 		if err == nil {
 			if node, ok := program.body[0].(*nodeExpressionStatement); ok {
-				if node, ok := node.expression.(*nodeCallExpression); ok {
+				if node, ok2 := node.expression.(*nodeCallExpression); ok2 {
 					var value Value
-					err := catchPanic(func() {
+					if err = catchPanic(func() {
 						value = o.runtime.cmplEvaluateNodeCallExpression(node, argumentList)
-					})
-					if err != nil {
+					}); err != nil {
 						return Value{}, err
 					}
 					return value, nil
@@ -579,9 +578,9 @@ func (o Otto) Call(source string, this interface{}, argumentList ...interface{})
 	}
 
 	if construct {
-		result, err := fn.constructSafe(o.runtime, val, argumentList...)
-		if err != nil {
-			return Value{}, err
+		result, err2 := fn.constructSafe(o.runtime, val, argumentList...)
+		if err2 != nil {
+			return Value{}, err2
 		}
 		return result, nil
 	}
@@ -618,7 +617,7 @@ func (o Otto) Object(source string) (*Object, error) {
 	if value.IsObject() {
 		return value.Object(), nil
 	}
-	return nil, fmt.Errorf("value is not an object")
+	return nil, errors.New("value is not an object")
 }
 
 // ToValue will convert an interface{} value to a value digestible by otto/JavaScript.

+ 4 - 4
vendor/github.com/robertkrimen/otto/otto_.go

@@ -95,7 +95,7 @@ func valueToRangeIndex(indexValue Value, length int64, negativeIsZero bool) int6
 	return index
 }
 
-func rangeStartEnd(array []Value, size int64, negativeIsZero bool) (start, end int64) { //nolint: nonamedreturns
+func rangeStartEnd(array []Value, size int64, negativeIsZero bool) (start, end int64) { //nolint:nonamedreturns
 	start = valueToRangeIndex(valueOfArrayIndex(array, 0), size, negativeIsZero)
 	if len(array) == 1 {
 		// If there is only the start argument, then end = size
@@ -113,7 +113,7 @@ func rangeStartEnd(array []Value, size int64, negativeIsZero bool) (start, end i
 	return
 }
 
-func rangeStartLength(source []Value, size int64) (start, length int64) { //nolint: nonamedreturns
+func rangeStartLength(source []Value, size int64) (start, length int64) { //nolint:nonamedreturns
 	start = valueToRangeIndex(valueOfArrayIndex(source, 0), size, false)
 
 	// Assume the second argument is missing or undefined
@@ -132,9 +132,9 @@ func rangeStartLength(source []Value, size int64) (start, length int64) { //noli
 }
 
 func hereBeDragons(arguments ...interface{}) string {
-	pc, _, _, _ := goruntime.Caller(1) //nolint: dogsled
+	pc, _, _, _ := goruntime.Caller(1) //nolint:dogsled
 	name := goruntime.FuncForPC(pc).Name()
-	message := fmt.Sprintf("Here be dragons -- %s", name)
+	message := "Here be dragons -- " + name
 	if len(arguments) > 0 {
 		message += ": "
 		argument0 := fmt.Sprintf("%s", arguments[0])

+ 3 - 3
vendor/github.com/robertkrimen/otto/parser/error.go

@@ -49,8 +49,8 @@ const (
 
 // An Error represents a parsing error. It includes the position where the error occurred and a message/description.
 type Error struct {
-	Position file.Position
 	Message  string
+	Position file.Position
 }
 
 // FIXME Should this be "SyntaxError"?
@@ -120,11 +120,11 @@ func (p *parser) errorUnexpectedToken(tkn token.Token) {
 }
 
 // ErrorList is a list of *Errors.
-type ErrorList []*Error //nolint: errname
+type ErrorList []*Error //nolint:errname
 
 // Add adds an Error with given position and message to an ErrorList.
 func (el *ErrorList) Add(position file.Position, msg string) {
-	*el = append(*el, &Error{position, msg})
+	*el = append(*el, &Error{Position: position, Message: msg})
 }
 
 // Reset resets an ErrorList to no errors.

+ 16 - 18
vendor/github.com/robertkrimen/otto/parser/expression.go

@@ -136,8 +136,8 @@ func (p *parser) parseRegExpLiteral() *ast.RegExpLiteral {
 	flags := ""
 	if p.token == token.IDENTIFIER { // gim
 		flags = p.literal
+		endOffset = p.chrOffset
 		p.next()
-		endOffset = p.chrOffset - 1
 	}
 
 	var value string
@@ -268,7 +268,7 @@ func (p *parser) parseObjectProperty() ast.Property {
 	literal, value := p.parseObjectPropertyKey()
 	if literal == "get" && p.token != token.COLON {
 		idx := p.idx
-		_, value := p.parseObjectPropertyKey()
+		_, value = p.parseObjectPropertyKey()
 		parameterList := p.parseFunctionParameterList()
 
 		node := &ast.FunctionLiteral{
@@ -283,7 +283,7 @@ func (p *parser) parseObjectProperty() ast.Property {
 		}
 	} else if literal == "set" && p.token != token.COLON {
 		idx := p.idx
-		_, value := p.parseObjectPropertyKey()
+		_, value = p.parseObjectPropertyKey()
 		parameterList := p.parseFunctionParameterList()
 
 		node := &ast.FunctionLiteral{
@@ -379,26 +379,24 @@ func (p *parser) parseArrayLiteral() ast.Expression {
 	}
 }
 
-func (p *parser) parseArgumentList() (argumentList []ast.Expression, idx0, idx1 file.Idx) { //nolint: nonamedreturns
+func (p *parser) parseArgumentList() (argumentList []ast.Expression, idx0, idx1 file.Idx) { //nolint:nonamedreturns
 	if p.mode&StoreComments != 0 {
 		p.comments.Unset()
 	}
 	idx0 = p.expect(token.LEFT_PARENTHESIS)
-	if p.token != token.RIGHT_PARENTHESIS {
-		for {
-			exp := p.parseAssignmentExpression()
-			if p.mode&StoreComments != 0 {
-				p.comments.SetExpression(exp)
-			}
-			argumentList = append(argumentList, exp)
-			if p.token != token.COMMA {
-				break
-			}
-			if p.mode&StoreComments != 0 {
-				p.comments.Unset()
-			}
-			p.next()
+	for p.token != token.RIGHT_PARENTHESIS {
+		exp := p.parseAssignmentExpression()
+		if p.mode&StoreComments != 0 {
+			p.comments.SetExpression(exp)
+		}
+		argumentList = append(argumentList, exp)
+		if p.token != token.COMMA {
+			break
 		}
+		if p.mode&StoreComments != 0 {
+			p.comments.Unset()
+		}
+		p.next()
 	}
 	if p.mode&StoreComments != 0 {
 		p.comments.Unset()

+ 66 - 19
vendor/github.com/robertkrimen/otto/parser/lexer.go

@@ -15,7 +15,7 @@ import (
 	"github.com/robertkrimen/otto/token"
 )
 
-type chr struct { //nolint: unused
+type chr struct { //nolint:unused
 	value rune
 	width int
 }
@@ -38,6 +38,53 @@ func digitValue(chr rune) int {
 	return 16 // Larger than any legal digit value
 }
 
+// See https://www.unicode.org/reports/tr31/ for reference on ID_Start and ID_Continue.
+var includeIDStart = []*unicode.RangeTable{
+	unicode.Lu,
+	unicode.Ll,
+	unicode.Lt,
+	unicode.Lm,
+	unicode.Lo,
+	unicode.Nl,
+	unicode.Other_ID_Start,
+}
+
+var includeIDContinue = []*unicode.RangeTable{
+	unicode.Lu,
+	unicode.Ll,
+	unicode.Lt,
+	unicode.Lm,
+	unicode.Lo,
+	unicode.Nl,
+	unicode.Other_ID_Start,
+	unicode.Mn,
+	unicode.Mc,
+	unicode.Nd,
+	unicode.Pc,
+	unicode.Other_ID_Continue,
+}
+
+var exclude = []*unicode.RangeTable{
+	unicode.Pattern_Syntax,
+	unicode.Pattern_White_Space,
+}
+
+func unicodeIDStart(r rune) bool {
+	if unicode.In(r, exclude...) {
+		return false
+	}
+
+	return unicode.In(r, includeIDStart...)
+}
+
+func unicodeIDContinue(r rune) bool {
+	if unicode.In(r, exclude...) {
+		return false
+	}
+
+	return unicode.In(r, includeIDContinue...)
+}
+
 func isDigit(chr rune, base int) bool {
 	return digitValue(chr) < base
 }
@@ -45,14 +92,14 @@ func isDigit(chr rune, base int) bool {
 func isIdentifierStart(chr rune) bool {
 	return chr == '$' || chr == '_' || chr == '\\' ||
 		'a' <= chr && chr <= 'z' || 'A' <= chr && chr <= 'Z' ||
-		chr >= utf8.RuneSelf && unicode.IsLetter(chr)
+		chr >= utf8.RuneSelf && unicodeIDStart(chr)
 }
 
 func isIdentifierPart(chr rune) bool {
 	return chr == '$' || chr == '_' || chr == '\\' ||
 		'a' <= chr && chr <= 'z' || 'A' <= chr && chr <= 'Z' ||
 		'0' <= chr && chr <= '9' ||
-		chr >= utf8.RuneSelf && (unicode.IsLetter(chr) || unicode.IsDigit(chr))
+		chr >= utf8.RuneSelf && unicodeIDContinue(chr)
 }
 
 func (p *parser) scanIdentifier() (string, error) {
@@ -67,7 +114,7 @@ func (p *parser) scanIdentifier() (string, error) {
 			}
 			parse = true
 			var value rune
-			for j := 0; j < 4; j++ {
+			for range 4 {
 				p.read()
 				decimal, ok := hex2decimal(byte(p.chr))
 				if !ok {
@@ -98,7 +145,7 @@ func (p *parser) scanIdentifier() (string, error) {
 }
 
 // 7.2.
-func isLineWhiteSpace(chr rune) bool { //nolint: unused, deadcode
+func isLineWhiteSpace(chr rune) bool { //nolint:unused, deadcode
 	switch chr {
 	case '\u0009', '\u000b', '\u000c', '\u0020', '\u00a0', '\ufeff':
 		return true
@@ -119,7 +166,7 @@ func isLineTerminator(chr rune) bool {
 	return false
 }
 
-func (p *parser) scan() (tkn token.Token, literal string, idx file.Idx) { //nolint: nonamedreturns
+func (p *parser) scan() (tkn token.Token, literal string, idx file.Idx) { //nolint:nonamedreturns
 	p.implicitSemicolon = false
 
 	for {
@@ -236,16 +283,16 @@ func (p *parser) scan() (tkn token.Token, literal string, idx file.Idx) { //noli
 				switch p.chr {
 				case '/':
 					if p.mode&StoreComments != 0 {
-						literal := string(p.readSingleLineComment())
-						p.comments.AddComment(ast.NewComment(literal, idx))
+						comment := string(p.readSingleLineComment())
+						p.comments.AddComment(ast.NewComment(comment, idx))
 						continue
 					}
 					p.skipSingleLineComment()
 					continue
 				case '*':
 					if p.mode&StoreComments != 0 {
-						literal = string(p.readMultiLineComment())
-						p.comments.AddComment(ast.NewComment(literal, idx))
+						comment := string(p.readMultiLineComment())
+						p.comments.AddComment(ast.NewComment(comment, idx))
 						continue
 					}
 					p.skipMultiLineComment()
@@ -366,7 +413,7 @@ func (p *parser) switch6(tkn0, tkn1 token.Token, chr2 rune, tkn2, tkn3 token.Tok
 	return tkn0
 }
 
-func (p *parser) chrAt(index int) chr { //nolint: unused
+func (p *parser) chrAt(index int) chr { //nolint:unused
 	value, width := utf8.DecodeRuneInString(p.str[index:])
 	return chr{
 		value: value,
@@ -611,7 +658,7 @@ func hex2decimal(chr byte) (rune, bool) {
 	}
 }
 
-func parseNumberLiteral(literal string) (value interface{}, err error) { //nolint: nonamedreturns
+func parseNumberLiteral(literal string) (value interface{}, err error) { //nolint:nonamedreturns
 	// TODO Is Uint okay? What about -MAX_UINT
 	value, err = strconv.ParseInt(literal, 0, 64)
 	if err == nil {
@@ -717,7 +764,7 @@ func parseStringLiteral(literal string) (string, error) {
 				if len(str) < size {
 					return "", fmt.Errorf("invalid escape: \\%s: len(%q) != %d", string(chr), str, size)
 				}
-				for j := 0; j < size; j++ {
+				for j := range size {
 					decimal, ok := hex2decimal(str[j])
 					if !ok {
 						return "", fmt.Errorf("invalid escape: \\%s: %q", string(chr), str[:size])
@@ -745,8 +792,8 @@ func parseStringLiteral(literal string) (string, error) {
 					if len(str) < j+1 {
 						break
 					}
-					chr := str[j]
-					if '0' > chr || chr > '7' {
+
+					if ch := str[j]; '0' > ch || ch > '7' {
 						break
 					}
 					decimal := rune(str[j]) - '0'
@@ -787,7 +834,7 @@ func (p *parser) scanNumericLiteral(decimalPoint bool) (token.Token, string) {
 	}
 
 	if p.chr == '0' {
-		offset := p.chrOffset
+		chrOffset := p.chrOffset
 		p.read()
 		switch p.chr {
 		case 'x', 'X':
@@ -796,11 +843,11 @@ func (p *parser) scanNumericLiteral(decimalPoint bool) (token.Token, string) {
 			if isDigit(p.chr, 16) {
 				p.read()
 			} else {
-				return token.ILLEGAL, p.str[offset:p.chrOffset]
+				return token.ILLEGAL, p.str[chrOffset:p.chrOffset]
 			}
 			p.scanMantissa(16)
 
-			if p.chrOffset-offset <= 2 {
+			if p.chrOffset-chrOffset <= 2 {
 				// Only "0x" or "0X"
 				p.error(0, "Illegal hexadecimal number")
 			}
@@ -816,7 +863,7 @@ func (p *parser) scanNumericLiteral(decimalPoint bool) (token.Token, string) {
 			}
 			p.scanMantissa(8)
 			if p.chr == '8' || p.chr == '9' {
-				return token.ILLEGAL, p.str[offset:p.chrOffset]
+				return token.ILLEGAL, p.str[chrOffset:p.chrOffset]
 			}
 			goto octal
 		}

+ 21 - 30
vendor/github.com/robertkrimen/otto/parser/parser.go

@@ -56,36 +56,27 @@ const (
 	StoreComments
 )
 
-type parser struct { //nolint: maligned
-	str    string
-	length int
-	base   int
-
-	chr       rune // The current character
-	chrOffset int  // The offset of current character
-	offset    int  // The offset after current character (may be greater than 1)
-
-	idx     file.Idx    // The index of token
-	token   token.Token // The token
-	literal string      // The literal of the token, if any
-
-	scope             *scope
-	insertSemicolon   bool // If we see a newline, then insert an implicit semicolon
-	implicitSemicolon bool // An implicit semicolon exists
-
-	errors ErrorList
-
-	recover struct {
-		// Scratch when trying to seek to the next statement, etc.
+type parser struct {
+	comments *ast.Comments
+	file     *file.File
+	scope    *scope
+	literal  string
+	str      string
+	errors   ErrorList
+	recover  struct {
 		idx   file.Idx
 		count int
 	}
-
-	mode Mode
-
-	file *file.File
-
-	comments *ast.Comments
+	idx               file.Idx
+	token             token.Token
+	offset            int
+	chrOffset         int
+	mode              Mode
+	base              int
+	length            int
+	chr               rune
+	insertSemicolon   bool
+	implicitSemicolon bool // Scratch when trying to seek to the next statement, etc.
 }
 
 // Parser is implemented by types which can parse JavaScript Code.
@@ -131,13 +122,13 @@ func ReadSource(filename string, src interface{}) ([]byte, error) {
 			return nil, fmt.Errorf("invalid src type %T", src)
 		}
 	}
-	return os.ReadFile(filename) //nolint: gosec
+	return os.ReadFile(filename) //nolint:gosec
 }
 
 // ReadSourceMap reads the source map from src if not nil, otherwise is a noop.
 func ReadSourceMap(filename string, src interface{}) (*sourcemap.Consumer, error) {
 	if src == nil {
-		return nil, nil //nolint: nilnil
+		return nil, nil //nolint:nilnil
 	}
 
 	switch src := src.(type) {
@@ -173,7 +164,7 @@ func ParseFileWithSourceMap(fileSet *file.FileSet, filename string, javascriptSo
 		if bytes.HasPrefix(lastLine, []byte("//# sourceMappingURL=data:application/json")) {
 			bits := bytes.SplitN(lastLine, []byte(","), 2)
 			if len(bits) == 2 {
-				if d, err := base64.StdEncoding.DecodeString(string(bits[1])); err == nil {
+				if d, errDecode := base64.StdEncoding.DecodeString(string(bits[1])); errDecode == nil {
 					sourcemapSource = d
 				}
 			}

+ 11 - 14
vendor/github.com/robertkrimen/otto/parser/regexp.go

@@ -6,18 +6,15 @@ import (
 	"strconv"
 )
 
-type regExpParser struct { //nolint: maligned
-	str    string
-	length int
-
-	chr       rune // The current character
-	chrOffset int  // The offset of current character
-	offset    int  // The offset after current character (may be greater than 1)
-
-	errors  []error
-	invalid bool // The input is an invalid JavaScript RegExp
-
-	goRegexp *bytes.Buffer
+type regExpParser struct {
+	goRegexp  *bytes.Buffer
+	str       string
+	errors    []error
+	length    int
+	chrOffset int
+	offset    int
+	chr       rune
+	invalid   bool
 }
 
 // TransformRegExp transforms a JavaScript pattern into  a Go "regexp" pattern.
@@ -276,7 +273,7 @@ func (p *regExpParser) scanEscape(inClass bool) {
 			if err != nil {
 				p.errors = append(p.errors, err)
 			}
-		} else { //nolint: staticcheck
+		} else { //nolint:staticcheck
 			// Unescape the character for re2
 		}
 		p.pass()
@@ -346,7 +343,7 @@ func (p *regExpParser) pass() {
 }
 
 // TODO Better error reporting, use the offset, etc.
-func (p *regExpParser) error(offset int, msg string, msgValues ...interface{}) { //nolint: unparam
+func (p *regExpParser) error(offset int, msg string, msgValues ...interface{}) { //nolint:unparam
 	err := fmt.Errorf(msg, msgValues...)
 	p.errors = append(p.errors, err)
 }

+ 2 - 3
vendor/github.com/robertkrimen/otto/parser/scope.go

@@ -6,13 +6,12 @@ import (
 
 type scope struct {
 	outer           *scope
+	declarationList []ast.Declaration
+	labels          []string
 	allowIn         bool
 	inIteration     bool
 	inSwitch        bool
 	inFunction      bool
-	declarationList []ast.Declaration
-
-	labels []string
 }
 
 func (p *parser) openScope() {

+ 3 - 3
vendor/github.com/robertkrimen/otto/parser/statement.go

@@ -39,7 +39,7 @@ func (p *parser) parseEmptyStatement() ast.Statement {
 	return &ast.EmptyStatement{Semicolon: idx}
 }
 
-func (p *parser) parseStatementList() (list []ast.Statement) { //nolint: nonamedreturns
+func (p *parser) parseStatementList() (list []ast.Statement) { //nolint:nonamedreturns
 	for p.token != token.RIGHT_BRACE && p.token != token.EOF {
 		statement := p.parseStatement()
 		list = append(list, statement)
@@ -564,14 +564,14 @@ func (p *parser) parseForOrForInStatement() ast.Statement {
 		allowIn := p.scope.allowIn
 		p.scope.allowIn = false
 		if p.token == token.VAR {
-			idx := p.idx
+			tokenIdx := p.idx
 			var varComments []*ast.Comment
 			if p.mode&StoreComments != 0 {
 				varComments = p.comments.FetchAll()
 				p.comments.Unset()
 			}
 			p.next()
-			list := p.parseVariableDeclarationList(idx)
+			list := p.parseVariableDeclarationList(tokenIdx)
 			if len(list) == 1 && p.token == token.IN {
 				if p.mode&StoreComments != 0 {
 					p.comments.Unset()

+ 10 - 10
vendor/github.com/robertkrimen/otto/property.go

@@ -69,11 +69,11 @@ func (p *property) configureOff() {
 	p.mode &= ^modeConfigureMask
 }
 
-func (p property) configureSet() bool { //nolint: unused
+func (p property) configureSet() bool { //nolint:unused
 	return p.mode&modeConfigureMask&modeSetMask == 0
 }
 
-func (p property) copy() *property { //nolint: unused
+func (p property) copy() *property { //nolint:unused
 	cpy := p
 	return &cpy
 }
@@ -150,12 +150,12 @@ func toPropertyDescriptor(rt *runtime, value Value) property {
 	getterSetter := false
 
 	if objectDescriptor.hasProperty("get") {
-		value := objectDescriptor.get("get")
-		if value.IsDefined() {
-			if !value.isCallable() {
+		val := objectDescriptor.get("get")
+		if val.IsDefined() {
+			if !val.isCallable() {
 				panic(rt.panicTypeError("toPropertyDescriptor get not callable"))
 			}
-			getter = value.object()
+			getter = val.object()
 			getterSetter = true
 		} else {
 			getter = &nilGetSetObject
@@ -164,12 +164,12 @@ func toPropertyDescriptor(rt *runtime, value Value) property {
 	}
 
 	if objectDescriptor.hasProperty("set") {
-		value := objectDescriptor.get("set")
-		if value.IsDefined() {
-			if !value.isCallable() {
+		val := objectDescriptor.get("set")
+		if val.IsDefined() {
+			if !val.isCallable() {
 				panic(rt.panicTypeError("toPropertyDescriptor set not callable"))
 			}
-			setter = value.object()
+			setter = val.object()
 			getterSetter = true
 		} else {
 			setter = &nilGetSetObject

+ 1 - 1
vendor/github.com/robertkrimen/otto/registry/registry.go

@@ -7,8 +7,8 @@ var registry []*Entry = make([]*Entry, 0)
 
 // Entry represents a registry entry.
 type Entry struct {
-	active bool
 	source func() string
+	active bool
 }
 
 // newEntry returns a new Entry for source.

+ 4 - 4
vendor/github.com/robertkrimen/otto/result.go

@@ -10,19 +10,19 @@ const (
 )
 
 type result struct {
-	kind   resultKind
 	value  Value
 	target string
+	kind   resultKind
 }
 
 func newReturnResult(value Value) result {
-	return result{resultReturn, value, ""}
+	return result{kind: resultReturn, value: value, target: ""}
 }
 
 func newContinueResult(target string) result {
-	return result{resultContinue, emptyValue, target}
+	return result{kind: resultContinue, value: emptyValue, target: target}
 }
 
 func newBreakResult(target string) result {
-	return result{resultBreak, emptyValue, target}
+	return result{kind: resultBreak, value: emptyValue, target: target}
 }

+ 10 - 11
vendor/github.com/robertkrimen/otto/runtime.go

@@ -59,14 +59,13 @@ type runtime struct {
 	globalStash  *objectStash
 	scope        *scope
 	otto         *Otto
-	eval         *object // The builtin eval, for determine indirect versus direct invocation
+	eval         *object
 	debugger     func(*Otto)
 	random       func() float64
+	labels       []string
 	stackLimit   int
 	traceLimit   int
-
-	labels []string // FIXME
-	lck    sync.Mutex
+	lck          sync.Mutex
 }
 
 func (rt *runtime) enterScope(scop *scope) {
@@ -116,7 +115,7 @@ func (rt *runtime) putValue(reference referencer, value Value) {
 	}
 }
 
-func (rt *runtime) tryCatchEvaluate(inner func() Value) (tryValue Value, isException bool) { //nolint: nonamedreturns
+func (rt *runtime) tryCatchEvaluate(inner func() Value) (tryValue Value, isException bool) { //nolint:nonamedreturns
 	// resultValue = The value of the block (e.g. the last statement)
 	// throw = Something was thrown
 	// throwValue = The value of what was thrown
@@ -188,7 +187,7 @@ func checkObjectCoercible(rt *runtime, value Value) {
 }
 
 // testObjectCoercible.
-func testObjectCoercible(value Value) (isObject, mustCoerce bool) { //nolint: nonamedreturns
+func testObjectCoercible(value Value) (isObject, mustCoerce bool) { //nolint:nonamedreturns
 	switch value.kind {
 	case valueReference, valueEmpty, valueNull, valueUndefined:
 		return false, false
@@ -294,7 +293,7 @@ func fieldIndexByName(t reflect.Type, name string) []int {
 		t = t.Elem()
 	}
 
-	for i := 0; i < t.NumField(); i++ {
+	for i := range t.NumField() {
 		f := t.Field(i)
 
 		if !validGoStructName(f.Name) {
@@ -431,7 +430,7 @@ func (rt *runtime) convertCallParameter(v Value, t reflect.Type) (reflect.Value,
 
 				switch o.class {
 				case classArrayName:
-					for i := int64(0); i < l; i++ {
+					for i := range l {
 						p, ok := o.property[strconv.FormatInt(i, 10)]
 						if !ok {
 							continue
@@ -458,7 +457,7 @@ func (rt *runtime) convertCallParameter(v Value, t reflect.Type) (reflect.Value,
 						gslice = false
 					}
 
-					for i := int64(0); i < l; i++ {
+					for i := range l {
 						var p *property
 						if gslice {
 							p = goSliceGetOwnProperty(o, strconv.FormatInt(i, 10))
@@ -510,7 +509,7 @@ func (rt *runtime) convertCallParameter(v Value, t reflect.Type) (reflect.Value,
 		}
 	case reflect.Func:
 		if t.NumOut() > 1 {
-			return reflect.Zero(t), fmt.Errorf("converting JavaScript values to Go functions with more than one return value is currently not supported")
+			return reflect.Zero(t), errors.New("converting JavaScript values to Go functions with more than one return value is currently not supported")
 		}
 
 		if o := v.object(); o != nil && o.class == classFunctionName {
@@ -602,7 +601,7 @@ func (rt *runtime) convertCallParameter(v Value, t reflect.Type) (reflect.Value,
 	if v.kind == valueString {
 		var s encoding.TextUnmarshaler
 
-		if reflect.PtrTo(t).Implements(reflect.TypeOf(&s).Elem()) {
+		if reflect.PointerTo(t).Implements(reflect.TypeOf(&s).Elem()) {
 			r := reflect.New(t)
 
 			if err := r.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(v.string())); err != nil {

+ 2 - 3
vendor/github.com/robertkrimen/otto/scope.go

@@ -5,11 +5,10 @@ type scope struct {
 	lexical  stasher
 	variable stasher
 	this     *object
-	eval     bool // Replace this with kind?
 	outer    *scope
+	frame    frame
 	depth    int
-
-	frame frame
+	eval     bool
 }
 
 func newScope(lexical stasher, variable stasher, this *object) *scope {

+ 1 - 1
vendor/github.com/robertkrimen/otto/script.go

@@ -83,7 +83,7 @@ func (s *Script) marshalBinary() ([]byte, error) {
 // will return an error.
 //
 // The binary format can change at any time and should be considered unspecified and opaque.
-func (s *Script) unmarshalBinary(data []byte) (err error) { //nolint: nonamedreturns
+func (s *Script) unmarshalBinary(data []byte) (err error) { //nolint:nonamedreturns
 	decoder := gob.NewDecoder(bytes.NewReader(data))
 	defer func() {
 		if err != nil {

+ 8 - 8
vendor/github.com/robertkrimen/otto/stash.go

@@ -6,19 +6,19 @@ import (
 
 // stasher is implemented by types which can stash data.
 type stasher interface {
-	hasBinding(string) bool            //
-	createBinding(string, bool, Value) // CreateMutableBinding
-	setBinding(string, Value, bool)    // SetMutableBinding
-	getBinding(string, bool) Value     // GetBindingValue
-	deleteBinding(string) bool         //
-	setValue(string, Value, bool)      // createBinding + setBinding
+	hasBinding(name string) bool                            //
+	createBinding(name string, deletable bool, value Value) // CreateMutableBinding
+	setBinding(name string, value Value, strict bool)       // SetMutableBinding
+	getBinding(name string, throw bool) Value               // GetBindingValue
+	deleteBinding(name string) bool                         //
+	setValue(name string, value Value, throw bool)          // createBinding + setBinding
 
 	outer() stasher
 	runtime() *runtime
 
-	newReference(string, bool, at) referencer
+	newReference(name string, strict bool, atv at) referencer
 
-	clone(*cloner) stasher
+	clone(cloner *cloner) stasher
 }
 
 type objectStash struct {

+ 4 - 4
vendor/github.com/robertkrimen/otto/token/token.go

@@ -57,11 +57,11 @@ type keyword struct {
 //	public
 //	static
 func IsKeyword(literal string) (Token, bool) {
-	if keyword, exists := keywordTable[literal]; exists {
-		if keyword.futureKeyword {
-			return KEYWORD, keyword.strict
+	if kw, exists := keywordTable[literal]; exists {
+		if kw.futureKeyword {
+			return KEYWORD, kw.strict
 		}
-		return keyword.token, false
+		return kw.token, false
 	}
 	return 0, false
 }

+ 4 - 10
vendor/github.com/robertkrimen/otto/type_arguments.go

@@ -26,29 +26,23 @@ func (rt *runtime) newArgumentsObject(indexOfParameterName []string, stash stash
 }
 
 type argumentsObject struct {
+	stash                stasher
 	indexOfParameterName []string
-	// function(abc, def, ghi)
-	// indexOfParameterName[0] = "abc"
-	// indexOfParameterName[1] = "def"
-	// indexOfParameterName[2] = "ghi"
-	// ...
-	stash stasher
 }
 
 func (o argumentsObject) clone(c *cloner) argumentsObject {
 	indexOfParameterName := make([]string, len(o.indexOfParameterName))
 	copy(indexOfParameterName, o.indexOfParameterName)
 	return argumentsObject{
-		indexOfParameterName,
-		c.stash(o.stash),
+		indexOfParameterName: indexOfParameterName,
+		stash:                c.stash(o.stash),
 	}
 }
 
 func (o argumentsObject) get(name string) (Value, bool) {
 	index := stringToArrayIndex(name)
 	if index >= 0 && index < int64(len(o.indexOfParameterName)) {
-		name := o.indexOfParameterName[index]
-		if name == "" {
+		if name = o.indexOfParameterName[index]; name == "" {
 			return Value{}, false
 		}
 		return o.stash.getBinding(name, false), true

+ 11 - 11
vendor/github.com/robertkrimen/otto/type_date.go

@@ -8,9 +8,9 @@ import (
 )
 
 type dateObject struct {
-	time  Time.Time // Time from the "time" package, a cached version of time
-	epoch int64
+	time  Time.Time
 	value Value
+	epoch int64
 	isNaN bool
 }
 
@@ -22,6 +22,7 @@ var invalidDateObject = dateObject{
 }
 
 type ecmaTime struct {
+	location    *Time.Location
 	year        int
 	month       int
 	day         int
@@ -29,19 +30,18 @@ type ecmaTime struct {
 	minute      int
 	second      int
 	millisecond int
-	location    *Time.Location // Basically, either local or UTC
 }
 
 func newEcmaTime(goTime Time.Time) ecmaTime {
 	return ecmaTime{
-		goTime.Year(),
-		dateFromGoMonth(goTime.Month()),
-		goTime.Day(),
-		goTime.Hour(),
-		goTime.Minute(),
-		goTime.Second(),
-		goTime.Nanosecond() / (100 * 100 * 100),
-		goTime.Location(),
+		year:        goTime.Year(),
+		month:       dateFromGoMonth(goTime.Month()),
+		day:         goTime.Day(),
+		hour:        goTime.Hour(),
+		minute:      goTime.Minute(),
+		second:      goTime.Second(),
+		millisecond: goTime.Nanosecond() / (100 * 100 * 100),
+		location:    goTime.Location(),
 	}
 }
 

+ 7 - 8
vendor/github.com/robertkrimen/otto/type_function.go

@@ -27,11 +27,11 @@ type nativeFunction func(FunctionCall) Value
 
 // nativeFunctionObject.
 type nativeFunctionObject struct {
+	call      nativeFunction
+	construct constructFunction
 	name      string
 	file      string
 	line      int
-	call      nativeFunction    // [[Call]]
-	construct constructFunction // [[Construct]]
 }
 
 func (rt *runtime) newNativeFunctionProperty(name, file string, line int, native nativeFunction, length int) *object {
@@ -162,7 +162,7 @@ func (o *object) isCall() bool {
 	}
 }
 
-func (o *object) call(this Value, argumentList []Value, eval bool, frm frame) Value { //nolint: unparam // Isn't currently used except in recursive self.
+func (o *object) call(this Value, argumentList []Value, eval bool, frm frame) Value { //nolint:unparam // Isn't currently used except in recursive self.
 	switch fn := o.value.(type) {
 	case nativeFunctionObject:
 		// Since eval is a native function, we only have to check for it here
@@ -270,13 +270,12 @@ func (o *object) hasInstance(of Value) bool {
 
 // FunctionCall is an encapsulation of a JavaScript function call.
 type FunctionCall struct {
-	runtime *runtime
-	thisObj *object
-	eval    bool // This call is a direct call to eval
-
 	This         Value
-	ArgumentList []Value
+	runtime      *runtime
+	thisObj      *object
 	Otto         *Otto
+	ArgumentList []Value
+	eval         bool
 }
 
 // Argument will return the value of the argument at the given index.

+ 3 - 3
vendor/github.com/robertkrimen/otto/type_go_array.go

@@ -33,7 +33,7 @@ func newGoArrayObject(value reflect.Value) *goArrayObject {
 	}
 }
 
-func (o goArrayObject) getValue(name string) (reflect.Value, bool) { //nolint: unused
+func (o goArrayObject) getValue(name string) (reflect.Value, bool) { //nolint:unused
 	if index, err := strconv.ParseInt(name, 10, 64); err != nil {
 		v, ok := o.getValueIndex(index)
 		if ok {
@@ -41,7 +41,7 @@ func (o goArrayObject) getValue(name string) (reflect.Value, bool) { //nolint: u
 		}
 	}
 
-	if m := o.value.MethodByName(name); m != (reflect.Value{}) {
+	if m := o.value.MethodByName(name); m.IsValid() {
 		return m, true
 	}
 
@@ -93,7 +93,7 @@ func goArrayGetOwnProperty(obj *object, name string) *property {
 		}
 	}
 
-	if method := obj.value.(*goArrayObject).value.MethodByName(name); method != (reflect.Value{}) {
+	if method := obj.value.(*goArrayObject).value.MethodByName(name); method.IsValid() {
 		return &property{
 			obj.runtime.toValue(method.Interface()),
 			0o110,

+ 1 - 1
vendor/github.com/robertkrimen/otto/type_go_map.go

@@ -13,9 +13,9 @@ func (rt *runtime) newGoMapObject(value reflect.Value) *object {
 }
 
 type goMapObject struct {
-	value     reflect.Value
 	keyType   reflect.Type
 	valueType reflect.Type
+	value     reflect.Value
 }
 
 func newGoMapObject(value reflect.Value) *goMapObject {

+ 4 - 4
vendor/github.com/robertkrimen/otto/type_go_struct.go

@@ -53,11 +53,11 @@ func (o goStructObject) getValue(name string) reflect.Value {
 	return reflect.Value{}
 }
 
-func (o goStructObject) fieldIndex(name string) []int { //nolint: unused
+func (o goStructObject) fieldIndex(name string) []int { //nolint:unused
 	return fieldIndexByName(reflect.Indirect(o.value).Type(), name)
 }
 
-func (o goStructObject) method(name string) (reflect.Method, bool) { //nolint: unused
+func (o goStructObject) method(name string) (reflect.Method, bool) { //nolint:unused
 	return reflect.Indirect(o.value).Type().MethodByName(name)
 }
 
@@ -97,7 +97,7 @@ func goStructEnumerate(obj *object, all bool, each func(string) bool) {
 	goObj := obj.value.(*goStructObject)
 
 	// Enumerate fields
-	for index := 0; index < reflect.Indirect(goObj.value).NumField(); index++ {
+	for index := range reflect.Indirect(goObj.value).NumField() {
 		name := reflect.Indirect(goObj.value).Type().Field(index).Name
 		if validGoStructName(name) {
 			if !each(name) {
@@ -107,7 +107,7 @@ func goStructEnumerate(obj *object, all bool, each func(string) bool) {
 	}
 
 	// Enumerate methods
-	for index := 0; index < goObj.value.NumMethod(); index++ {
+	for index := range goObj.value.NumMethod() {
 		name := goObj.value.Type().Method(index).Name
 		if validGoStructName(name) {
 			if !each(name) {

+ 6 - 6
vendor/github.com/robertkrimen/otto/type_reference.go

@@ -1,20 +1,20 @@
 package otto
 
 type referencer interface {
-	invalid() bool         // IsUnresolvableReference
-	getValue() Value       // getValue
-	putValue(Value) string // PutValue
+	invalid() bool               // IsUnresolvableReference
+	getValue() Value             // getValue
+	putValue(value Value) string // PutValue
 	delete() bool
 }
 
 // PropertyReference
 
 type propertyReference struct {
-	name    string
-	strict  bool
 	base    *object
 	runtime *runtime
+	name    string
 	at      at
+	strict  bool
 }
 
 func newPropertyReference(rt *runtime, base *object, name string, strict bool, atv at) *propertyReference {
@@ -55,9 +55,9 @@ func (pr *propertyReference) delete() bool {
 }
 
 type stashReference struct {
+	base   stasher
 	name   string
 	strict bool
-	base   stasher
 }
 
 func (sr *stashReference) invalid() bool {

+ 3 - 3
vendor/github.com/robertkrimen/otto/type_regexp.go

@@ -9,11 +9,11 @@ import (
 
 type regExpObject struct {
 	regularExpression *regexp.Regexp
+	source            string
+	flags             string
 	global            bool
 	ignoreCase        bool
 	multiline         bool
-	source            string
-	flags             string
 }
 
 func (rt *runtime) newRegExpObject(pattern string, flags string) *object {
@@ -124,7 +124,7 @@ func execRegExp(this *object, target string) (bool, []int) {
 func execResultToArray(rt *runtime, target string, result []int) *object {
 	captureCount := len(result) / 2
 	valueArray := make([]Value, captureCount)
-	for index := 0; index < captureCount; index++ {
+	for index := range captureCount {
 		offset := 2 * index
 		if result[offset] != -1 {
 			valueArray[index] = stringValue(target[result[offset]:result[offset+1]])

+ 3 - 3
vendor/github.com/robertkrimen/otto/type_string.go

@@ -8,7 +8,7 @@ import (
 
 type stringObjecter interface {
 	Length() int
-	At(int) rune
+	At(at int) rune
 	String() string
 }
 
@@ -50,7 +50,7 @@ func (str stringWide) String() string {
 }
 
 func newStringObject(str string) stringObjecter {
-	for i := 0; i < len(str); i++ {
+	for i := range len(str) {
 		if str[i] >= utf8.RuneSelf {
 			goto wide
 		}
@@ -91,7 +91,7 @@ func (o *object) stringValue() stringObjecter {
 func stringEnumerate(obj *object, all bool, each func(string) bool) {
 	if str := obj.stringValue(); str != nil {
 		length := str.Length()
-		for index := 0; index < length; index++ {
+		for index := range length {
 			if !each(strconv.FormatInt(int64(index), 10)) {
 				return
 			}

+ 52 - 52
vendor/github.com/robertkrimen/otto/value.go

@@ -27,8 +27,8 @@ const (
 
 // Value is the representation of a JavaScript value.
 type Value struct {
-	kind  valueKind
 	value interface{}
+	kind  valueKind
 }
 
 func (v Value) safe() bool {
@@ -129,7 +129,7 @@ func (v Value) constructSafe(rt *runtime, this Value, argumentList ...interface{
 	return result, err
 }
 
-func (v Value) construct(rt *runtime, this Value, argumentList ...interface{}) Value { //nolint: unparam
+func (v Value) construct(rt *runtime, this Value, argumentList ...interface{}) Value { //nolint:unparam
 	if fn, ok := v.value.(*object); ok {
 		return fn.construct(fn.runtime.toValueArray(argumentList...))
 	}
@@ -204,35 +204,35 @@ func (v Value) Class() string {
 	return v.value.(*object).class
 }
 
-func (v Value) isArray() bool { //nolint: unused
+func (v Value) isArray() bool { //nolint:unused
 	if v.kind != valueObject {
 		return false
 	}
 	return isArray(v.value.(*object))
 }
 
-func (v Value) isStringObject() bool { //nolint: unused
+func (v Value) isStringObject() bool { //nolint:unused
 	if v.kind != valueObject {
 		return false
 	}
 	return v.value.(*object).class == classStringName
 }
 
-func (v Value) isBooleanObject() bool { //nolint: unused
+func (v Value) isBooleanObject() bool { //nolint:unused
 	if v.kind != valueObject {
 		return false
 	}
 	return v.value.(*object).class == classBooleanName
 }
 
-func (v Value) isNumberObject() bool { //nolint: unused
+func (v Value) isNumberObject() bool { //nolint:unused
 	if v.kind != valueObject {
 		return false
 	}
 	return v.value.(*object).class == classNumberName
 }
 
-func (v Value) isDate() bool { //nolint: unused
+func (v Value) isDate() bool { //nolint:unused
 	if v.kind != valueObject {
 		return false
 	}
@@ -246,7 +246,7 @@ func (v Value) isRegExp() bool {
 	return v.value.(*object).class == classRegExpName
 }
 
-func (v Value) isError() bool { //nolint: unused
+func (v Value) isError() bool { //nolint:unused
 	if v.kind != valueObject {
 		return false
 	}
@@ -272,46 +272,46 @@ func toValue(value interface{}) Value {
 	case Value:
 		return value
 	case bool:
-		return Value{valueBoolean, value}
+		return Value{kind: valueBoolean, value: value}
 	case int:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case int8:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case int16:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case int32:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case int64:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case uint:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case uint8:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case uint16:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case uint32:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case uint64:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case float32:
-		return Value{valueNumber, float64(value)}
+		return Value{kind: valueNumber, value: float64(value)}
 	case float64:
-		return Value{valueNumber, value}
+		return Value{kind: valueNumber, value: value}
 	case []uint16:
-		return Value{valueString, value}
+		return Value{kind: valueString, value: value}
 	case string:
-		return Value{valueString, value}
+		return Value{kind: valueString, value: value}
 	// A rune is actually an int32, which is handled above
 	case *object:
-		return Value{valueObject, value}
+		return Value{kind: valueObject, value: value}
 	case *Object:
-		return Value{valueObject, value.object}
+		return Value{kind: valueObject, value: value.object}
 	case Object:
-		return Value{valueObject, value.object}
+		return Value{kind: valueObject, value: value.object}
 	case referencer: // reference is an interface (already a pointer)
-		return Value{valueReference, value}
+		return Value{kind: valueReference, value: value}
 	case result:
-		return Value{valueResult, value}
+		return Value{kind: valueResult, value: value}
 	case nil:
 		// TODO Ugh.
 		return Value{}
@@ -329,33 +329,33 @@ func toValue(value interface{}) Value {
 		}
 		switch value.Kind() {
 		case reflect.Bool:
-			return Value{valueBoolean, value.Bool()}
+			return Value{kind: valueBoolean, value: value.Bool()}
 		case reflect.Int:
-			return Value{valueNumber, int(value.Int())}
+			return Value{kind: valueNumber, value: int(value.Int())}
 		case reflect.Int8:
-			return Value{valueNumber, int8(value.Int())}
+			return Value{kind: valueNumber, value: int8(value.Int())}
 		case reflect.Int16:
-			return Value{valueNumber, int16(value.Int())}
+			return Value{kind: valueNumber, value: int16(value.Int())}
 		case reflect.Int32:
-			return Value{valueNumber, int32(value.Int())}
+			return Value{kind: valueNumber, value: int32(value.Int())}
 		case reflect.Int64:
-			return Value{valueNumber, value.Int()}
+			return Value{kind: valueNumber, value: value.Int()}
 		case reflect.Uint:
-			return Value{valueNumber, uint(value.Uint())}
+			return Value{kind: valueNumber, value: uint(value.Uint())}
 		case reflect.Uint8:
-			return Value{valueNumber, uint8(value.Uint())}
+			return Value{kind: valueNumber, value: uint8(value.Uint())}
 		case reflect.Uint16:
-			return Value{valueNumber, uint16(value.Uint())}
+			return Value{kind: valueNumber, value: uint16(value.Uint())}
 		case reflect.Uint32:
-			return Value{valueNumber, uint32(value.Uint())}
+			return Value{kind: valueNumber, value: uint32(value.Uint())}
 		case reflect.Uint64:
-			return Value{valueNumber, value.Uint()}
+			return Value{kind: valueNumber, value: value.Uint()}
 		case reflect.Float32:
-			return Value{valueNumber, float32(value.Float())}
+			return Value{kind: valueNumber, value: float32(value.Float())}
 		case reflect.Float64:
-			return Value{valueNumber, value.Float()}
+			return Value{kind: valueNumber, value: value.Float()}
 		case reflect.String:
-			return Value{valueString, value.String()}
+			return Value{kind: valueString, value: value.String()}
 		default:
 			reflectValuePanic(value.Interface(), value.Kind())
 		}
@@ -371,7 +371,7 @@ func toValue(value interface{}) Value {
 // This method will make return the empty string if there is an error.
 func (v Value) String() string {
 	var result string
-	catchPanic(func() { //nolint: errcheck, gosec
+	catchPanic(func() { //nolint:errcheck, gosec
 		result = v.string()
 	})
 	return result
@@ -398,7 +398,7 @@ func (v Value) numberValue() Value {
 	if v.kind == valueNumber {
 		return v
 	}
-	return Value{valueNumber, v.float64()}
+	return Value{kind: valueNumber, value: v.float64()}
 }
 
 // ToFloat will convert the value to a number (float64).
@@ -494,23 +494,23 @@ var (
 //
 //	ToValue(math.NaN())
 func NaNValue() Value {
-	return Value{valueNumber, nan}
+	return Value{kind: valueNumber, value: nan}
 }
 
 func positiveInfinityValue() Value {
-	return Value{valueNumber, positiveInfinity}
+	return Value{kind: valueNumber, value: positiveInfinity}
 }
 
 func negativeInfinityValue() Value {
-	return Value{valueNumber, negativeInfinity}
+	return Value{kind: valueNumber, value: negativeInfinity}
 }
 
 func positiveZeroValue() Value {
-	return Value{valueNumber, positiveZero}
+	return Value{kind: valueNumber, value: positiveZero}
 }
 
 func negativeZeroValue() Value {
-	return Value{valueNumber, negativeZero}
+	return Value{kind: valueNumber, value: negativeZero}
 }
 
 // TrueValue will return a value representing true.
@@ -519,7 +519,7 @@ func negativeZeroValue() Value {
 //
 //	ToValue(true)
 func TrueValue() Value {
-	return Value{valueBoolean, true}
+	return Value{kind: valueBoolean, value: true}
 }
 
 // FalseValue will return a value representing false.
@@ -528,7 +528,7 @@ func TrueValue() Value {
 //
 //	ToValue(false)
 func FalseValue() Value {
-	return Value{valueBoolean, false}
+	return Value{kind: valueBoolean, value: false}
 }
 
 func sameValue(x Value, y Value) bool {
@@ -647,7 +647,7 @@ func (v Value) export() interface{} {
 			elemKind := reflect.Invalid
 			state := 0
 			var t reflect.Type
-			for index := uint32(0); index < length; index++ {
+			for index := range length {
 				name := strconv.FormatInt(int64(index), 10)
 				if !obj.hasProperty(name) {
 					continue

+ 2 - 2
vendor/modules.txt

@@ -480,8 +480,8 @@ github.com/prometheus/procfs/internal/util
 # github.com/rivo/uniseg v0.4.4
 ## explicit; go 1.18
 github.com/rivo/uniseg
-# github.com/robertkrimen/otto v0.3.0
-## explicit; go 1.18
+# github.com/robertkrimen/otto v0.5.1
+## explicit; go 1.22
 github.com/robertkrimen/otto
 github.com/robertkrimen/otto/ast
 github.com/robertkrimen/otto/dbg