diff options
author | mattco98 <matthewcolsson@gmail.com> | 2020-04-28 19:19:31 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-29 18:47:03 +0200 |
commit | 95abcc3722af0ec0115d519504e19d05c9cb79a5 (patch) | |
tree | 7bfd09133c9c56d680e3a81fc3016142cd1b534d /Userland/md.cpp | |
parent | 58f6f50de48965a6bf0113c7e9ba79889dba09ac (diff) | |
download | serenity-95abcc3722af0ec0115d519504e19d05c9cb79a5.zip |
LibJS: Implement correct object property ordering
This commit introduces a way to get an object's own properties in the
correct order. The "correct order" for JS object properties is first all
array-like index properties (numeric keys) sorted by insertion order,
followed by all string properties sorted by insertion order.
Objects also now print correctly in the repl! Before this commit:
courage ~/js-tests $ js
> ({ foo: 1, bar: 2, baz: 3 })
{ bar: 2, foo: 1, baz: 3 }
After:
courage ~/js-tests $ js
> ({ foo: 1, bar: 2, baz: 3 })
{ foo: 1, bar: 2, baz: 3 }
Diffstat (limited to 'Userland/md.cpp')
0 files changed, 0 insertions, 0 deletions