This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
spec.emu
65 lines (61 loc) · 2.69 KB
/
spec.emu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!doctype html>
<meta charset="utf8">
<link rel="stylesheet" href="./spec.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="./spec.js"></script>
<pre class="metadata">
title: Object.values / Object.entries
stage: 4
contributors: Jordan Harband
</pre>
<emu-clause id="Object.keys">
<h1>Object.keys( O )</h1>
<p>When the *keys* function is called with argument _O_, the following steps are taken:</p>
<emu-alg>
1. Let _obj_ be ? ToObject(_O_).
1. Let _nameList_ be ? EnumerableOwnProperties(_obj_, *"key"*).
1. Return CreateArrayFromList(_nameList_).
</emu-alg>
</emu-clause>
<emu-clause id="Object.values">
<h1>Object.values( O )</h1>
<p>When the *values* function is called with argument _O_, the following steps are taken:</p>
<emu-alg>
1. Let _obj_ be ? ToObject(_O_).
1. Let _valueList_ be ? EnumerableOwnProperties(_obj_, *"value"*).
1. Return CreateArrayFromList(_valueList_).
</emu-alg>
</emu-clause>
<emu-clause id="Object.entries">
<h1>Object.entries( O )</h1>
<p>When the *entries* function is called with argument _O_, the following steps are taken:</p>
<emu-alg>
1. Let _obj_ be ? ToObject(_O_).
1. Let _entryList_ be ? EnumerableOwnProperties(_obj_, *"key+value"*).
1. Return CreateArrayFromList(_entryList_).
</emu-alg>
</emu-clause>
<emu-clause id="EnumerableOwnProperties" aoid="EnumerableOwnProperties">
<h1>EnumerableOwnProperties</h1>
<p>When the abstract operation EnumerableOwnProperties is called with Object _O_ and String _kind_ the following steps are taken:</p>
<emu-alg>
1. Assert: Type(_O_) is Object.
1. Let _ownKeys_ be ? O.[[OwnPropertyKeys]]().
1. Let _properties_ be a new empty List.
1. Repeat, for each element _key_ of _ownKeys_ in List order
1. If Type(_key_) is String, then
1. Let _desc_ be ? O.[[GetOwnProperty]](_key_).
1. If _desc_ is not *undefined* and _desc_.[[Enumerable]] is *true*, then
1. If _kind_ is *"key"*, append _key_ to _properties_.
1. Else,
1. Let _value_ be ? Get(_O_, _key_).
1. If _kind_ is *"value"*, append _value_ to _properties_.
1. Else,
1. Assert: _kind_ is *"key+value"*.
1. Let _entry_ be CreateArrayFromList(« _key_, _value_ »).
1. Append _entry_ to _properties_.
1. Order the elements of _properties_ so they are in the same relative order as would be produced by the Iterator that would be returned if the EnumerateObjectProperties internal method was invoked with _O_.
1. Return _properties_.
</emu-alg>
<p>Note: The "EnumerableOwnNames" section is deleted. Any existing references to EnumerableOwnNames(_x_) should be changed to EnumerableOwnProperties(_x_, *"key"*)</p>
</emu-clause>