Comments (2)
@sebras referred me to the pending patch here http://git.ghostscript.com/?p=user/tor/mujs.git;a=commitdiff;h=483bd4ffff410c828b8d87f7e08941d6bbb270ae :
--- a/jsobject.c
+++ b/jsobject.c
@@ -380,6 +380,13 @@ static void O_keys(js_State *J)
js_setindex(J, -2, i++);
}
}
+
+ if (obj->type == JS_CARRAY && obj->u.a.simple) {
+ for (k = 0; k < obj->u.a.flat_length; ++k) {
+ js_pushnumber(J, k);
+ js_setindex(J, -2, i++);
+ }
+ }
}
static void O_preventExtensions(js_State *J)
I think this patch produces an array of numbers, e.g. [0, 1...]
instead of strings ["0", "1"...]
.
While at it, looks like the code just above above the patch which produces keys for a string object, like Object.keys(new String("foo"))
, has the same issue where it returns an array of numbers instead of strings:
Lines 379 to 384 in 7d9888b
from mujs.
More while at it regarding Object.keys
, seems like Object.keys([1,,2])
is non-flat (OK so far), returns ["0", "1", "2"]
, but Firefox returns ["0", "2"]
.
I don't know whether that's an ES5.1 vs newer JS version, but if not, then it's another issue.
EDIT: actually, Object.keys([1,,2])
currently returns []
(empty - bug). The results above of ["0", "1", "2"]
are before the flat-array commit (also a bug).
from mujs.
Related Issues (20)
- BUG HOT 2
- Does not build on macOS
- Warnings
- Get rid of setjmp HOT 1
- String.prototype.replace() with global regex doesn't resolve correctly $`
- A performance issue caused by loop. HOT 2
- Suggestion - macro to make multi-threaded calls single-threaded
- The shared library should be built with SONAME
- Incorrect linker flag to build shared-lib on darwin
- Calling the join function on a self-referential array leads to a stack overflow.
- Unable to assign the eval function to a variable. Error: invalid use of 'eval'
- SyntaxError caused by the trailing comma in the function parameters. HOT 4
- Is it possible to increase the default stack size? HOT 19
- mujs github slug available
- The length of multi-code point Unicode characters is incorrect. HOT 9
- Unversioned shared library HOT 1
- MuJS compiling JS into a file opcode HOT 1
- Object.keys and Object.getOwnPropertyNames on Array returns indices twice HOT 2
- Declaring classes after functions causes a syntax error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mujs.