Iskander (Alex) Sharipov
d34fc6f56d
fix: scope.reset, set length to 0 ( #324 )
...
Fix scope.reset to correctly clear output, while maintaining
the slice size.
2021-09-27 16:30:05 +01:00
Steven Hartland
9297a9abe4
feat: add github action tests and linting ( #418 )
...
Leverage github actions for tests and linting.
This includes fixing a bunch of issues highlighted by golangci
including:
* Dead code.
* Ineffectual assigns.
* Goto warnings.
* Nil return err.
* Reused literal strings.
* Test parameter order.
Also:
* Setup clog.
2021-09-27 16:19:28 +01:00
Steven Hartland
209b1fb8e8
Revert "feat: support null value returns for toValue ( #325 )" ( #417 )
...
This reverts commit 26cb6ccce6
.
2021-09-27 12:00:52 +01:00
Ryan
26cb6ccce6
feat: support null value returns for toValue ( #325 )
...
Add nullValue as the return value for the nil case in toValue.
Co-authored-by: Ryan Macleod <ryan.macleod@cumul8.com>
2021-09-27 11:47:21 +01:00
Jongmin Kim
67c8da69a8
fix: test timeout on slow machines ( #340 )
...
Fix test timeout on slow machines by extend testing timeout
to 20 secs.
Fixes : #337
Signed-off-by: Jongmin Kim <jmkim@pukyong.ac.kr>
2021-09-27 11:38:29 +01:00
ilyapashuk
08d7b51940
feat: add go.mod support ( #376 )
...
Add support for go mod
2021-09-27 11:13:58 +01:00
Robert-André Mauchin
dee429e322
fix: go vet 1.15 warnings ( #385 )
...
Convert int to string using rune()
See https://github.com/golang/go/issues/32479
Fix #384 .
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
2021-09-27 11:11:52 +01:00
Luka Zakrajšek
373ff54384
fix: Incorrect groups offsets if lastIndex is set ( #393 )
2021-06-14 19:17:06 +01:00
Conrad Pankoff
ef014fd054
improve error messages when converting values
2020-09-23 08:17:31 +10:00
Conrad Pankoff
c382bd3c16
fix field accesses on anonymous embedded structs
2019-12-20 10:40:10 +11:00
Conrad Pankoff
37f8e9a246
support Number.isNaN
2019-12-17 17:34:20 +11:00
Conrad Pankoff
9fa7c0c0f8
support converting to json.RawMessage
2019-12-15 13:36:24 +11:00
Conrad Pankoff
b839e7b8bb
support methods on go array values
2019-12-15 13:18:22 +11:00
Conrad Pankoff
3ef5863438
allow conversion from [u]int* to float
2019-12-15 13:18:22 +11:00
Conrad Pankoff
0f57984957
use consistent field access rules across read/write and argument conversion
2019-12-15 13:18:22 +11:00
ia
15f95af6e7
all: gofmt ( #307 )
...
Run standard gofmt command on project root.
- go version go1.10.3 darwin/amd64
Signed-off-by: ia <isaac.ardis@gmail.com>
2018-06-17 14:11:54 +01:00
deoxxa
03d472dc43
extend convertCallParameter passthrough behaviour to _goArrayObject
2018-05-06 18:43:58 +10:00
deoxxa
e335b9a887
implement TextUnmarshaller function parameter conversion
2018-05-06 18:12:42 +10:00
deoxxa
09c2169283
implement and test basic [object Object] -> struct conversion
2018-05-06 17:43:12 +10:00
deoxxa
e177400a34
fix a bug related to converting Value objects to specific interfaces
2018-05-06 14:28:05 +10:00
carterjones
6c383dd335
fix whitespace issues ( #297 )
2018-03-05 04:20:45 +00:00
Steven Hartland
58e9cfdd5d
Revert "Update sourcemaps to v2 ( #293 )" ( #296 )
...
This reverts commit 67b2826a26
.
2018-03-03 15:22:00 +00:00
Eric Reis Figueiredo
67b2826a26
Update sourcemaps to v2 ( #293 )
...
Update sourcemaps to gopkg.in/sourcemap.v2 in order to avoid possible golang error discussed in #291
2018-03-03 10:15:14 +00:00
Tao Wen
3b44b4dcb6
fix idx of throw and if ( #286 )
...
* fix idx of throw and if
* add test to cover if/throw statement idx
2017-11-30 10:32:05 +00:00
deoxxa
68a29f5e29
add test for issue #269
2017-10-11 17:07:14 +11:00
Conrad Pankoff
c284572e9b
Merge pull request #275 from deoxxa/implement-function-caller
...
implement Function.caller
2017-10-03 09:47:08 +11:00
deoxxa
eb255cd1e9
implemet Function.caller
2017-10-03 09:46:37 +11:00
Conrad Pankoff
26777b428a
Merge pull request #273 from deoxxa/implement-function-name-property
...
implement Function.name
2017-10-03 09:45:34 +11:00
deoxxa
a4fda0adbc
implement Function.name
2017-10-02 19:01:12 +11:00
Conrad Pankoff
5ff469b965
Merge pull request #274 from deoxxa/test-function-length
...
test Function.length
2017-10-02 18:59:00 +11:00
deoxxa
46dbeab683
test Function.length
2017-10-02 18:52:13 +11:00
leromarinvit
a813c59b1b
Fix Array.splice(n) with single argument ( #268 )
2017-08-18 09:51:46 +01:00
Archis
fc2eb1bbf1
Added functional benchmarks ( #255 )
...
This change adds two types of tests:
1. First some regular Test* tests that functionally
ensure the test cases are correct.
2. A few Benchmark* tests that then allow us to
measure Otto's performance under various functional scenarios.
The basic tests are just sorting, but I'm planning over time
to bring in more advanced tests (like the CryptoAES) from
popular benchmarking suites (JetStream for instance.)
I intend to run profiler on these tests to find any
ottlenecks or low-hanging fruit that can help speed up
Otto for real-world use-cases.
Next up after this is to add some heavy underscorejs
benchmarks.
Responding to PR comments
2017-07-21 20:43:36 +01:00
Eddy Reyes
50ed21f88e
Walk/Visitor should follow Enter/Exit Pattern ( #258 )
...
* (#257 ) Change Walk/Visit to follow an explicit Enter/Exit pattern
* (#257 ) Convert walk example into test.
* (#257 ) restore walk/visitor example
* (#257 ) Fix godoc comment in the Visitor interface
... typo referred to `End` method instead of `Exit`
2017-07-21 20:42:34 +01:00
Olivier Poitrey
49fee9c1c0
Add a an ast.Walk utility function ( #250 )
2017-06-04 11:36:02 +01:00
Archis
e1afcee0b0
Other methods callable on Maps ( #254 )
...
Background:
When methods are attached on a map type like so:
type Foo map[string]string
func (f Foo) Bar() {
fmt.Printf("Hello World");
}
vm := otto.New();
vm.Set("foo", Foo{});
vm.Run(`
foo.Bar();
`);
You get:
Error in Run: TypeError: 'Bar' is not a function
The Fix:
I looked into how/why the same works for arrays. After
all array properties are tested (such as length, and any integer-based members),
the code then looks for any methods attached to that type.
This change literally copies that code over into
maps.
This is very useful when working with the http.Request object which
has the http.Header type that is a map[string][]string, with a lot
of useful methods attached to it.
Added unit test to support/guard the change (and map had no test before)
Responded to PR comments
2017-06-02 10:05:44 +01:00
Wael Nasreddine
bc4cd51799
ast: ThisExpression.Idx1() should point to the end of this
( #251 )
2017-06-02 10:04:14 +01:00
Vincent Vanackere
21ec96599b
Fix bug in runtime when exporting null|undefined to interface{} ( #244 )
2017-04-24 11:46:44 +01:00
Steven Hartland
1861f2408b
Merge pull request #238 from veonik/no-rel-imports
...
Replaced './terst' relative import with qualified name.
2017-03-08 08:57:57 +00:00
Tyler Sommer
9c716adcc8
Replaced './terst' relative import with qualified name.
2017-03-07 11:15:29 -07:00
Steven Hartland
6a77b7cbc3
Merge pull request #228 from dsnet/master
...
Fix Test_issue80 on Go 1.8
2017-02-05 01:36:59 +00:00
Steven Hartland
20a18bbe27
Merge pull request #235 from k2wanko/fix-typo-readme
...
Fix typo in README
2017-02-05 01:35:47 +00:00
Robert Krimen
1c73769694
-gxc
2017-01-21 16:43:39 -08:00
Robert Krimen
c28cc513ff
Merge pull request #233 from sstone1/master
...
Handle []uint16 to boolean conversion (resolves #232 )
2017-01-21 16:34:08 -08:00
Kazuhiro Kubota
5caa170cde
Fix typo
2017-01-18 17:37:52 +09:00
Robert Krimen
284b08b295
Restore .split returning a proper Array ( fix #234 )
2017-01-13 18:35:26 -08:00
Robert Krimen
87e059e861
Fix for S15.1.2.3_A2_T10
2017-01-12 16:21:41 -08:00
Robert Krimen
e314343b47
Fix for S15.1.2.2_A2_T10
2017-01-12 16:15:58 -08:00
Robert Krimen
54e1705423
Fix for S9.3.1_A2
2017-01-12 15:54:54 -08:00
Simon Stone
7a965dd45d
Handle []uint16 to boolean conversion ( resolves #232 )
2016-11-24 16:28:05 +00:00