Merged in Selenium optimizations from http://github.com/gannett/jasmine branch. Updated json2 to latest.

This commit is contained in:
ragaskar 2009-09-29 22:09:30 -07:00
parent a394b564f4
commit 250c483a6b
26 changed files with 1538 additions and 1403 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea/ .idea/
.svn/

View File

@ -173,21 +173,18 @@ module Jasmine
def eval_js(script) def eval_js(script)
escaped_script = "'" + script.gsub(/(['\\])/) { '\\' + $1 } + "'" escaped_script = "'" + script.gsub(/(['\\])/) { '\\' + $1 } + "'"
begin result = @driver.get_eval(" try { eval(#{escaped_script}, window); } catch(err) { window.eval(#{escaped_script}); }")
result = @driver.get_eval("window.eval(#{escaped_script})")
rescue Selenium::CommandError
result = @driver.get_eval("eval(#{escaped_script}, window)")
end
JSON.parse("[#{result}]")[0] JSON.parse("[#{result}]")[0]
end end
end end
class Runner class Runner
def initialize(selenium_jar_path, spec_files, dir_mappings, jasmine_files = nil) def initialize(selenium_jar_path, spec_files, dir_mappings, jasmine_files = nil, options={})
@selenium_jar_path = selenium_jar_path @selenium_jar_path = selenium_jar_path
@spec_files = spec_files @spec_files = spec_files
@dir_mappings = dir_mappings @dir_mappings = dir_mappings
@jasmine_files = jasmine_files @jasmine_files = jasmine_files
@browser = options[:browser] || 'firefox'
@selenium_pid = nil @selenium_pid = nil
@jasmine_server_pid = nil @jasmine_server_pid = nil
@ -195,7 +192,7 @@ module Jasmine
def start def start
start_servers start_servers
@client = Jasmine::SimpleClient.new("localhost", @selenium_server_port, "*firefox", "http://localhost:#{@jasmine_server_port}/") @client = Jasmine::SimpleClient.new("localhost", @selenium_server_port, "*#{@browser}", "http://localhost:#{@jasmine_server_port}/")
@client.connect @client.connect
end end

View File

