1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00
Commit Graph

53 Commits

Author SHA1 Message Date
Harrison Ho
085142ee6c
feat: object assign (#547)
Implement object assign
2025-03-31 08:42:01 +01:00
rory malcolm
1ca7723e8a
feat: support Object.values() (#518)
Adds support for `Object.values()`
2024-04-13 18:15:49 +01:00
rory malcolm
b755419e33
feat: add trimStart and trimEnd aliases (#516)
Leverage  `trimRight` and `trimLeft` functions to provide `trimStart` and `trimEnd`.
2023-12-30 16:06:52 +00:00
rory malcolm
c902ab4346
feat: add string startsWith method (#514)
Adds startsWith method to the String builtins.
2023-12-19 19:17:47 +00:00
HuKai
2b00d85b5e
feat: add math function (#485)
Add some ES6 math functions.
2023-02-23 16:13:49 +00:00
Steven Hartland
b882379002
chore: add generated headers (#486)
Add headers to generated files so that editors will notify users that
these files shouldn't be edited manually.
2023-01-13 19:47:05 +00:00
Steven Hartland
233dfa4ef0
chore: remove perl, make and local docs. (#476)
Remove the dependencies on perl and make.

inline.pl is replaced by tools/gen-jscore and token/tokenfmt is replaced
by tools/gen-tokens which are both golang text/template utilities.

gen-jscore uses property ordering that matches chromes output ordering
adding missing properties to the Error types.

Local generated documentation have been removed as https://pkg.go.dev/
is more feature rich.

The use of make has been removed as the functionality is now replicated by
standard golang tools go test ./... and go generate ./... as well as integrated
into github actions.
2022-12-05 22:19:34 +00:00
Steven Hartland
026a1d9a9c
chore: lint and naming refactor (#475)
Enable more linters, address the issues and do a major naming refactor
to use golang lower camelCase identifiers for types, functions, methods
and variable names.

Also: 
* Clean up inline generation so it doesn't rely on temporary variables.
* Remove unused functions generated by inline.pl.
2022-12-04 21:49:38 +00: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
Conrad Pankoff
37f8e9a246 support Number.isNaN 2019-12-17 17:34:20 +11:00
Robert Krimen
918abeb8d8 The zero value of Value is now defined to be undefined
Previously, it was a publically accessible but invalid value (valueEmpty).

* Deprecate internal use of UndefinedValue(), NullValue(), FalseValue(), TrueValue()
* Guard against Empty, Result, Reference values from escaping the package
2014-05-28 21:23:32 -07:00
Robert Krimen
9cd045ef04 Simplification & refactor of (parts of) the runtime
* Proper lowercasing for internal stuff
* *Environment => *_stash
* ExecutionContext => _scope
* Simpler & shallower call/construct mechanics
* Remove unnecessary fields & methods
* Better scoping (no more stack): []*_scope => _scope.outer
* Some speed improvements

In preparation for #66
2014-05-27 22:05:35 -07:00
Robert Krimen
ad8a97c028 New parser
* Faster, more straightforward, etc.
* More advanced object literals (get ..., set ...)
* More tests using JavaScript from the wild (http://cdnjs.com/)
2014-04-10 20:42:25 -07:00
Tim Jurcka
5fe23327c9 Add JSON
This closes #37, #11
2014-02-01 11:32:21 -08:00
Robert Krimen
ba0837d685 Fix Date.prototype.set(UTC)FullYear.length = 3 2014-01-25 12:17:07 -08:00
Robert Krimen
75f314ab90 Fix Date.prototype.set(UTC)Month.length = 2 2014-01-25 12:15:54 -08:00
Robert Krimen
8664a2c303 Fix Date.prototype.set(UTC)Hours.length = 4 2014-01-25 12:14:34 -08:00
Robert Krimen
22a7846e7a Fix Date.prototype.set(UTC)Minutes.length = 3 2014-01-25 12:14:30 -08:00
Robert Krimen
aef285c917 Fix Date.prototype.set(UTC)Seconds.length = 2 2014-01-25 12:09:54 -08:00
Robert Krimen
0ba238b0b3 Fix Date.UTC.length = 7 2014-01-25 12:07:08 -08:00
Robert Krimen
a8ade89afd Fix Date.parse.length = 1 2014-01-25 12:05:44 -08:00
Robert Krimen
7970552164 Fix: Array.prototype.sort.length = 1 2014-01-22 20:46:15 -08:00
Robert Krimen
5e8cb6296e Fix: Array.isArray.length = 1 2014-01-22 20:33:46 -08:00
Robert Krimen
a36c19873f Fix Function.prototype.call .length 2014-01-20 12:42:23 -08:00
Robert Krimen
cf3fad5e7b Remove extra/invalid constructors (inline) 2013-07-20 16:37:57 -07:00
Robert Krimen
aede245ed6 Include property names when inlining 2013-07-20 15:24:56 -07:00
Robert Krimen
2db07ee8bb Add Number.toLocaleString 2013-07-14 14:52:44 -07:00
Robert Krimen
33672f5c98 Add String.toLocaleUpperCase 2013-07-14 14:38:59 -07:00
Robert Krimen
3d883a981e Add String.toLocaleLowerCase 2013-07-14 14:35:50 -07:00
Robert Krimen
19360eafc4 Add String.localeCompare 2013-07-14 14:20:01 -07:00
Tim Jurcka
0845d0253a Add Date.now()
This fixes #33
2013-07-14 14:19:21 -07:00
Tim Jurcka
dd7d387420 Add String.prototype.trim(), and non-standard trimLeft(), trimRight()
This fixes #32
2013-07-14 14:19:06 -07:00
Robert Krimen
40d01ced6e Add Array.reduceRight (sdgoij) 2013-06-23 15:29:33 +02:00
Robert Krimen
1b70913ef7 Add Array.reduce (sdgoij) 2013-06-23 14:56:26 +02:00
Robert Krimen
bbc7992385 Add Array.filter (sdgoij) 2013-06-23 14:44:41 +02:00
Robert Krimen
d4a09639a9 Add Array.map (sdgoij) 2013-06-23 14:37:26 +02:00
Robert Krimen
11d011e6a3 Add Array.forEach (sdgoij) 2013-06-23 14:00:01 +02:00
Robert Krimen
b800b809a2 Add Array.some (sdgoij) 2013-06-23 13:48:03 +02:00
Robert Krimen
4ebf6416d0 Fix Uint32 Array/String indexing
Also, a bunch of toValue_* streamlining
And maybe a few miscellaneous tweaks
2013-06-22 15:49:22 +02:00
Robert Krimen
48607926f1 Add Array.every (sdgoij) 2013-06-16 15:31:15 -07:00
Robert Krimen
e2eb18cd4c Add toValue_* for more straightforward value conversion
(When the type being converted is obvious.)
2013-06-16 15:12:46 -07:00
Robert Krimen
2479aa628b Add Array.lastIndexOf (sdgoij) 2013-06-16 14:55:12 -07:00
Robert Krimen
6b4c8ec2b2 Add Array.indexOf (sdgoij) 2013-06-16 14:13:43 -07:00
Robert Krimen
9fe41e1df9 Add Array.toLocaleString 2013-06-15 18:02:13 -07:00
Robert Krimen
81de6c8f02 Fix writable/enumerable/configurable of *.prototype to be false
Number, String, Array, RegExp, Error, etc.
2013-06-15 17:38:16 -07:00
Robert Krimen
98a80a628d Add RegExp.compile
This (useless) function is deprecated, but is here to provide some
semblance of compatibility.
Caveat emptor: it may not be around for long.
2013-06-15 17:17:58 -07:00
Robert Krimen
44fda5c7c3 Add Date.toJSON 2013-06-15 12:56:17 -07:00
Robert Krimen
a34c4d2d1f Add Date.toISOString (sdgoij) 2013-06-15 12:06:33 -07:00
Robert Krimen
14b2fb3918 Fix writable/enumerable/configurable of Object.prototype to be false 2013-06-15 11:44:29 -07:00
Robert Krimen
22ae900958 Fix writable/enumerable/configurable of undefined, NaN, & Infinity to be false 2013-06-15 11:27:41 -07:00