This repository was archived by the owner on Dec 28, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.html
More file actions
135 lines (126 loc) · 7.58 KB
/
index.html
File metadata and controls
135 lines (126 loc) · 7.58 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!doctype html>
<head>
<meta charset="utf-8">
<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>
<title>Map.prototype.toJSON / Set.prototype.toJSON</title>
<script type="application/json" id="menu-search-biblio">
[{
"type": "clause",
"id": "Map.prototype.toJSON",
"aoid": null,
"title": "Map.prototype.toJSON ( )",
"number": "1",
"namespace": "<no location>",
"location": "",
"key": "Map.prototype.toJSON ( )"
}, {
"type": "clause",
"id": "Set.prototype.toJSON",
"aoid": null,
"title": "Set.prototype.toJSON ( )",
"number": "2",
"namespace": "<no location>",
"location": "",
"key": "Set.prototype.toJSON ( )"
}, {
"type": "clause",
"id": "sec-copyright-and-software-license",
"aoid": null,
"title": "Copyright & Software License",
"number": "A",
"namespace": "<no location>",
"location": "",
"key": "Copyright & Software License"
}]
</script>
</head>
<body>
<div id="menu-toggle">☰</div>
<div id="menu">
<div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search...">
<div id="menu-search-results" class="inactive"></div>
</div>
<div id="menu-toc">
<ol class="toc">
<li><span class="item-toggle-none"></span><a href="#Map.prototype.toJSON" title="Map.prototype.toJSON ( )"><span class="secnum">1</span> Map.prototype.toJSON ( )</a></li>
<li><span class="item-toggle-none"></span><a href="#Set.prototype.toJSON" title="Set.prototype.toJSON ( )"><span class="secnum">2</span> Set.prototype.toJSON ( )</a></li>
<li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright & Software License"><span class="secnum">A</span> Copyright & Software License</a></li>
</ol>
</div>
</div>
<h1 class="version">Stage 0 Draft / March 28, 2016</h1>
<h1 class="title">Map.prototype.toJSON / Set.prototype.toJSON</h1>
<emu-clause id="Map.prototype.toJSON">
<h1><span class="secnum">1</span>Map.prototype.toJSON ( )<span class="utils"><span class="anchor"><a href="#Map.prototype.toJSON">#</a></span></span></h1>
<p>This function provides an Array representation of an iterable object for use by <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-json.stringify">JSON.stringify</a>.</p>
<p>
</p>
<p>When the
<emu-val>toJSON</emu-val> method is called, the following steps are taken:</p>
<emu-alg>
<ol>
<li>Let <var>M</var> be the
<emu-val>this</emu-val> value.</li>
<li>Let <var>iterator</var> be ?
<emu-xref aoid="GetIterator"><a href="https://tc39.github.io/ecma262/#sec-getiterator">GetIterator</a></emu-xref>(<var>M</var>)</li>
<li>Let <var>A</var> be !
<emu-xref aoid="ArrayCreate"><a href="https://tc39.github.io/ecma262/#sec-arraycreate">ArrayCreate</a></emu-xref>(
<emu-val>0</emu-val>).</li>
<li>Let <var>k</var> be
<emu-val>0</emu-val>.</li>
<li>Repeat
<ol>
<li>Let <var>Pk</var> be !
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262/#sec-tostring">ToString</a></emu-xref>(<var>k</var>).</li>
<li>Let <var>next</var> be ?
<emu-xref aoid="IteratorStep"><a href="https://tc39.github.io/ecma262/#sec-iteratorstep">IteratorStep</a></emu-xref>(<var>iterator</var>).</li>
<li>If <var>next</var> is
<emu-val>false</emu-val>, then
<ol>
<li>Perform ?
<emu-xref aoid="Set"><a href="https://tc39.github.io/ecma262/#sec-set-o-p-v-throw">Set</a></emu-xref>(<var>A</var>, "length", <var>k</var>,
<emu-val>true</emu-val>).</li>
<li>Return <var>A</var>.</li>
</ol>
</li>
<li>Let <var>nextValue</var> be ?
<emu-xref aoid="IteratorValue"><a href="https://tc39.github.io/ecma262/#sec-iteratorvalue">IteratorValue</a></emu-xref>(<var>next</var>).</li>
<li>Let <var>defineStatus</var> be
<emu-xref aoid="CreateDataPropertyOrThrow"><a href="https://tc39.github.io/ecma262/#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>A</var>, <var>Pk</var>, <var>nextValue</var>).</li>
<li>If <var>defineStatus</var> is an
<emu-xref href="#sec-completion-record-specification-type"><a href="https://tc39.github.io/ecma262/#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return
<emu-xref aoid="IteratorClose"><a href="https://tc39.github.io/ecma262/#sec-iteratorclose">IteratorClose</a></emu-xref>(<var>iterator</var>, <var>defineStatus</var>).</li>
<li>Increase <var>k</var> by 1.
</li>
</ol>
</li>
</ol>
</emu-alg>
<emu-note><span class="note">Note</span>The
<emu-val>length</emu-val> property of the
<emu-val>toJSON</emu-val> method is
<emu-val>0</emu-val>.</emu-note>
</emu-clause>
<emu-clause id="Set.prototype.toJSON">
<h1><span class="secnum">2</span>Set.prototype.toJSON ( )<span class="utils"><span class="anchor"><a href="#Set.prototype.toJSON">#</a></span></span></h1>
<p>The initial value of the
<emu-val>toJSON</emu-val> property is the same function object as the initial value of the
<emu-val>Map.prototype.toJSON</emu-val> property.</p>
</emu-clause>
<emu-annex id="sec-copyright-and-software-license">
<h1><span class="secnum">A</span>Copyright & Software License<span class="utils"><span class="anchor"><a href="#sec-copyright-and-software-license">#</a></span></span></h1>
<h2>Copyright Notice</h2>
<p>© 2016 David Bruant, Jordan Harband</p>
<h2>Software License</h2>
<p>All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<ol>
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
<li>Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.</li>
</ol>
<p>THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
</emu-annex>
</body>