@ -1,5 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_runner.rb")) require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_runner.rb"))
require 'enumerator'
module Jasmine module Jasmine
class SpecBuilder class SpecBuilder
@ -8,6 +8,7 @@ module Jasmine
def initialize(spec_files, runner) def initialize(spec_files, runner)
@spec_files = spec_files @spec_files = spec_files
@runner = runner @runner = runner
@spec_ids = []
end end
def start def start
@ -15,7 +16,7 @@ module Jasmine
@runner.start @runner.start
load_suite_info load_suite_info
@spec_results = {} wait_for_suites_to_finish_running
end end
def stop def stop
@ -61,16 +62,23 @@ module Jasmine
end end
def results_for(spec_id) def results_for(spec_id)
spec_id = spec_id.to_s @spec_results ||= load_results
return @spec_results[spec_id] if @spec_results[spec_id] @spec_results[spec_id.to_s]
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.resultsForSpec(#{spec_id}))")
while @spec_results[spec_id].nil? do
sleep 0.1
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.resultsForSpec(#{spec_id}))")
end end
@spec_results[spec_id] def load_results
@spec_results = {}
@spec_ids.each_slice(50) do |slice|
@spec_results.merge!(eval_js("JSON.stringify(jsApiReporter.resultsForSpecs(#{JSON.generate(slice)}))"))
end
@spec_results
end
def wait_for_suites_to_finish_running
puts "Waiting for suite to finish in browser ..."
while !eval_js('jsApiReporter.finished') do
sleep 0.1
end
end end
def declare_suites def declare_suites
@ -99,7 +107,7 @@ module Jasmine
def declare_spec(parent, spec) def declare_spec(parent, spec)
me = self me = self
example_name = spec["name"] example_name = spec["name"]
@spec_ids << spec["id"]
backtrace = @example_locations[parent.description + " " + example_name] backtrace = @example_locations[parent.description + " " + example_name]
parent.it example_name, {}, backtrace do parent.it example_name, {}, backtrace do
me.report_spec(spec["id"]) me.report_spec(spec["id"])
@ -124,7 +132,7 @@ module Jasmine
out << "\n" out << "\n"
end end
unless message["passed_"] if !message["passed"] && message["trace"]["stack"]
stack_trace = message["trace"]["stack"].gsub(/<br \/>/, "\n").gsub(/<\/?b>/, " ") stack_trace = message["trace"]["stack"].gsub(/<br \/>/, "\n").gsub(/<\/?b>/, " ")
STDERR << stack_trace.gsub(/\(.*\)@http:\/\/localhost:[0-9]+\/specs\//, "/spec/") STDERR << stack_trace.gsub(/\(.*\)@http:\/\/localhost:[0-9]+\/specs\//, "/spec/")
STDERR << "\n" STDERR << "\n"
@ -143,4 +151,3 @@ module Jasmine
end end
end end
end end

View File

@ -258,7 +258,7 @@ ul.inheritsList
</div> </div>
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -300,7 +300,7 @@ ul.inheritsList
</div> </div>
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:32 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -339,7 +339,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:32 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -507,7 +507,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:32 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -316,7 +316,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:32 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -316,7 +316,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:32 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -700,7 +700,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:32 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -316,7 +316,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -418,7 +418,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -396,7 +396,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);</pre>
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -436,7 +436,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -678,7 +678,7 @@ Jasmine environment.
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:32 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -316,7 +316,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 16:21:33 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -19,7 +19,7 @@
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">child</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 12</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">child</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="NAME">el.appendChild</span><span class="PUNC">(</span><span class="NAME">document.createTextNode</span><span class="PUNC">(</span><span class="NAME">child</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 13</span> </span><span class="WHIT"> </span><span class="NAME">el.appendChild</span><span class="PUNC">(</span><span class="NAME">document.createTextNode</span><span class="PUNC">(</span><span class="NAME">child</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 14</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="NAME">el.appendChild</span><span class="PUNC">(</span><span class="NAME">child</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 15</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">child</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">el.appendChild</span><span class="PUNC">(</span><span class="NAME">child</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'> 16</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'> 17</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 18</span> <span class='line'> 18</span>

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
.line {border-right: 1px dotted #666; color: #666; font-style: normal;} .line {border-right: 1px dotted #666; color: #666; font-style: normal;}
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/* </style></head><body><pre><span class='line'> 1</span> <span class="COMM">/*
<span class='line'> 2</span> http://www.JSON.org/json2.js <span class='line'> 2</span> http://www.JSON.org/json2.js
<span class='line'> 3</span> 2008-11-19 <span class='line'> 3</span> 2009-08-17
<span class='line'> 4</span> <span class='line'> 4</span>
<span class='line'> 5</span> Public Domain. <span class='line'> 5</span> Public Domain.
<span class='line'> 6</span> <span class='line'> 6</span>
@ -40,7 +40,7 @@
<span class='line'> 33</span> value represented by the name/value pair that should be serialized, <span class='line'> 33</span> value represented by the name/value pair that should be serialized,
<span class='line'> 34</span> or undefined if nothing should be serialized. The toJSON method <span class='line'> 34</span> or undefined if nothing should be serialized. The toJSON method
<span class='line'> 35</span> will be passed the key associated with the value, and this will be <span class='line'> 35</span> will be passed the key associated with the value, and this will be
<span class='line'> 36</span> bound to the object holding the key. <span class='line'> 36</span> bound to the value
<span class='line'> 37</span> <span class='line'> 37</span>
<span class='line'> 38</span> For example, this would serialize Dates as ISO strings. <span class='line'> 38</span> For example, this would serialize Dates as ISO strings.
<span class='line'> 39</span> <span class='line'> 39</span>
@ -153,212 +153,212 @@
<span class='line'>146</span> <span class='line'>146</span>
<span class='line'>147</span> </span><span class="COMM">/*jslint evil: true */</span><span class="WHIT"> <span class='line'>147</span> </span><span class="COMM">/*jslint evil: true */</span><span class="WHIT">
<span class='line'>148</span> <span class='line'>148</span>
<span class='line'>149</span> </span><span class="COMM">/*global JSON */</span><span class="WHIT"> <span class='line'>149</span> </span><span class="COMM">/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
<span class='line'>150</span> <span class='line'>150</span> call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
<span class='line'>151</span> </span><span class="COMM">/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, <span class='line'>151</span> getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
<span class='line'>152</span> call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, <span class='line'>152</span> lastIndex, length, parse, prototype, push, replace, slice, stringify,
<span class='line'>153</span> getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, <span class='line'>153</span> test, toJSON, toString, valueOf
<span class='line'>154</span> lastIndex, length, parse, prototype, push, replace, slice, stringify, <span class='line'>154</span> */</span><span class="WHIT">
<span class='line'>155</span> test, toJSON, toString, valueOf <span class='line'>155</span>
<span class='line'>156</span> */</span><span class="WHIT"> <span class='line'>156</span> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> <span class='line'>157</span>
<span class='line'>158</span> </span><span class="COMM">// Create a JSON object only if one does not already exist. We create the</span><span class="WHIT"> <span class='line'>158</span> </span><span class="COMM">// Create a JSON object only if one does not already exist. We create the</span><span class="WHIT">
<span class='line'>159</span> </span><span class="COMM">// methods in a closure to avoid creating global variables.</span><span class="WHIT"> <span class='line'>159</span> </span><span class="COMM">// methods in a closure to avoid creating global variables.</span><span class="WHIT">
<span class='line'>160</span> <span class='line'>160</span>
<span class='line'>161</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.JSON</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>161</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.JSON</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT"> </span><span class="NAME">JSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>162</span> </span><span class="WHIT"> </span><span class="NAME">this.JSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>163</span> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>163</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>164</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>164</span>
<span class='line'>165</span> <span class='line'>165</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>166</span>
<span class='line'>167</span> </span><span class="WHIT"> </span><span class="COMM">// Format integers to have at least two digits.</span><span class="WHIT"> <span class='line'>167</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'0'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>168</span> </span><span class="WHIT"> </span><span class="COMM">// Format integers to have at least two digits.</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>169</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'0'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>170</span> <span class='line'>170</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Date.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>171</span>
<span class='line'>172</span> <span class='line'>172</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Date.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT"> </span><span class="NAME">Date.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>173</span>
<span class='line'>174</span> <span class='line'>174</span> </span><span class="WHIT"> </span><span class="NAME">Date.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.getUTCFullYear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>175</span>
<span class='line'>176</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCMonth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>176</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">isFinite</span><span class="PUNC">(</span><span class="NAME">this.valueOf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCDate</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'T'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>177</span> </span><span class="WHIT"> </span><span class="NAME">this.getUTCFullYear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCHours</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCMonth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCMinutes</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCDate</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'T'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCSeconds</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'Z'</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCHours</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>181</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCMinutes</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>182</span> <span class='line'>182</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCSeconds</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'Z'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="NAME">String.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> <span class='line'>183</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="NAME">Number.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> <span class='line'>184</span>
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">Boolean.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">String.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.valueOf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>186</span> </span><span class="WHIT"> </span><span class="NAME">Number.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>187</span> </span><span class="WHIT"> </span><span class="NAME">Boolean.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>188</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.valueOf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>189</span> <span class='line'>189</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>190</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="NAME">escapable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>191</span>
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>192</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="NAME">indent</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>193</span> </span><span class="WHIT"> </span><span class="NAME">escapable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="NAME">meta</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// table of character substitutions</span><span class="WHIT"> <span class='line'>194</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>195</span> </span><span class="WHIT"> </span><span class="STRN">'\b'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\b'</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>195</span> </span><span class="WHIT"> </span><span class="NAME">indent</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="STRN">'\t'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\t'</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>196</span> </span><span class="WHIT"> </span><span class="NAME">meta</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// table of character substitutions</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\n'</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>197</span> </span><span class="WHIT"> </span><span class="STRN">'\b'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\b'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="STRN">'\f'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\f'</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>198</span> </span><span class="WHIT"> </span><span class="STRN">'\t'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\t'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="STRN">'\r'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\r'</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>199</span> </span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\n'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\"'</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>200</span> </span><span class="WHIT"> </span><span class="STRN">'\f'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\f'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="STRN">'\\'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\\\'</span><span class="WHIT"> <span class='line'>201</span> </span><span class="WHIT"> </span><span class="STRN">'\r'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\r'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>202</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\"'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="NAME">rep</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>203</span> </span><span class="WHIT"> </span><span class="STRN">'\\'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\\\'</span><span class="WHIT">
<span class='line'>204</span> <span class='line'>204</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>205</span> <span class='line'>205</span> </span><span class="WHIT"> </span><span class="NAME">rep</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">string</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>206</span>
<span class='line'>207</span> <span class='line'>207</span>
<span class='line'>208</span> </span><span class="COMM">// If the string contains no control characters, no quote characters, and no</span><span class="WHIT"> <span class='line'>208</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">string</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>209</span> </span><span class="COMM">// backslash characters, then we can safely slap some quotes around it.</span><span class="WHIT"> <span class='line'>209</span>
<span class='line'>210</span> </span><span class="COMM">// Otherwise we must also replace the offending characters with safe escape</span><span class="WHIT"> <span class='line'>210</span> </span><span class="COMM">// If the string contains no control characters, no quote characters, and no</span><span class="WHIT">
<span class='line'>211</span> </span><span class="COMM">// sequences.</span><span class="WHIT"> <span class='line'>211</span> </span><span class="COMM">// backslash characters, then we can safely slap some quotes around it.</span><span class="WHIT">
<span class='line'>212</span> <span class='line'>212</span> </span><span class="COMM">// Otherwise we must also replace the offending characters with safe escape</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="NAME">escapable.lastIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>213</span> </span><span class="COMM">// sequences.</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">escapable.test</span><span class="PUNC">(</span><span class="NAME">string</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> <span class='line'>214</span>
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">string.replace</span><span class="PUNC">(</span><span class="NAME">escapable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>215</span> </span><span class="WHIT"> </span><span class="NAME">escapable.lastIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">meta</span><span class="PUNC">[</span><span class="NAME">a</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>216</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">escapable.test</span><span class="PUNC">(</span><span class="NAME">string</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>217</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">string.replace</span><span class="PUNC">(</span><span class="NAME">escapable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="STRN">'\\u'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">'0000'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">a.charCodeAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toString</span><span class="PUNC">(</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">slice</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>218</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">meta</span><span class="PUNC">[</span><span class="NAME">a</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>219</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">string</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>220</span> </span><span class="WHIT"> </span><span class="STRN">'\\u'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">'0000'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">a.charCodeAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toString</span><span class="PUNC">(</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">slice</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>221</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>222</span> <span class='line'>222</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">string</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>223</span> <span class='line'>223</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">holder</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>224</span>
<span class='line'>225</span> <span class='line'>225</span>
<span class='line'>226</span> </span><span class="COMM">// Produce a string from holder[key].</span><span class="WHIT"> <span class='line'>226</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">holder</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>227</span> <span class='line'>227</span> </span><span class="COMM">// Produce a string from holder[key].</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The loop counter.</span><span class="WHIT"> <span class='line'>228</span>
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The member key.</span><span class="WHIT"> <span class='line'>229</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The loop counter.</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The member value.</span><span class="WHIT"> <span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The member key.</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>231</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The member value.</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>232</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>233</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">holder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>234</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>235</span> <span class='line'>235</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">holder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>236</span> </span><span class="COMM">// If the value has a toJSON method, call it to obtain a replacement value.</span><span class="WHIT"> <span class='line'>236</span>
<span class='line'>237</span> <span class='line'>237</span> </span><span class="COMM">// If the value has a toJSON method, call it to obtain a replacement value.</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> <span class='line'>238</span>
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value.toJSON</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value.toJSON</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>240</span> </span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value.toJSON</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>241</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value.toJSON</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>242</span> <span class='line'>242</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>243</span> </span><span class="COMM">// If we were called with a replacer function, then call the replacer to</span><span class="WHIT"> <span class='line'>243</span>
<span class='line'>244</span> </span><span class="COMM">// obtain a replacement value.</span><span class="WHIT"> <span class='line'>244</span> </span><span class="COMM">// If we were called with a replacer function, then call the replacer to</span><span class="WHIT">
<span class='line'>245</span> <span class='line'>245</span> </span><span class="COMM">// obtain a replacement value.</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>246</span>
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep.call</span><span class="PUNC">(</span><span class="NAME">holder</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>247</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>248</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep.call</span><span class="PUNC">(</span><span class="NAME">holder</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>249</span> <span class='line'>249</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>250</span> </span><span class="COMM">// What happens next depends on the value's type.</span><span class="WHIT"> <span class='line'>250</span>
<span class='line'>251</span> <span class='line'>251</span> </span><span class="COMM">// What happens next depends on the value's type.</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>252</span>
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>253</span> </span><span class="WHIT"> </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>254</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>255</span> <span class='line'>255</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>256</span>
<span class='line'>257</span> <span class='line'>257</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>258</span> </span><span class="COMM">// JSON numbers must be finite. Encode non-finite numbers as null.</span><span class="WHIT"> <span class='line'>258</span>
<span class='line'>259</span> <span class='line'>259</span> </span><span class="COMM">// JSON numbers must be finite. Encode non-finite numbers as null.</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">isFinite</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>260</span>
<span class='line'>261</span> <span class='line'>261</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">isFinite</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'boolean'</span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>262</span>
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>263</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'boolean'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>264</span> <span class='line'>264</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>265</span> </span><span class="COMM">// If the value is a boolean or null, convert it to a string. Note:</span><span class="WHIT"> <span class='line'>265</span>
<span class='line'>266</span> </span><span class="COMM">// typeof null does not produce 'null'. The case is included here in</span><span class="WHIT"> <span class='line'>266</span> </span><span class="COMM">// If the value is a boolean or null, convert it to a string. Note:</span><span class="WHIT">
<span class='line'>267</span> </span><span class="COMM">// the remote chance that this gets fixed someday.</span><span class="WHIT"> <span class='line'>267</span> </span><span class="COMM">// typeof null does not produce 'null'. The case is included here in</span><span class="WHIT">
<span class='line'>268</span> <span class='line'>268</span> </span><span class="COMM">// the remote chance that this gets fixed someday.</span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>269</span>
<span class='line'>270</span> <span class='line'>270</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>271</span> </span><span class="COMM">// If the type is 'object', we might be dealing with an object or an array or</span><span class="WHIT"> <span class='line'>271</span>
<span class='line'>272</span> </span><span class="COMM">// null.</span><span class="WHIT"> <span class='line'>272</span> </span><span class="COMM">// If the type is 'object', we might be dealing with an object or an array or</span><span class="WHIT">
<span class='line'>273</span> <span class='line'>273</span> </span><span class="COMM">// null.</span><span class="WHIT">
<span class='line'>274</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>274</span>
<span class='line'>275</span> <span class='line'>275</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>276</span> </span><span class="COMM">// Due to a specification blunder in ECMAScript, typeof null is 'object',</span><span class="WHIT"> <span class='line'>276</span>
<span class='line'>277</span> </span><span class="COMM">// so watch out for that case.</span><span class="WHIT"> <span class='line'>277</span> </span><span class="COMM">// Due to a specification blunder in ECMAScript, typeof null is 'object',</span><span class="WHIT">
<span class='line'>278</span> <span class='line'>278</span> </span><span class="COMM">// so watch out for that case.</span><span class="WHIT">
<span class='line'>279</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>279</span>
<span class='line'>280</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>280</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>281</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>281</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>282</span> <span class='line'>282</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>283</span> </span><span class="COMM">// Make an array to hold the partial results of stringifying this object value.</span><span class="WHIT"> <span class='line'>283</span>
<span class='line'>284</span> <span class='line'>284</span> </span><span class="COMM">// Make an array to hold the partial results of stringifying this object value.</span><span class="WHIT">
<span class='line'>285</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">indent</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>285</span>
<span class='line'>286</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>286</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">indent</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>287</span> <span class='line'>287</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>288</span> </span><span class="COMM">// Is the value an array?</span><span class="WHIT"> <span class='line'>288</span>
<span class='line'>289</span> <span class='line'>289</span> </span><span class="COMM">// Is the value an array?</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Object.prototype.toString.apply</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'[object Array]'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>290</span>
<span class='line'>291</span> <span class='line'>291</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Object.prototype.toString.apply</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'[object Array]'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>292</span> </span><span class="COMM">// The value is an array. Stringify every element. Use null as a placeholder</span><span class="WHIT"> <span class='line'>292</span>
<span class='line'>293</span> </span><span class="COMM">// for non-JSON values.</span><span class="WHIT"> <span class='line'>293</span> </span><span class="COMM">// The value is an array. Stringify every element. Use null as a placeholder</span><span class="WHIT">
<span class='line'>294</span> <span class='line'>294</span> </span><span class="COMM">// for non-JSON values.</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value.length</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>295</span>
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>296</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>297</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>298</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>299</span> <span class='line'>299</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>300</span> </span><span class="COMM">// Join all of the elements together, separated with commas, and wrap them in</span><span class="WHIT"> <span class='line'>300</span>
<span class='line'>301</span> </span><span class="COMM">// brackets.</span><span class="WHIT"> <span class='line'>301</span> </span><span class="COMM">// Join all of the elements together, separated with commas, and wrap them in</span><span class="WHIT">
<span class='line'>302</span> <span class='line'>302</span> </span><span class="COMM">// brackets.</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">partial.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'[]'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>303</span>
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'[\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>304</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">partial.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'[]'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">',\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>305</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'[\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>306</span> </span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">',\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT"> </span><span class="STRN">'['</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>307</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mind</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>308</span> </span><span class="WHIT"> </span><span class="STRN">'['</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>309</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mind</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>310</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span> <span class='line'>311</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>312</span> </span><span class="COMM">// If the replacer is an array, use it to select the members to be stringified.</span><span class="WHIT"> <span class='line'>312</span>
<span class='line'>313</span> <span class='line'>313</span> </span><span class="COMM">// If the replacer is an array, use it to select the members to be stringified.</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>314</span>
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep.length</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>315</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>316</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>317</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>318</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>319</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>320</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>320</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="NAME">partial.push</span><span class="PUNC">(</span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">': '</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>321</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>322</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>322</span> </span><span class="WHIT"> </span><span class="NAME">partial.push</span><span class="PUNC">(</span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">': '</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>323</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>324</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>324</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>325</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>326</span> <span class='line'>326</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>327</span> </span><span class="COMM">// Otherwise, iterate through all of the keys in the object.</span><span class="WHIT"> <span class='line'>327</span>
<span class='line'>328</span> <span class='line'>328</span> </span><span class="COMM">// Otherwise, iterate through all of the keys in the object.</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>329</span>
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Object.hasOwnProperty.call</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>330</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>331</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Object.hasOwnProperty.call</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>332</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT"> </span><span class="NAME">partial.push</span><span class="PUNC">(</span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">': '</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>333</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>334</span> </span><span class="WHIT"> </span><span class="NAME">partial.push</span><span class="PUNC">(</span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">': '</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>335</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>336</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>337</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>338</span> <span class='line'>338</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>339</span> </span><span class="COMM">// Join all of the member texts together, separated with commas,</span><span class="WHIT"> <span class='line'>339</span>
<span class='line'>340</span> </span><span class="COMM">// and wrap them in braces.</span><span class="WHIT"> <span class='line'>340</span> </span><span class="COMM">// Join all of the member texts together, separated with commas,</span><span class="WHIT">
<span class='line'>341</span> <span class='line'>341</span> </span><span class="COMM">// and wrap them in braces.</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">partial.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'{}'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> <span class='line'>342</span>
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'{\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">',\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> <span class='line'>343</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">partial.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'{}'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'}'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'{'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'}'</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>344</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'{\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">',\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mind</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>345</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'}'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'{'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'}'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>346</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mind</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>347</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>348</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>348</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>349</span> <span class='line'>349</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>350</span> </span><span class="COMM">// If the JSON object does not yet have a stringify method, give it one.</span><span class="WHIT"> <span class='line'>350</span>
<span class='line'>351</span> <span class='line'>351</span> </span><span class="COMM">// If the JSON object does not yet have a stringify method, give it one.</span><span class="WHIT">
<span class='line'>352</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>352</span>
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">replacer</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">space</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>353</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>354</span> <span class='line'>354</span> </span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">replacer</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">space</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>355</span> </span><span class="COMM">// The stringify method takes a value and an optional replacer, and an optional</span><span class="WHIT"> <span class='line'>355</span> </span><span class="COMM">// The stringify method takes a value and an optional replacer, and an optional</span><span class="WHIT">
<span class='line'>356</span> </span><span class="COMM">// space parameter, and returns a JSON text. The replacer can be a function</span><span class="WHIT"> <span class='line'>356</span> </span><span class="COMM">// space parameter, and returns a JSON text. The replacer can be a function</span><span class="WHIT">
<span class='line'>357</span> </span><span class="COMM">// that can replace values, or an array of strings that will select the keys.</span><span class="WHIT"> <span class='line'>357</span> </span><span class="COMM">// that can replace values, or an array of strings that will select the keys.</span><span class="WHIT">
@ -482,5 +482,5 @@
<span class='line'>475</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">SyntaxError</span><span class="PUNC">(</span><span class="STRN">'JSON.parse'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>475</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">SyntaxError</span><span class="PUNC">(</span><span class="STRN">'JSON.parse'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>476</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>476</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>477</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>477</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>478</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>478</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>479</span> </span></pre></body></html> <span class='line'>479</span> </span></pre></body></html>

View File

@ -12,7 +12,7 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
if (typeof child === 'string') { if (typeof child === 'string') {
el.appendChild(document.createTextNode(child)); el.appendChild(document.createTextNode(child));
} else { } else {
el.appendChild(child); if (child) { el.appendChild(child); }
} }
} }

View File

@ -517,7 +517,7 @@ jasmine.version_= {
"major": 0, "major": 0,
"minor": 9, "minor": 9,
"build": 0, "build": 0,
"revision": 1254180093 "revision": 1254287286
}; };
/** /**
* @namespace * @namespace
@ -924,6 +924,38 @@ jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
jasmine.JsApiReporter.prototype.log = function(str) { jasmine.JsApiReporter.prototype.log = function(str) {
}; };
jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
var results = {};
for (var i = 0; i < specIds.length; i++) {
var specId = specIds[i];
results[specId] = this.summarizeResult_(this.results_[specId]);
}
return results;
};
jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
var summaryMessages = [];
for (var messageIndex in result.messages) {
var resultMessage = result.messages[messageIndex];
summaryMessages.push({
text: resultMessage.text,
passed: resultMessage.passed ? resultMessage.passed() : true,
type: resultMessage.type,
message: resultMessage.message,
trace: {
stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : undefined
}
});
};
var summaryResult = {
result : result.result,
messages : summaryMessages
};
return summaryResult;
};
jasmine.Matchers = function(env, actual, results) { jasmine.Matchers = function(env, actual, results) {
this.env = env; this.env = env;
this.actual = actual; this.actual = actual;

View File

@ -1,6 +1,6 @@
/* /*
http://www.JSON.org/json2.js http://www.JSON.org/json2.js
2008-11-19 2009-08-17
Public Domain. Public Domain.
@ -33,7 +33,7 @@
value represented by the name/value pair that should be serialized, value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be will be passed the key associated with the value, and this will be
bound to the object holding the key. bound to the value
For example, this would serialize Dates as ISO strings. For example, this would serialize Dates as ISO strings.
@ -146,8 +146,6 @@
/*jslint evil: true */ /*jslint evil: true */
/*global JSON */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
@ -155,12 +153,15 @@
test, toJSON, toString, valueOf test, toJSON, toString, valueOf
*/ */
"use strict";
// Create a JSON object only if one does not already exist. We create the // Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables. // methods in a closure to avoid creating global variables.
if (!this.JSON) { if (!this.JSON) {
JSON = {}; this.JSON = {};
} }
(function () { (function () {
function f(n) { function f(n) {
@ -172,12 +173,13 @@ if (!this.JSON) {
Date.prototype.toJSON = function (key) { Date.prototype.toJSON = function (key) {
return this.getUTCFullYear() + '-' + return isFinite(this.valueOf()) ?
this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' + f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' + f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' + f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' + f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'; f(this.getUTCSeconds()) + 'Z' : null;
}; };
String.prototype.toJSON = String.prototype.toJSON =
@ -222,7 +224,6 @@ if (!this.JSON) {
function str(key, holder) { function str(key, holder) {
// Produce a string from holder[key]. // Produce a string from holder[key].
var i, // The loop counter. var i, // The loop counter.
@ -351,7 +352,6 @@ if (!this.JSON) {
if (typeof JSON.stringify !== 'function') { if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) { JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional // The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function // space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys. // that can replace values, or an array of strings that will select the keys.
@ -475,4 +475,4 @@ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
throw new SyntaxError('JSON.parse'); throw new SyntaxError('JSON.parse');
}; };
} }
})(); }());

View File

@ -1,13 +1,13 @@
describe('JsApiReporterSpec', function () { describe('jasmine.jsApiReporter', function() {
describe('results', function () { describe('results', function () {
var reporter, spec1, spec2, expectedSpec1Results, expectedSpec2Results; var reporter, spec1, spec2, spec3, expectedSpec1Results, expectedSpec2Results;
beforeEach(function() { beforeEach(function() {
var env = new jasmine.Env(); var env = new jasmine.Env();
var suite = new jasmine.Suite(env); var suite = new jasmine.Suite(env);
spec1 = new jasmine.Spec(env, suite); spec1 = new jasmine.Spec(env, suite, 'spec 1');
spec1.runs(function () { spec1.runs(function () {
this.expect(true).toEqual(true); this.expect(true).toEqual(true);
}); });
@ -15,7 +15,7 @@ describe('JsApiReporterSpec', function () {
messages: spec1.results().getItems(), messages: spec1.results().getItems(),
result: "passed" result: "passed"
}; };
spec2 = new jasmine.Spec(env, suite); spec2 = new jasmine.Spec(env, suite, 'spec 2');
spec2.runs(function () { spec2.runs(function () {
this.expect(true).toEqual(false); this.expect(true).toEqual(false);
}); });
@ -24,12 +24,19 @@ describe('JsApiReporterSpec', function () {
result: "failed" result: "failed"
}; };
spec3 = new jasmine.Spec(env, suite, 'spec 3');
spec3.runs(function () {
this.log('some debug message')
});
spec1.execute(); spec1.execute();
spec2.execute(); spec2.execute();
spec3.execute();
reporter = new jasmine.JsApiReporter(); reporter = new jasmine.JsApiReporter();
reporter.reportSpecResults(spec1); reporter.reportSpecResults(spec1);
reporter.reportSpecResults(spec2); reporter.reportSpecResults(spec2);
reporter.reportSpecResults(spec3);
}); });
it('resultForSpec() should return the result for the given spec', function () { it('resultForSpec() should return the result for the given spec', function () {
@ -43,5 +50,32 @@ describe('JsApiReporterSpec', function () {
expect(reporter.results()[spec2.id]).toEqual(expectedSpec2Results); expect(reporter.results()[spec2.id]).toEqual(expectedSpec2Results);
}); });
describe("#summarizeResult_", function() {
it("should summarize a passing result", function() {
var result = reporter.results()[spec1.id];
var summarizedResult = reporter.summarizeResult_(result);
expect(summarizedResult.result).toEqual('passed');
expect(summarizedResult.messages.length).toEqual(1);
expect(summarizedResult.messages[0].message).toEqual(result.messages[0].message);
expect(summarizedResult.messages[0].passed).toBeTruthy();
expect(summarizedResult.messages[0].type).toEqual('ExpectationResult');
expect(summarizedResult.messages[0].text).toEqual(undefined);
expect(summarizedResult.messages[0].trace.stack).toEqual(undefined);
});
it("should have a stack trace for failing specs", function() {
var result = reporter.results()[spec2.id];
var summarizedResult = reporter.summarizeResult_(result);
expect(summarizedResult.result).toEqual('failed');
expect(summarizedResult.messages[0].trace.stack).toEqual(result.messages[0].trace.stack);
});
it("should have messages for specs with messages", function() {
var result = reporter.results()[spec3.id];
var summarizedResult = reporter.summarizeResult_(result);
expect(summarizedResult.result).toEqual('passed');
expect(summarizedResult.messages[0].text).toEqual('some debug message');
});
});
}); });
}); });

View File

@ -68,3 +68,35 @@ jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
jasmine.JsApiReporter.prototype.log = function(str) { jasmine.JsApiReporter.prototype.log = function(str) {
}; };
jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
var results = {};
for (var i = 0; i < specIds.length; i++) {
var specId = specIds[i];
results[specId] = this.summarizeResult_(this.results_[specId]);
}
return results;
};
jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
var summaryMessages = [];
for (var messageIndex in result.messages) {
var resultMessage = result.messages[messageIndex];
summaryMessages.push({
text: resultMessage.text,
passed: resultMessage.passed ? resultMessage.passed() : true,
type: resultMessage.type,
message: resultMessage.message,
trace: {
stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : undefined
}
});
};
var summaryResult = {
result : result.result,
messages : summaryMessages
};
return summaryResult;
};