UNPKG

850 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('chalk')) :
3 typeof define === 'function' && define.amd ? define(['chalk'], factory) :
4 (factory(global.chalk));
5}(this, (function (chalk) { 'use strict';
6
7chalk = chalk && chalk.hasOwnProperty('default') ? chalk['default'] : chalk;
8
9var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
11
12
13
14
15function createCommonjsModule(fn, module) {
16 return module = { exports: {} }, fn(module, module.exports), module.exports;
17}
18
19var diffMatchPatch = createCommonjsModule(function (module) {
20function diff_match_patch() {
21
22 // Defaults.
23 // Redefine these in your program to override the defaults.
24
25 // Number of seconds to map a diff before giving up (0 for infinity).
26 this.Diff_Timeout = 1.0;
27 // Cost of an empty edit operation in terms of edit characters.
28 this.Diff_EditCost = 4;
29 // At what point is no match declared (0.0 = perfection, 1.0 = very loose).
30 this.Match_Threshold = 0.5;
31 // How far to search for a match (0 = exact location, 1000+ = broad match).
32 // A match this many characters away from the expected location will add
33 // 1.0 to the score (0.0 is a perfect match).
34 this.Match_Distance = 1000;
35 // When deleting a large block of text (over ~64 characters), how close do
36 // the contents have to be to match the expected contents. (0.0 = perfection,
37 // 1.0 = very loose). Note that Match_Threshold controls how closely the
38 // end points of a delete need to match.
39 this.Patch_DeleteThreshold = 0.5;
40 // Chunk size for context length.
41 this.Patch_Margin = 4;
42
43 // The number of bits in an int.
44 this.Match_MaxBits = 32;
45}
46
47
48// DIFF FUNCTIONS
49
50
51/**
52 * The data structure representing a diff is an array of tuples:
53 * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
54 * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
55 */
56var DIFF_DELETE = -1;
57var DIFF_INSERT = 1;
58var DIFF_EQUAL = 0;
59
60/** @typedef {{0: number, 1: string}} */
61diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
62 opt_deadline) {
63 // Set a deadline by which time the diff must be complete.
64 if (typeof opt_deadline == 'undefined') {
65 if (this.Diff_Timeout <= 0) {
66 opt_deadline = Number.MAX_VALUE;
67 } else {
68 opt_deadline = (new Date).getTime() + this.Diff_Timeout * 1000;
69 }
70 }
71 var deadline = opt_deadline;
72
73 // Check for null inputs.
74 if (text1 == null || text2 == null) {
75 throw new Error('Null input. (diff_main)');
76 }
77
78 // Check for equality (speedup).
79 if (text1 == text2) {
80 if (text1) {
81 return [[DIFF_EQUAL, text1]];
82 }
83 return [];
84 }
85
86 if (typeof opt_checklines == 'undefined') {
87 opt_checklines = true;
88 }
89 var checklines = opt_checklines;
90
91 // Trim off common prefix (speedup).
92 var commonlength = this.diff_commonPrefix(text1, text2);
93 var commonprefix = text1.substring(0, commonlength);
94 text1 = text1.substring(commonlength);
95 text2 = text2.substring(commonlength);
96
97 // Trim off common suffix (speedup).
98 commonlength = this.diff_commonSuffix(text1, text2);
99 var commonsuffix = text1.substring(text1.length - commonlength);
100 text1 = text1.substring(0, text1.length - commonlength);
101 text2 = text2.substring(0, text2.length - commonlength);
102
103 // Compute the diff on the middle block.
104 var diffs = this.diff_compute_(text1, text2, checklines, deadline);
105
106 // Restore the prefix and suffix.
107 if (commonprefix) {
108 diffs.unshift([DIFF_EQUAL, commonprefix]);
109 }
110 if (commonsuffix) {
111 diffs.push([DIFF_EQUAL, commonsuffix]);
112 }
113 this.diff_cleanupMerge(diffs);
114 return diffs;
115};
116
117
118/**
119 * Find the differences between two texts. Assumes that the texts do not
120 * have any common prefix or suffix.
121 * @param {string} text1 Old string to be diffed.
122 * @param {string} text2 New string to be diffed.
123 * @param {boolean} checklines Speedup flag. If false, then don't run a
124 * line-level diff first to identify the changed areas.
125 * If true, then run a faster, slightly less optimal diff.
126 * @param {number} deadline Time when the diff should be complete by.
127 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
128 * @private
129 */
130diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
131 deadline) {
132 var diffs;
133
134 if (!text1) {
135 // Just add some text (speedup).
136 return [[DIFF_INSERT, text2]];
137 }
138
139 if (!text2) {
140 // Just delete some text (speedup).
141 return [[DIFF_DELETE, text1]];
142 }
143
144 var longtext = text1.length > text2.length ? text1 : text2;
145 var shorttext = text1.length > text2.length ? text2 : text1;
146 var i = longtext.indexOf(shorttext);
147 if (i != -1) {
148 // Shorter text is inside the longer text (speedup).
149 diffs = [[DIFF_INSERT, longtext.substring(0, i)],
150 [DIFF_EQUAL, shorttext],
151 [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
152 // Swap insertions for deletions if diff is reversed.
153 if (text1.length > text2.length) {
154 diffs[0][0] = diffs[2][0] = DIFF_DELETE;
155 }
156 return diffs;
157 }
158
159 if (shorttext.length == 1) {
160 // Single character string.
161 // After the previous speedup, the character can't be an equality.
162 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
163 }
164
165 // Check to see if the problem can be split in two.
166 var hm = this.diff_halfMatch_(text1, text2);
167 if (hm) {
168 // A half-match was found, sort out the return data.
169 var text1_a = hm[0];
170 var text1_b = hm[1];
171 var text2_a = hm[2];
172 var text2_b = hm[3];
173 var mid_common = hm[4];
174 // Send both pairs off for separate processing.
175 var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);
176 var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);
177 // Merge the results.
178 return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
179 }
180
181 if (checklines && text1.length > 100 && text2.length > 100) {
182 return this.diff_lineMode_(text1, text2, deadline);
183 }
184
185 return this.diff_bisect_(text1, text2, deadline);
186};
187
188
189/**
190 * Do a quick line-level diff on both strings, then rediff the parts for
191 * greater accuracy.
192 * This speedup can produce non-minimal diffs.
193 * @param {string} text1 Old string to be diffed.
194 * @param {string} text2 New string to be diffed.
195 * @param {number} deadline Time when the diff should be complete by.
196 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
197 * @private
198 */
199diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
200 // Scan the text on a line-by-line basis first.
201 var a = this.diff_linesToChars_(text1, text2);
202 text1 = a.chars1;
203 text2 = a.chars2;
204 var linearray = a.lineArray;
205
206 var diffs = this.diff_main(text1, text2, false, deadline);
207
208 // Convert the diff back to original text.
209 this.diff_charsToLines_(diffs, linearray);
210 // Eliminate freak matches (e.g. blank lines)
211 this.diff_cleanupSemantic(diffs);
212
213 // Rediff any replacement blocks, this time character-by-character.
214 // Add a dummy entry at the end.
215 diffs.push([DIFF_EQUAL, '']);
216 var pointer = 0;
217 var count_delete = 0;
218 var count_insert = 0;
219 var text_delete = '';
220 var text_insert = '';
221 while (pointer < diffs.length) {
222 switch (diffs[pointer][0]) {
223 case DIFF_INSERT:
224 count_insert++;
225 text_insert += diffs[pointer][1];
226 break;
227 case DIFF_DELETE:
228 count_delete++;
229 text_delete += diffs[pointer][1];
230 break;
231 case DIFF_EQUAL:
232 // Upon reaching an equality, check for prior redundancies.
233 if (count_delete >= 1 && count_insert >= 1) {
234 // Delete the offending records and add the merged ones.
235 diffs.splice(pointer - count_delete - count_insert,
236 count_delete + count_insert);
237 pointer = pointer - count_delete - count_insert;
238 var a = this.diff_main(text_delete, text_insert, false, deadline);
239 for (var j = a.length - 1; j >= 0; j--) {
240 diffs.splice(pointer, 0, a[j]);
241 }
242 pointer = pointer + a.length;
243 }
244 count_insert = 0;
245 count_delete = 0;
246 text_delete = '';
247 text_insert = '';
248 break;
249 }
250 pointer++;
251 }
252 diffs.pop(); // Remove the dummy entry at the end.
253
254 return diffs;
255};
256
257
258/**
259 * Find the 'middle snake' of a diff, split the problem in two
260 * and return the recursively constructed diff.
261 * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
262 * @param {string} text1 Old string to be diffed.
263 * @param {string} text2 New string to be diffed.
264 * @param {number} deadline Time at which to bail if not yet complete.
265 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
266 * @private
267 */
268diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
269 // Cache the text lengths to prevent multiple calls.
270 var text1_length = text1.length;
271 var text2_length = text2.length;
272 var max_d = Math.ceil((text1_length + text2_length) / 2);
273 var v_offset = max_d;
274 var v_length = 2 * max_d;
275 var v1 = new Array(v_length);
276 var v2 = new Array(v_length);
277 // Setting all elements to -1 is faster in Chrome & Firefox than mixing
278 // integers and undefined.
279 for (var x = 0; x < v_length; x++) {
280 v1[x] = -1;
281 v2[x] = -1;
282 }
283 v1[v_offset + 1] = 0;
284 v2[v_offset + 1] = 0;
285 var delta = text1_length - text2_length;
286 // If the total number of characters is odd, then the front path will collide
287 // with the reverse path.
288 var front = (delta % 2 != 0);
289 // Offsets for start and end of k loop.
290 // Prevents mapping of space beyond the grid.
291 var k1start = 0;
292 var k1end = 0;
293 var k2start = 0;
294 var k2end = 0;
295 for (var d = 0; d < max_d; d++) {
296 // Bail out if deadline is reached.
297 if ((new Date()).getTime() > deadline) {
298 break;
299 }
300
301 // Walk the front path one step.
302 for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
303 var k1_offset = v_offset + k1;
304 var x1;
305 if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
306 x1 = v1[k1_offset + 1];
307 } else {
308 x1 = v1[k1_offset - 1] + 1;
309 }
310 var y1 = x1 - k1;
311 while (x1 < text1_length && y1 < text2_length &&
312 text1.charAt(x1) == text2.charAt(y1)) {
313 x1++;
314 y1++;
315 }
316 v1[k1_offset] = x1;
317 if (x1 > text1_length) {
318 // Ran off the right of the graph.
319 k1end += 2;
320 } else if (y1 > text2_length) {
321 // Ran off the bottom of the graph.
322 k1start += 2;
323 } else if (front) {
324 var k2_offset = v_offset + delta - k1;
325 if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
326 // Mirror x2 onto top-left coordinate system.
327 var x2 = text1_length - v2[k2_offset];
328 if (x1 >= x2) {
329 // Overlap detected.
330 return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
331 }
332 }
333 }
334 }
335
336 // Walk the reverse path one step.
337 for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
338 var k2_offset = v_offset + k2;
339 var x2;
340 if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
341 x2 = v2[k2_offset + 1];
342 } else {
343 x2 = v2[k2_offset - 1] + 1;
344 }
345 var y2 = x2 - k2;
346 while (x2 < text1_length && y2 < text2_length &&
347 text1.charAt(text1_length - x2 - 1) ==
348 text2.charAt(text2_length - y2 - 1)) {
349 x2++;
350 y2++;
351 }
352 v2[k2_offset] = x2;
353 if (x2 > text1_length) {
354 // Ran off the left of the graph.
355 k2end += 2;
356 } else if (y2 > text2_length) {
357 // Ran off the top of the graph.
358 k2start += 2;
359 } else if (!front) {
360 var k1_offset = v_offset + delta - k2;
361 if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
362 var x1 = v1[k1_offset];
363 var y1 = v_offset + x1 - k1_offset;
364 // Mirror x2 onto top-left coordinate system.
365 x2 = text1_length - x2;
366 if (x1 >= x2) {
367 // Overlap detected.
368 return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
369 }
370 }
371 }
372 }
373 }
374 // Diff took too long and hit the deadline or
375 // number of diffs equals number of characters, no commonality at all.
376 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
377};
378
379
380/**
381 * Given the location of the 'middle snake', split the diff in two parts
382 * and recurse.
383 * @param {string} text1 Old string to be diffed.
384 * @param {string} text2 New string to be diffed.
385 * @param {number} x Index of split point in text1.
386 * @param {number} y Index of split point in text2.
387 * @param {number} deadline Time at which to bail if not yet complete.
388 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
389 * @private
390 */
391diff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x, y,
392 deadline) {
393 var text1a = text1.substring(0, x);
394 var text2a = text2.substring(0, y);
395 var text1b = text1.substring(x);
396 var text2b = text2.substring(y);
397
398 // Compute both diffs serially.
399 var diffs = this.diff_main(text1a, text2a, false, deadline);
400 var diffsb = this.diff_main(text1b, text2b, false, deadline);
401
402 return diffs.concat(diffsb);
403};
404
405
406/**
407 * Split two texts into an array of strings. Reduce the texts to a string of
408 * hashes where each Unicode character represents one line.
409 * @param {string} text1 First string.
410 * @param {string} text2 Second string.
411 * @return {{chars1: string, chars2: string, lineArray: !Array.<string>}}
412 * An object containing the encoded text1, the encoded text2 and
413 * the array of unique strings.
414 * The zeroth element of the array of unique strings is intentionally blank.
415 * @private
416 */
417diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
418 var lineArray = []; // e.g. lineArray[4] == 'Hello\n'
419 var lineHash = {}; // e.g. lineHash['Hello\n'] == 4
420
421 // '\x00' is a valid character, but various debuggers don't like it.
422 // So we'll insert a junk entry to avoid generating a null character.
423 lineArray[0] = '';
424
425 /**
426 * Split a text into an array of strings. Reduce the texts to a string of
427 * hashes where each Unicode character represents one line.
428 * Modifies linearray and linehash through being a closure.
429 * @param {string} text String to encode.
430 * @return {string} Encoded string.
431 * @private
432 */
433 function diff_linesToCharsMunge_(text) {
434 var chars = '';
435 // Walk the text, pulling out a substring for each line.
436 // text.split('\n') would would temporarily double our memory footprint.
437 // Modifying text would create many large strings to garbage collect.
438 var lineStart = 0;
439 var lineEnd = -1;
440 // Keeping our own length variable is faster than looking it up.
441 var lineArrayLength = lineArray.length;
442 while (lineEnd < text.length - 1) {
443 lineEnd = text.indexOf('\n', lineStart);
444 if (lineEnd == -1) {
445 lineEnd = text.length - 1;
446 }
447 var line = text.substring(lineStart, lineEnd + 1);
448 lineStart = lineEnd + 1;
449
450 if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :
451 (lineHash[line] !== undefined)) {
452 chars += String.fromCharCode(lineHash[line]);
453 } else {
454 chars += String.fromCharCode(lineArrayLength);
455 lineHash[line] = lineArrayLength;
456 lineArray[lineArrayLength++] = line;
457 }
458 }
459 return chars;
460 }
461
462 var chars1 = diff_linesToCharsMunge_(text1);
463 var chars2 = diff_linesToCharsMunge_(text2);
464 return {chars1: chars1, chars2: chars2, lineArray: lineArray};
465};
466
467
468/**
469 * Rehydrate the text in a diff from a string of line hashes to real lines of
470 * text.
471 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
472 * @param {!Array.<string>} lineArray Array of unique strings.
473 * @private
474 */
475diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
476 for (var x = 0; x < diffs.length; x++) {
477 var chars = diffs[x][1];
478 var text = [];
479 for (var y = 0; y < chars.length; y++) {
480 text[y] = lineArray[chars.charCodeAt(y)];
481 }
482 diffs[x][1] = text.join('');
483 }
484};
485
486
487/**
488 * Determine the common prefix of two strings.
489 * @param {string} text1 First string.
490 * @param {string} text2 Second string.
491 * @return {number} The number of characters common to the start of each
492 * string.
493 */
494diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
495 // Quick check for common null cases.
496 if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
497 return 0;
498 }
499 // Binary search.
500 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
501 var pointermin = 0;
502 var pointermax = Math.min(text1.length, text2.length);
503 var pointermid = pointermax;
504 var pointerstart = 0;
505 while (pointermin < pointermid) {
506 if (text1.substring(pointerstart, pointermid) ==
507 text2.substring(pointerstart, pointermid)) {
508 pointermin = pointermid;
509 pointerstart = pointermin;
510 } else {
511 pointermax = pointermid;
512 }
513 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
514 }
515 return pointermid;
516};
517
518
519/**
520 * Determine the common suffix of two strings.
521 * @param {string} text1 First string.
522 * @param {string} text2 Second string.
523 * @return {number} The number of characters common to the end of each string.
524 */
525diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {
526 // Quick check for common null cases.
527 if (!text1 || !text2 ||
528 text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
529 return 0;
530 }
531 // Binary search.
532 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
533 var pointermin = 0;
534 var pointermax = Math.min(text1.length, text2.length);
535 var pointermid = pointermax;
536 var pointerend = 0;
537 while (pointermin < pointermid) {
538 if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
539 text2.substring(text2.length - pointermid, text2.length - pointerend)) {
540 pointermin = pointermid;
541 pointerend = pointermin;
542 } else {
543 pointermax = pointermid;
544 }
545 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
546 }
547 return pointermid;
548};
549
550
551/**
552 * Determine if the suffix of one string is the prefix of another.
553 * @param {string} text1 First string.
554 * @param {string} text2 Second string.
555 * @return {number} The number of characters common to the end of the first
556 * string and the start of the second string.
557 * @private
558 */
559diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
560 // Cache the text lengths to prevent multiple calls.
561 var text1_length = text1.length;
562 var text2_length = text2.length;
563 // Eliminate the null case.
564 if (text1_length == 0 || text2_length == 0) {
565 return 0;
566 }
567 // Truncate the longer string.
568 if (text1_length > text2_length) {
569 text1 = text1.substring(text1_length - text2_length);
570 } else if (text1_length < text2_length) {
571 text2 = text2.substring(0, text1_length);
572 }
573 var text_length = Math.min(text1_length, text2_length);
574 // Quick check for the worst case.
575 if (text1 == text2) {
576 return text_length;
577 }
578
579 // Start by looking for a single character match
580 // and increase length until no match is found.
581 // Performance analysis: http://neil.fraser.name/news/2010/11/04/
582 var best = 0;
583 var length = 1;
584 while (true) {
585 var pattern = text1.substring(text_length - length);
586 var found = text2.indexOf(pattern);
587 if (found == -1) {
588 return best;
589 }
590 length += found;
591 if (found == 0 || text1.substring(text_length - length) ==
592 text2.substring(0, length)) {
593 best = length;
594 length++;
595 }
596 }
597};
598
599
600/**
601 * Do the two texts share a substring which is at least half the length of the
602 * longer text?
603 * This speedup can produce non-minimal diffs.
604 * @param {string} text1 First string.
605 * @param {string} text2 Second string.
606 * @return {Array.<string>} Five element Array, containing the prefix of
607 * text1, the suffix of text1, the prefix of text2, the suffix of
608 * text2 and the common middle. Or null if there was no match.
609 * @private
610 */
611diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {
612 if (this.Diff_Timeout <= 0) {
613 // Don't risk returning a non-optimal diff if we have unlimited time.
614 return null;
615 }
616 var longtext = text1.length > text2.length ? text1 : text2;
617 var shorttext = text1.length > text2.length ? text2 : text1;
618 if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
619 return null; // Pointless.
620 }
621 var dmp = this; // 'this' becomes 'window' in a closure.
622
623 /**
624 * Does a substring of shorttext exist within longtext such that the substring
625 * is at least half the length of longtext?
626 * Closure, but does not reference any external variables.
627 * @param {string} longtext Longer string.
628 * @param {string} shorttext Shorter string.
629 * @param {number} i Start index of quarter length substring within longtext.
630 * @return {Array.<string>} Five element Array, containing the prefix of
631 * longtext, the suffix of longtext, the prefix of shorttext, the suffix
632 * of shorttext and the common middle. Or null if there was no match.
633 * @private
634 */
635 function diff_halfMatchI_(longtext, shorttext, i) {
636 // Start with a 1/4 length substring at position i as a seed.
637 var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
638 var j = -1;
639 var best_common = '';
640 var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
641 while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
642 var prefixLength = dmp.diff_commonPrefix(longtext.substring(i),
643 shorttext.substring(j));
644 var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i),
645 shorttext.substring(0, j));
646 if (best_common.length < suffixLength + prefixLength) {
647 best_common = shorttext.substring(j - suffixLength, j) +
648 shorttext.substring(j, j + prefixLength);
649 best_longtext_a = longtext.substring(0, i - suffixLength);
650 best_longtext_b = longtext.substring(i + prefixLength);
651 best_shorttext_a = shorttext.substring(0, j - suffixLength);
652 best_shorttext_b = shorttext.substring(j + prefixLength);
653 }
654 }
655 if (best_common.length * 2 >= longtext.length) {
656 return [best_longtext_a, best_longtext_b,
657 best_shorttext_a, best_shorttext_b, best_common];
658 } else {
659 return null;
660 }
661 }
662
663 // First check if the second quarter is the seed for a half-match.
664 var hm1 = diff_halfMatchI_(longtext, shorttext,
665 Math.ceil(longtext.length / 4));
666 // Check again based on the third quarter.
667 var hm2 = diff_halfMatchI_(longtext, shorttext,
668 Math.ceil(longtext.length / 2));
669 var hm;
670 if (!hm1 && !hm2) {
671 return null;
672 } else if (!hm2) {
673 hm = hm1;
674 } else if (!hm1) {
675 hm = hm2;
676 } else {
677 // Both matched. Select the longest.
678 hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
679 }
680
681 // A half-match was found, sort out the return data.
682 var text1_a, text1_b, text2_a, text2_b;
683 if (text1.length > text2.length) {
684 text1_a = hm[0];
685 text1_b = hm[1];
686 text2_a = hm[2];
687 text2_b = hm[3];
688 } else {
689 text2_a = hm[0];
690 text2_b = hm[1];
691 text1_a = hm[2];
692 text1_b = hm[3];
693 }
694 var mid_common = hm[4];
695 return [text1_a, text1_b, text2_a, text2_b, mid_common];
696};
697
698
699/**
700 * Reduce the number of edits by eliminating semantically trivial equalities.
701 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
702 */
703diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
704 var changes = false;
705 var equalities = []; // Stack of indices where equalities are found.
706 var equalitiesLength = 0; // Keeping our own length var is faster in JS.
707 /** @type {?string} */
708 var lastequality = null;
709 // Always equal to diffs[equalities[equalitiesLength - 1]][1]
710 var pointer = 0; // Index of current position.
711 // Number of characters that changed prior to the equality.
712 var length_insertions1 = 0;
713 var length_deletions1 = 0;
714 // Number of characters that changed after the equality.
715 var length_insertions2 = 0;
716 var length_deletions2 = 0;
717 while (pointer < diffs.length) {
718 if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.
719 equalities[equalitiesLength++] = pointer;
720 length_insertions1 = length_insertions2;
721 length_deletions1 = length_deletions2;
722 length_insertions2 = 0;
723 length_deletions2 = 0;
724 lastequality = diffs[pointer][1];
725 } else { // An insertion or deletion.
726 if (diffs[pointer][0] == DIFF_INSERT) {
727 length_insertions2 += diffs[pointer][1].length;
728 } else {
729 length_deletions2 += diffs[pointer][1].length;
730 }
731 // Eliminate an equality that is smaller or equal to the edits on both
732 // sides of it.
733 if (lastequality && (lastequality.length <=
734 Math.max(length_insertions1, length_deletions1)) &&
735 (lastequality.length <= Math.max(length_insertions2,
736 length_deletions2))) {
737 // Duplicate record.
738 diffs.splice(equalities[equalitiesLength - 1], 0,
739 [DIFF_DELETE, lastequality]);
740 // Change second copy to insert.
741 diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
742 // Throw away the equality we just deleted.
743 equalitiesLength--;
744 // Throw away the previous equality (it needs to be reevaluated).
745 equalitiesLength--;
746 pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
747 length_insertions1 = 0; // Reset the counters.
748 length_deletions1 = 0;
749 length_insertions2 = 0;
750 length_deletions2 = 0;
751 lastequality = null;
752 changes = true;
753 }
754 }
755 pointer++;
756 }
757
758 // Normalize the diff.
759 if (changes) {
760 this.diff_cleanupMerge(diffs);
761 }
762 this.diff_cleanupSemanticLossless(diffs);
763
764 // Find any overlaps between deletions and insertions.
765 // e.g: <del>abcxxx</del><ins>xxxdef</ins>
766 // -> <del>abc</del>xxx<ins>def</ins>
767 // e.g: <del>xxxabc</del><ins>defxxx</ins>
768 // -> <ins>def</ins>xxx<del>abc</del>
769 // Only extract an overlap if it is as big as the edit ahead or behind it.
770 pointer = 1;
771 while (pointer < diffs.length) {
772 if (diffs[pointer - 1][0] == DIFF_DELETE &&
773 diffs[pointer][0] == DIFF_INSERT) {
774 var deletion = diffs[pointer - 1][1];
775 var insertion = diffs[pointer][1];
776 var overlap_length1 = this.diff_commonOverlap_(deletion, insertion);
777 var overlap_length2 = this.diff_commonOverlap_(insertion, deletion);
778 if (overlap_length1 >= overlap_length2) {
779 if (overlap_length1 >= deletion.length / 2 ||
780 overlap_length1 >= insertion.length / 2) {
781 // Overlap found. Insert an equality and trim the surrounding edits.
782 diffs.splice(pointer, 0,
783 [DIFF_EQUAL, insertion.substring(0, overlap_length1)]);
784 diffs[pointer - 1][1] =
785 deletion.substring(0, deletion.length - overlap_length1);
786 diffs[pointer + 1][1] = insertion.substring(overlap_length1);
787 pointer++;
788 }
789 } else {
790 if (overlap_length2 >= deletion.length / 2 ||
791 overlap_length2 >= insertion.length / 2) {
792 // Reverse overlap found.
793 // Insert an equality and swap and trim the surrounding edits.
794 diffs.splice(pointer, 0,
795 [DIFF_EQUAL, deletion.substring(0, overlap_length2)]);
796 diffs[pointer - 1][0] = DIFF_INSERT;
797 diffs[pointer - 1][1] =
798 insertion.substring(0, insertion.length - overlap_length2);
799 diffs[pointer + 1][0] = DIFF_DELETE;
800 diffs[pointer + 1][1] =
801 deletion.substring(overlap_length2);
802 pointer++;
803 }
804 }
805 pointer++;
806 }
807 pointer++;
808 }
809};
810
811
812/**
813 * Look for single edits surrounded on both sides by equalities
814 * which can be shifted sideways to align the edit to a word boundary.
815 * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
816 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
817 */
818diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
819 /**
820 * Given two strings, compute a score representing whether the internal
821 * boundary falls on logical boundaries.
822 * Scores range from 6 (best) to 0 (worst).
823 * Closure, but does not reference any external variables.
824 * @param {string} one First string.
825 * @param {string} two Second string.
826 * @return {number} The score.
827 * @private
828 */
829 function diff_cleanupSemanticScore_(one, two) {
830 if (!one || !two) {
831 // Edges are the best.
832 return 6;
833 }
834
835 // Each port of this function behaves slightly differently due to
836 // subtle differences in each language's definition of things like
837 // 'whitespace'. Since this function's purpose is largely cosmetic,
838 // the choice has been made to use each language's native features
839 // rather than force total conformity.
840 var char1 = one.charAt(one.length - 1);
841 var char2 = two.charAt(0);
842 var nonAlphaNumeric1 = char1.match(diff_match_patch.nonAlphaNumericRegex_);
843 var nonAlphaNumeric2 = char2.match(diff_match_patch.nonAlphaNumericRegex_);
844 var whitespace1 = nonAlphaNumeric1 &&
845 char1.match(diff_match_patch.whitespaceRegex_);
846 var whitespace2 = nonAlphaNumeric2 &&
847 char2.match(diff_match_patch.whitespaceRegex_);
848 var lineBreak1 = whitespace1 &&
849 char1.match(diff_match_patch.linebreakRegex_);
850 var lineBreak2 = whitespace2 &&
851 char2.match(diff_match_patch.linebreakRegex_);
852 var blankLine1 = lineBreak1 &&
853 one.match(diff_match_patch.blanklineEndRegex_);
854 var blankLine2 = lineBreak2 &&
855 two.match(diff_match_patch.blanklineStartRegex_);
856
857 if (blankLine1 || blankLine2) {
858 // Five points for blank lines.
859 return 5;
860 } else if (lineBreak1 || lineBreak2) {
861 // Four points for line breaks.
862 return 4;
863 } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
864 // Three points for end of sentences.
865 return 3;
866 } else if (whitespace1 || whitespace2) {
867 // Two points for whitespace.
868 return 2;
869 } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
870 // One point for non-alphanumeric.
871 return 1;
872 }
873 return 0;
874 }
875
876 var pointer = 1;
877 // Intentionally ignore the first and last element (don't need checking).
878 while (pointer < diffs.length - 1) {
879 if (diffs[pointer - 1][0] == DIFF_EQUAL &&
880 diffs[pointer + 1][0] == DIFF_EQUAL) {
881 // This is a single edit surrounded by equalities.
882 var equality1 = diffs[pointer - 1][1];
883 var edit = diffs[pointer][1];
884 var equality2 = diffs[pointer + 1][1];
885
886 // First, shift the edit as far left as possible.
887 var commonOffset = this.diff_commonSuffix(equality1, edit);
888 if (commonOffset) {
889 var commonString = edit.substring(edit.length - commonOffset);
890 equality1 = equality1.substring(0, equality1.length - commonOffset);
891 edit = commonString + edit.substring(0, edit.length - commonOffset);
892 equality2 = commonString + equality2;
893 }
894
895 // Second, step character by character right, looking for the best fit.
896 var bestEquality1 = equality1;
897 var bestEdit = edit;
898 var bestEquality2 = equality2;
899 var bestScore = diff_cleanupSemanticScore_(equality1, edit) +
900 diff_cleanupSemanticScore_(edit, equality2);
901 while (edit.charAt(0) === equality2.charAt(0)) {
902 equality1 += edit.charAt(0);
903 edit = edit.substring(1) + equality2.charAt(0);
904 equality2 = equality2.substring(1);
905 var score = diff_cleanupSemanticScore_(equality1, edit) +
906 diff_cleanupSemanticScore_(edit, equality2);
907 // The >= encourages trailing rather than leading whitespace on edits.
908 if (score >= bestScore) {
909 bestScore = score;
910 bestEquality1 = equality1;
911 bestEdit = edit;
912 bestEquality2 = equality2;
913 }
914 }
915
916 if (diffs[pointer - 1][1] != bestEquality1) {
917 // We have an improvement, save it back to the diff.
918 if (bestEquality1) {
919 diffs[pointer - 1][1] = bestEquality1;
920 } else {
921 diffs.splice(pointer - 1, 1);
922 pointer--;
923 }
924 diffs[pointer][1] = bestEdit;
925 if (bestEquality2) {
926 diffs[pointer + 1][1] = bestEquality2;
927 } else {
928 diffs.splice(pointer + 1, 1);
929 pointer--;
930 }
931 }
932 }
933 pointer++;
934 }
935};
936
937// Define some regex patterns for matching boundaries.
938diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
939diff_match_patch.whitespaceRegex_ = /\s/;
940diff_match_patch.linebreakRegex_ = /[\r\n]/;
941diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/;
942diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/;
943
944/**
945 * Reduce the number of edits by eliminating operationally trivial equalities.
946 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
947 */
948diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
949 var changes = false;
950 var equalities = []; // Stack of indices where equalities are found.
951 var equalitiesLength = 0; // Keeping our own length var is faster in JS.
952 /** @type {?string} */
953 var lastequality = null;
954 // Always equal to diffs[equalities[equalitiesLength - 1]][1]
955 var pointer = 0; // Index of current position.
956 // Is there an insertion operation before the last equality.
957 var pre_ins = false;
958 // Is there a deletion operation before the last equality.
959 var pre_del = false;
960 // Is there an insertion operation after the last equality.
961 var post_ins = false;
962 // Is there a deletion operation after the last equality.
963 var post_del = false;
964 while (pointer < diffs.length) {
965 if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.
966 if (diffs[pointer][1].length < this.Diff_EditCost &&
967 (post_ins || post_del)) {
968 // Candidate found.
969 equalities[equalitiesLength++] = pointer;
970 pre_ins = post_ins;
971 pre_del = post_del;
972 lastequality = diffs[pointer][1];
973 } else {
974 // Not a candidate, and can never become one.
975 equalitiesLength = 0;
976 lastequality = null;
977 }
978 post_ins = post_del = false;
979 } else { // An insertion or deletion.
980 if (diffs[pointer][0] == DIFF_DELETE) {
981 post_del = true;
982 } else {
983 post_ins = true;
984 }
985 /*
986 * Five types to be split:
987 * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>
988 * <ins>A</ins>X<ins>C</ins><del>D</del>
989 * <ins>A</ins><del>B</del>X<ins>C</ins>
990 * <ins>A</del>X<ins>C</ins><del>D</del>
991 * <ins>A</ins><del>B</del>X<del>C</del>
992 */
993 if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||
994 ((lastequality.length < this.Diff_EditCost / 2) &&
995 (pre_ins + pre_del + post_ins + post_del) == 3))) {
996 // Duplicate record.
997 diffs.splice(equalities[equalitiesLength - 1], 0,
998 [DIFF_DELETE, lastequality]);
999 // Change second copy to insert.
1000 diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
1001 equalitiesLength--; // Throw away the equality we just deleted;
1002 lastequality = null;
1003 if (pre_ins && pre_del) {
1004 // No changes made which could affect previous entry, keep going.
1005 post_ins = post_del = true;
1006 equalitiesLength = 0;
1007 } else {
1008 equalitiesLength--; // Throw away the previous equality.
1009 pointer = equalitiesLength > 0 ?
1010 equalities[equalitiesLength - 1] : -1;
1011 post_ins = post_del = false;
1012 }
1013 changes = true;
1014 }
1015 }
1016 pointer++;
1017 }
1018
1019 if (changes) {
1020 this.diff_cleanupMerge(diffs);
1021 }
1022};
1023
1024
1025/**
1026 * Reorder and merge like edit sections. Merge equalities.
1027 * Any edit section can move as long as it doesn't cross an equality.
1028 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1029 */
1030diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
1031 diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
1032 var pointer = 0;
1033 var count_delete = 0;
1034 var count_insert = 0;
1035 var text_delete = '';
1036 var text_insert = '';
1037 var commonlength;
1038 while (pointer < diffs.length) {
1039 switch (diffs[pointer][0]) {
1040 case DIFF_INSERT:
1041 count_insert++;
1042 text_insert += diffs[pointer][1];
1043 pointer++;
1044 break;
1045 case DIFF_DELETE:
1046 count_delete++;
1047 text_delete += diffs[pointer][1];
1048 pointer++;
1049 break;
1050 case DIFF_EQUAL:
1051 // Upon reaching an equality, check for prior redundancies.
1052 if (count_delete + count_insert > 1) {
1053 if (count_delete !== 0 && count_insert !== 0) {
1054 // Factor out any common prefixies.
1055 commonlength = this.diff_commonPrefix(text_insert, text_delete);
1056 if (commonlength !== 0) {
1057 if ((pointer - count_delete - count_insert) > 0 &&
1058 diffs[pointer - count_delete - count_insert - 1][0] ==
1059 DIFF_EQUAL) {
1060 diffs[pointer - count_delete - count_insert - 1][1] +=
1061 text_insert.substring(0, commonlength);
1062 } else {
1063 diffs.splice(0, 0, [DIFF_EQUAL,
1064 text_insert.substring(0, commonlength)]);
1065 pointer++;
1066 }
1067 text_insert = text_insert.substring(commonlength);
1068 text_delete = text_delete.substring(commonlength);
1069 }
1070 // Factor out any common suffixies.
1071 commonlength = this.diff_commonSuffix(text_insert, text_delete);
1072 if (commonlength !== 0) {
1073 diffs[pointer][1] = text_insert.substring(text_insert.length -
1074 commonlength) + diffs[pointer][1];
1075 text_insert = text_insert.substring(0, text_insert.length -
1076 commonlength);
1077 text_delete = text_delete.substring(0, text_delete.length -
1078 commonlength);
1079 }
1080 }
1081 // Delete the offending records and add the merged ones.
1082 if (count_delete === 0) {
1083 diffs.splice(pointer - count_insert,
1084 count_delete + count_insert, [DIFF_INSERT, text_insert]);
1085 } else if (count_insert === 0) {
1086 diffs.splice(pointer - count_delete,
1087 count_delete + count_insert, [DIFF_DELETE, text_delete]);
1088 } else {
1089 diffs.splice(pointer - count_delete - count_insert,
1090 count_delete + count_insert, [DIFF_DELETE, text_delete],
1091 [DIFF_INSERT, text_insert]);
1092 }
1093 pointer = pointer - count_delete - count_insert +
1094 (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
1095 } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
1096 // Merge this equality with the previous one.
1097 diffs[pointer - 1][1] += diffs[pointer][1];
1098 diffs.splice(pointer, 1);
1099 } else {
1100 pointer++;
1101 }
1102 count_insert = 0;
1103 count_delete = 0;
1104 text_delete = '';
1105 text_insert = '';
1106 break;
1107 }
1108 }
1109 if (diffs[diffs.length - 1][1] === '') {
1110 diffs.pop(); // Remove the dummy entry at the end.
1111 }
1112
1113 // Second pass: look for single edits surrounded on both sides by equalities
1114 // which can be shifted sideways to eliminate an equality.
1115 // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
1116 var changes = false;
1117 pointer = 1;
1118 // Intentionally ignore the first and last element (don't need checking).
1119 while (pointer < diffs.length - 1) {
1120 if (diffs[pointer - 1][0] == DIFF_EQUAL &&
1121 diffs[pointer + 1][0] == DIFF_EQUAL) {
1122 // This is a single edit surrounded by equalities.
1123 if (diffs[pointer][1].substring(diffs[pointer][1].length -
1124 diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
1125 // Shift the edit over the previous equality.
1126 diffs[pointer][1] = diffs[pointer - 1][1] +
1127 diffs[pointer][1].substring(0, diffs[pointer][1].length -
1128 diffs[pointer - 1][1].length);
1129 diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
1130 diffs.splice(pointer - 1, 1);
1131 changes = true;
1132 } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
1133 diffs[pointer + 1][1]) {
1134 // Shift the edit over the next equality.
1135 diffs[pointer - 1][1] += diffs[pointer + 1][1];
1136 diffs[pointer][1] =
1137 diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
1138 diffs[pointer + 1][1];
1139 diffs.splice(pointer + 1, 1);
1140 changes = true;
1141 }
1142 }
1143 pointer++;
1144 }
1145 // If shifts were made, the diff needs reordering and another shift sweep.
1146 if (changes) {
1147 this.diff_cleanupMerge(diffs);
1148 }
1149};
1150
1151
1152/**
1153 * loc is a location in text1, compute and return the equivalent location in
1154 * text2.
1155 * e.g. 'The cat' vs 'The big cat', 1->1, 5->8
1156 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1157 * @param {number} loc Location within text1.
1158 * @return {number} Location within text2.
1159 */
1160diff_match_patch.prototype.diff_xIndex = function(diffs, loc) {
1161 var chars1 = 0;
1162 var chars2 = 0;
1163 var last_chars1 = 0;
1164 var last_chars2 = 0;
1165 var x;
1166 for (x = 0; x < diffs.length; x++) {
1167 if (diffs[x][0] !== DIFF_INSERT) { // Equality or deletion.
1168 chars1 += diffs[x][1].length;
1169 }
1170 if (diffs[x][0] !== DIFF_DELETE) { // Equality or insertion.
1171 chars2 += diffs[x][1].length;
1172 }
1173 if (chars1 > loc) { // Overshot the location.
1174 break;
1175 }
1176 last_chars1 = chars1;
1177 last_chars2 = chars2;
1178 }
1179 // Was the location was deleted?
1180 if (diffs.length != x && diffs[x][0] === DIFF_DELETE) {
1181 return last_chars2;
1182 }
1183 // Add the remaining character length.
1184 return last_chars2 + (loc - last_chars1);
1185};
1186
1187
1188/**
1189 * Convert a diff array into a pretty HTML report.
1190 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1191 * @return {string} HTML representation.
1192 */
1193diff_match_patch.prototype.diff_prettyHtml = function(diffs) {
1194 var html = [];
1195 var pattern_amp = /&/g;
1196 var pattern_lt = /</g;
1197 var pattern_gt = />/g;
1198 var pattern_para = /\n/g;
1199 for (var x = 0; x < diffs.length; x++) {
1200 var op = diffs[x][0]; // Operation (insert, delete, equal)
1201 var data = diffs[x][1]; // Text of change.
1202 var text = data.replace(pattern_amp, '&amp;').replace(pattern_lt, '&lt;')
1203 .replace(pattern_gt, '&gt;').replace(pattern_para, '&para;<br>');
1204 switch (op) {
1205 case DIFF_INSERT:
1206 html[x] = '<ins style="background:#e6ffe6;">' + text + '</ins>';
1207 break;
1208 case DIFF_DELETE:
1209 html[x] = '<del style="background:#ffe6e6;">' + text + '</del>';
1210 break;
1211 case DIFF_EQUAL:
1212 html[x] = '<span>' + text + '</span>';
1213 break;
1214 }
1215 }
1216 return html.join('');
1217};
1218
1219
1220/**
1221 * Compute and return the source text (all equalities and deletions).
1222 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1223 * @return {string} Source text.
1224 */
1225diff_match_patch.prototype.diff_text1 = function(diffs) {
1226 var text = [];
1227 for (var x = 0; x < diffs.length; x++) {
1228 if (diffs[x][0] !== DIFF_INSERT) {
1229 text[x] = diffs[x][1];
1230 }
1231 }
1232 return text.join('');
1233};
1234
1235
1236/**
1237 * Compute and return the destination text (all equalities and insertions).
1238 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1239 * @return {string} Destination text.
1240 */
1241diff_match_patch.prototype.diff_text2 = function(diffs) {
1242 var text = [];
1243 for (var x = 0; x < diffs.length; x++) {
1244 if (diffs[x][0] !== DIFF_DELETE) {
1245 text[x] = diffs[x][1];
1246 }
1247 }
1248 return text.join('');
1249};
1250
1251
1252/**
1253 * Compute the Levenshtein distance; the number of inserted, deleted or
1254 * substituted characters.
1255 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1256 * @return {number} Number of changes.
1257 */
1258diff_match_patch.prototype.diff_levenshtein = function(diffs) {
1259 var levenshtein = 0;
1260 var insertions = 0;
1261 var deletions = 0;
1262 for (var x = 0; x < diffs.length; x++) {
1263 var op = diffs[x][0];
1264 var data = diffs[x][1];
1265 switch (op) {
1266 case DIFF_INSERT:
1267 insertions += data.length;
1268 break;
1269 case DIFF_DELETE:
1270 deletions += data.length;
1271 break;
1272 case DIFF_EQUAL:
1273 // A deletion and an insertion is one substitution.
1274 levenshtein += Math.max(insertions, deletions);
1275 insertions = 0;
1276 deletions = 0;
1277 break;
1278 }
1279 }
1280 levenshtein += Math.max(insertions, deletions);
1281 return levenshtein;
1282};
1283
1284
1285/**
1286 * Crush the diff into an encoded string which describes the operations
1287 * required to transform text1 into text2.
1288 * E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'.
1289 * Operations are tab-separated. Inserted text is escaped using %xx notation.
1290 * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1291 * @return {string} Delta text.
1292 */
1293diff_match_patch.prototype.diff_toDelta = function(diffs) {
1294 var text = [];
1295 for (var x = 0; x < diffs.length; x++) {
1296 switch (diffs[x][0]) {
1297 case DIFF_INSERT:
1298 text[x] = '+' + encodeURI(diffs[x][1]);
1299 break;
1300 case DIFF_DELETE:
1301 text[x] = '-' + diffs[x][1].length;
1302 break;
1303 case DIFF_EQUAL:
1304 text[x] = '=' + diffs[x][1].length;
1305 break;
1306 }
1307 }
1308 return text.join('\t').replace(/%20/g, ' ');
1309};
1310
1311
1312/**
1313 * Given the original text1, and an encoded string which describes the
1314 * operations required to transform text1 into text2, compute the full diff.
1315 * @param {string} text1 Source string for the diff.
1316 * @param {string} delta Delta text.
1317 * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
1318 * @throws {!Error} If invalid input.
1319 */
1320diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
1321 var diffs = [];
1322 var diffsLength = 0; // Keeping our own length var is faster in JS.
1323 var pointer = 0; // Cursor in text1
1324 var tokens = delta.split(/\t/g);
1325 for (var x = 0; x < tokens.length; x++) {
1326 // Each token begins with a one character parameter which specifies the
1327 // operation of this token (delete, insert, equality).
1328 var param = tokens[x].substring(1);
1329 switch (tokens[x].charAt(0)) {
1330 case '+':
1331 try {
1332 diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)];
1333 } catch (ex) {
1334 // Malformed URI sequence.
1335 throw new Error('Illegal escape in diff_fromDelta: ' + param);
1336 }
1337 break;
1338 case '-':
1339 // Fall through.
1340 case '=':
1341 var n = parseInt(param, 10);
1342 if (isNaN(n) || n < 0) {
1343 throw new Error('Invalid number in diff_fromDelta: ' + param);
1344 }
1345 var text = text1.substring(pointer, pointer += n);
1346 if (tokens[x].charAt(0) == '=') {
1347 diffs[diffsLength++] = [DIFF_EQUAL, text];
1348 } else {
1349 diffs[diffsLength++] = [DIFF_DELETE, text];
1350 }
1351 break;
1352 default:
1353 // Blank tokens are ok (from a trailing \t).
1354 // Anything else is an error.
1355 if (tokens[x]) {
1356 throw new Error('Invalid diff operation in diff_fromDelta: ' +
1357 tokens[x]);
1358 }
1359 }
1360 }
1361 if (pointer != text1.length) {
1362 throw new Error('Delta length (' + pointer +
1363 ') does not equal source text length (' + text1.length + ').');
1364 }
1365 return diffs;
1366};
1367
1368
1369// MATCH FUNCTIONS
1370
1371
1372/**
1373 * Locate the best instance of 'pattern' in 'text' near 'loc'.
1374 * @param {string} text The text to search.
1375 * @param {string} pattern The pattern to search for.
1376 * @param {number} loc The location to search around.
1377 * @return {number} Best match index or -1.
1378 */
1379diff_match_patch.prototype.match_main = function(text, pattern, loc) {
1380 // Check for null inputs.
1381 if (text == null || pattern == null || loc == null) {
1382 throw new Error('Null input. (match_main)');
1383 }
1384
1385 loc = Math.max(0, Math.min(loc, text.length));
1386 if (text == pattern) {
1387 // Shortcut (potentially not guaranteed by the algorithm)
1388 return 0;
1389 } else if (!text.length) {
1390 // Nothing to match.
1391 return -1;
1392 } else if (text.substring(loc, loc + pattern.length) == pattern) {
1393 // Perfect match at the perfect spot! (Includes case of null pattern)
1394 return loc;
1395 } else {
1396 // Do a fuzzy compare.
1397 return this.match_bitap_(text, pattern, loc);
1398 }
1399};
1400
1401
1402/**
1403 * Locate the best instance of 'pattern' in 'text' near 'loc' using the
1404 * Bitap algorithm.
1405 * @param {string} text The text to search.
1406 * @param {string} pattern The pattern to search for.
1407 * @param {number} loc The location to search around.
1408 * @return {number} Best match index or -1.
1409 * @private
1410 */
1411diff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {
1412 if (pattern.length > this.Match_MaxBits) {
1413 throw new Error('Pattern too long for this browser.');
1414 }
1415
1416 // Initialise the alphabet.
1417 var s = this.match_alphabet_(pattern);
1418
1419 var dmp = this; // 'this' becomes 'window' in a closure.
1420
1421 /**
1422 * Compute and return the score for a match with e errors and x location.
1423 * Accesses loc and pattern through being a closure.
1424 * @param {number} e Number of errors in match.
1425 * @param {number} x Location of match.
1426 * @return {number} Overall score for match (0.0 = good, 1.0 = bad).
1427 * @private
1428 */
1429 function match_bitapScore_(e, x) {
1430 var accuracy = e / pattern.length;
1431 var proximity = Math.abs(loc - x);
1432 if (!dmp.Match_Distance) {
1433 // Dodge divide by zero error.
1434 return proximity ? 1.0 : accuracy;
1435 }
1436 return accuracy + (proximity / dmp.Match_Distance);
1437 }
1438
1439 // Highest score beyond which we give up.
1440 var score_threshold = this.Match_Threshold;
1441 // Is there a nearby exact match? (speedup)
1442 var best_loc = text.indexOf(pattern, loc);
1443 if (best_loc != -1) {
1444 score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
1445 // What about in the other direction? (speedup)
1446 best_loc = text.lastIndexOf(pattern, loc + pattern.length);
1447 if (best_loc != -1) {
1448 score_threshold =
1449 Math.min(match_bitapScore_(0, best_loc), score_threshold);
1450 }
1451 }
1452
1453 // Initialise the bit arrays.
1454 var matchmask = 1 << (pattern.length - 1);
1455 best_loc = -1;
1456
1457 var bin_min, bin_mid;
1458 var bin_max = pattern.length + text.length;
1459 var last_rd;
1460 for (var d = 0; d < pattern.length; d++) {
1461 // Scan for the best match; each iteration allows for one more error.
1462 // Run a binary search to determine how far from 'loc' we can stray at this
1463 // error level.
1464 bin_min = 0;
1465 bin_mid = bin_max;
1466 while (bin_min < bin_mid) {
1467 if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {
1468 bin_min = bin_mid;
1469 } else {
1470 bin_max = bin_mid;
1471 }
1472 bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
1473 }
1474 // Use the result from this iteration as the maximum for the next.
1475 bin_max = bin_mid;
1476 var start = Math.max(1, loc - bin_mid + 1);
1477 var finish = Math.min(loc + bin_mid, text.length) + pattern.length;
1478
1479 var rd = Array(finish + 2);
1480 rd[finish + 1] = (1 << d) - 1;
1481 for (var j = finish; j >= start; j--) {
1482 // The alphabet (s) is a sparse hash, so the following line generates
1483 // warnings.
1484 var charMatch = s[text.charAt(j - 1)];
1485 if (d === 0) { // First pass: exact match.
1486 rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;
1487 } else { // Subsequent passes: fuzzy match.
1488 rd[j] = (((rd[j + 1] << 1) | 1) & charMatch) |
1489 (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |
1490 last_rd[j + 1];
1491 }
1492 if (rd[j] & matchmask) {
1493 var score = match_bitapScore_(d, j - 1);
1494 // This match will almost certainly be better than any existing match.
1495 // But check anyway.
1496 if (score <= score_threshold) {
1497 // Told you so.
1498 score_threshold = score;
1499 best_loc = j - 1;
1500 if (best_loc > loc) {
1501 // When passing loc, don't exceed our current distance from loc.
1502 start = Math.max(1, 2 * loc - best_loc);
1503 } else {
1504 // Already passed loc, downhill from here on in.
1505 break;
1506 }
1507 }
1508 }
1509 }
1510 // No hope for a (better) match at greater error levels.
1511 if (match_bitapScore_(d + 1, loc) > score_threshold) {
1512 break;
1513 }
1514 last_rd = rd;
1515 }
1516 return best_loc;
1517};
1518
1519
1520/**
1521 * Initialise the alphabet for the Bitap algorithm.
1522 * @param {string} pattern The text to encode.
1523 * @return {!Object} Hash of character locations.
1524 * @private
1525 */
1526diff_match_patch.prototype.match_alphabet_ = function(pattern) {
1527 var s = {};
1528 for (var i = 0; i < pattern.length; i++) {
1529 s[pattern.charAt(i)] = 0;
1530 }
1531 for (var i = 0; i < pattern.length; i++) {
1532 s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);
1533 }
1534 return s;
1535};
1536
1537
1538// PATCH FUNCTIONS
1539
1540
1541/**
1542 * Increase the context until it is unique,
1543 * but don't let the pattern expand beyond Match_MaxBits.
1544 * @param {!diff_match_patch.patch_obj} patch The patch to grow.
1545 * @param {string} text Source text.
1546 * @private
1547 */
1548diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
1549 if (text.length == 0) {
1550 return;
1551 }
1552 var pattern = text.substring(patch.start2, patch.start2 + patch.length1);
1553 var padding = 0;
1554
1555 // Look for the first and last matches of pattern in text. If two different
1556 // matches are found, increase the pattern length.
1557 while (text.indexOf(pattern) != text.lastIndexOf(pattern) &&
1558 pattern.length < this.Match_MaxBits - this.Patch_Margin -
1559 this.Patch_Margin) {
1560 padding += this.Patch_Margin;
1561 pattern = text.substring(patch.start2 - padding,
1562 patch.start2 + patch.length1 + padding);
1563 }
1564 // Add one chunk for good luck.
1565 padding += this.Patch_Margin;
1566
1567 // Add the prefix.
1568 var prefix = text.substring(patch.start2 - padding, patch.start2);
1569 if (prefix) {
1570 patch.diffs.unshift([DIFF_EQUAL, prefix]);
1571 }
1572 // Add the suffix.
1573 var suffix = text.substring(patch.start2 + patch.length1,
1574 patch.start2 + patch.length1 + padding);
1575 if (suffix) {
1576 patch.diffs.push([DIFF_EQUAL, suffix]);
1577 }
1578
1579 // Roll back the start points.
1580 patch.start1 -= prefix.length;
1581 patch.start2 -= prefix.length;
1582 // Extend the lengths.
1583 patch.length1 += prefix.length + suffix.length;
1584 patch.length2 += prefix.length + suffix.length;
1585};
1586
1587
1588/**
1589 * Compute a list of patches to turn text1 into text2.
1590 * Use diffs if provided, otherwise compute it ourselves.
1591 * There are four ways to call this function, depending on what data is
1592 * available to the caller:
1593 * Method 1:
1594 * a = text1, b = text2
1595 * Method 2:
1596 * a = diffs
1597 * Method 3 (optimal):
1598 * a = text1, b = diffs
1599 * Method 4 (deprecated, use method 3):
1600 * a = text1, b = text2, c = diffs
1601 *
1602 * @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or
1603 * Array of diff tuples for text1 to text2 (method 2).
1604 * @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or
1605 * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).
1606 * @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples
1607 * for text1 to text2 (method 4) or undefined (methods 1,2,3).
1608 * @return {!Array.<!diff_match_patch.patch_obj>} Array of Patch objects.
1609 */
1610diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {
1611 var text1, diffs;
1612 if (typeof a == 'string' && typeof opt_b == 'string' &&
1613 typeof opt_c == 'undefined') {
1614 // Method 1: text1, text2
1615 // Compute diffs from text1 and text2.
1616 text1 = /** @type {string} */(a);
1617 diffs = this.diff_main(text1, /** @type {string} */(opt_b), true);
1618 if (diffs.length > 2) {
1619 this.diff_cleanupSemantic(diffs);
1620 this.diff_cleanupEfficiency(diffs);
1621 }
1622 } else if (a && typeof a == 'object' && typeof opt_b == 'undefined' &&
1623 typeof opt_c == 'undefined') {
1624 // Method 2: diffs
1625 // Compute text1 from diffs.
1626 diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(a);
1627 text1 = this.diff_text1(diffs);
1628 } else if (typeof a == 'string' && opt_b && typeof opt_b == 'object' &&
1629 typeof opt_c == 'undefined') {
1630 // Method 3: text1, diffs
1631 text1 = /** @type {string} */(a);
1632 diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_b);
1633 } else if (typeof a == 'string' && typeof opt_b == 'string' &&
1634 opt_c && typeof opt_c == 'object') {
1635 // Method 4: text1, text2, diffs
1636 // text2 is not used.
1637 text1 = /** @type {string} */(a);
1638 diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_c);
1639 } else {
1640 throw new Error('Unknown call format to patch_make.');
1641 }
1642
1643 if (diffs.length === 0) {
1644 return []; // Get rid of the null case.
1645 }
1646 var patches = [];
1647 var patch = new diff_match_patch.patch_obj();
1648 var patchDiffLength = 0; // Keeping our own length var is faster in JS.
1649 var char_count1 = 0; // Number of characters into the text1 string.
1650 var char_count2 = 0; // Number of characters into the text2 string.
1651 // Start with text1 (prepatch_text) and apply the diffs until we arrive at
1652 // text2 (postpatch_text). We recreate the patches one by one to determine
1653 // context info.
1654 var prepatch_text = text1;
1655 var postpatch_text = text1;
1656 for (var x = 0; x < diffs.length; x++) {
1657 var diff_type = diffs[x][0];
1658 var diff_text = diffs[x][1];
1659
1660 if (!patchDiffLength && diff_type !== DIFF_EQUAL) {
1661 // A new patch starts here.
1662 patch.start1 = char_count1;
1663 patch.start2 = char_count2;
1664 }
1665
1666 switch (diff_type) {
1667 case DIFF_INSERT:
1668 patch.diffs[patchDiffLength++] = diffs[x];
1669 patch.length2 += diff_text.length;
1670 postpatch_text = postpatch_text.substring(0, char_count2) + diff_text +
1671 postpatch_text.substring(char_count2);
1672 break;
1673 case DIFF_DELETE:
1674 patch.length1 += diff_text.length;
1675 patch.diffs[patchDiffLength++] = diffs[x];
1676 postpatch_text = postpatch_text.substring(0, char_count2) +
1677 postpatch_text.substring(char_count2 +
1678 diff_text.length);
1679 break;
1680 case DIFF_EQUAL:
1681 if (diff_text.length <= 2 * this.Patch_Margin &&
1682 patchDiffLength && diffs.length != x + 1) {
1683 // Small equality inside a patch.
1684 patch.diffs[patchDiffLength++] = diffs[x];
1685 patch.length1 += diff_text.length;
1686 patch.length2 += diff_text.length;
1687 } else if (diff_text.length >= 2 * this.Patch_Margin) {
1688 // Time for a new patch.
1689 if (patchDiffLength) {
1690 this.patch_addContext_(patch, prepatch_text);
1691 patches.push(patch);
1692 patch = new diff_match_patch.patch_obj();
1693 patchDiffLength = 0;
1694 // Unlike Unidiff, our patch lists have a rolling context.
1695 // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff
1696 // Update prepatch text & pos to reflect the application of the
1697 // just completed patch.
1698 prepatch_text = postpatch_text;
1699 char_count1 = char_count2;
1700 }
1701 }
1702 break;
1703 }
1704
1705 // Update the current character count.
1706 if (diff_type !== DIFF_INSERT) {
1707 char_count1 += diff_text.length;
1708 }
1709 if (diff_type !== DIFF_DELETE) {
1710 char_count2 += diff_text.length;
1711 }
1712 }
1713 // Pick up the leftover patch if not empty.
1714 if (patchDiffLength) {
1715 this.patch_addContext_(patch, prepatch_text);
1716 patches.push(patch);
1717 }
1718
1719 return patches;
1720};
1721
1722
1723/**
1724 * Given an array of patches, return another array that is identical.
1725 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
1726 * @return {!Array.<!diff_match_patch.patch_obj>} Array of Patch objects.
1727 */
1728diff_match_patch.prototype.patch_deepCopy = function(patches) {
1729 // Making deep copies is hard in JavaScript.
1730 var patchesCopy = [];
1731 for (var x = 0; x < patches.length; x++) {
1732 var patch = patches[x];
1733 var patchCopy = new diff_match_patch.patch_obj();
1734 patchCopy.diffs = [];
1735 for (var y = 0; y < patch.diffs.length; y++) {
1736 patchCopy.diffs[y] = patch.diffs[y].slice();
1737 }
1738 patchCopy.start1 = patch.start1;
1739 patchCopy.start2 = patch.start2;
1740 patchCopy.length1 = patch.length1;
1741 patchCopy.length2 = patch.length2;
1742 patchesCopy[x] = patchCopy;
1743 }
1744 return patchesCopy;
1745};
1746
1747
1748/**
1749 * Merge a set of patches onto the text. Return a patched text, as well
1750 * as a list of true/false values indicating which patches were applied.
1751 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
1752 * @param {string} text Old text.
1753 * @return {!Array.<string|!Array.<boolean>>} Two element Array, containing the
1754 * new text and an array of boolean values.
1755 */
1756diff_match_patch.prototype.patch_apply = function(patches, text) {
1757 if (patches.length == 0) {
1758 return [text, []];
1759 }
1760
1761 // Deep copy the patches so that no changes are made to originals.
1762 patches = this.patch_deepCopy(patches);
1763
1764 var nullPadding = this.patch_addPadding(patches);
1765 text = nullPadding + text + nullPadding;
1766
1767 this.patch_splitMax(patches);
1768 // delta keeps track of the offset between the expected and actual location
1769 // of the previous patch. If there are patches expected at positions 10 and
1770 // 20, but the first patch was found at 12, delta is 2 and the second patch
1771 // has an effective expected position of 22.
1772 var delta = 0;
1773 var results = [];
1774 for (var x = 0; x < patches.length; x++) {
1775 var expected_loc = patches[x].start2 + delta;
1776 var text1 = this.diff_text1(patches[x].diffs);
1777 var start_loc;
1778 var end_loc = -1;
1779 if (text1.length > this.Match_MaxBits) {
1780 // patch_splitMax will only provide an oversized pattern in the case of
1781 // a monster delete.
1782 start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits),
1783 expected_loc);
1784 if (start_loc != -1) {
1785 end_loc = this.match_main(text,
1786 text1.substring(text1.length - this.Match_MaxBits),
1787 expected_loc + text1.length - this.Match_MaxBits);
1788 if (end_loc == -1 || start_loc >= end_loc) {
1789 // Can't find valid trailing context. Drop this patch.
1790 start_loc = -1;
1791 }
1792 }
1793 } else {
1794 start_loc = this.match_main(text, text1, expected_loc);
1795 }
1796 if (start_loc == -1) {
1797 // No match found. :(
1798 results[x] = false;
1799 // Subtract the delta for this failed patch from subsequent patches.
1800 delta -= patches[x].length2 - patches[x].length1;
1801 } else {
1802 // Found a match. :)
1803 results[x] = true;
1804 delta = start_loc - expected_loc;
1805 var text2;
1806 if (end_loc == -1) {
1807 text2 = text.substring(start_loc, start_loc + text1.length);
1808 } else {
1809 text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);
1810 }
1811 if (text1 == text2) {
1812 // Perfect match, just shove the replacement text in.
1813 text = text.substring(0, start_loc) +
1814 this.diff_text2(patches[x].diffs) +
1815 text.substring(start_loc + text1.length);
1816 } else {
1817 // Imperfect match. Run a diff to get a framework of equivalent
1818 // indices.
1819 var diffs = this.diff_main(text1, text2, false);
1820 if (text1.length > this.Match_MaxBits &&
1821 this.diff_levenshtein(diffs) / text1.length >
1822 this.Patch_DeleteThreshold) {
1823 // The end points match, but the content is unacceptably bad.
1824 results[x] = false;
1825 } else {
1826 this.diff_cleanupSemanticLossless(diffs);
1827 var index1 = 0;
1828 var index2;
1829 for (var y = 0; y < patches[x].diffs.length; y++) {
1830 var mod = patches[x].diffs[y];
1831 if (mod[0] !== DIFF_EQUAL) {
1832 index2 = this.diff_xIndex(diffs, index1);
1833 }
1834 if (mod[0] === DIFF_INSERT) { // Insertion
1835 text = text.substring(0, start_loc + index2) + mod[1] +
1836 text.substring(start_loc + index2);
1837 } else if (mod[0] === DIFF_DELETE) { // Deletion
1838 text = text.substring(0, start_loc + index2) +
1839 text.substring(start_loc + this.diff_xIndex(diffs,
1840 index1 + mod[1].length));
1841 }
1842 if (mod[0] !== DIFF_DELETE) {
1843 index1 += mod[1].length;
1844 }
1845 }
1846 }
1847 }
1848 }
1849 }
1850 // Strip the padding off.
1851 text = text.substring(nullPadding.length, text.length - nullPadding.length);
1852 return [text, results];
1853};
1854
1855
1856/**
1857 * Add some padding on text start and end so that edges can match something.
1858 * Intended to be called only from within patch_apply.
1859 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
1860 * @return {string} The padding string added to each side.
1861 */
1862diff_match_patch.prototype.patch_addPadding = function(patches) {
1863 var paddingLength = this.Patch_Margin;
1864 var nullPadding = '';
1865 for (var x = 1; x <= paddingLength; x++) {
1866 nullPadding += String.fromCharCode(x);
1867 }
1868
1869 // Bump all the patches forward.
1870 for (var x = 0; x < patches.length; x++) {
1871 patches[x].start1 += paddingLength;
1872 patches[x].start2 += paddingLength;
1873 }
1874
1875 // Add some padding on start of first diff.
1876 var patch = patches[0];
1877 var diffs = patch.diffs;
1878 if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {
1879 // Add nullPadding equality.
1880 diffs.unshift([DIFF_EQUAL, nullPadding]);
1881 patch.start1 -= paddingLength; // Should be 0.
1882 patch.start2 -= paddingLength; // Should be 0.
1883 patch.length1 += paddingLength;
1884 patch.length2 += paddingLength;
1885 } else if (paddingLength > diffs[0][1].length) {
1886 // Grow first equality.
1887 var extraLength = paddingLength - diffs[0][1].length;
1888 diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];
1889 patch.start1 -= extraLength;
1890 patch.start2 -= extraLength;
1891 patch.length1 += extraLength;
1892 patch.length2 += extraLength;
1893 }
1894
1895 // Add some padding on end of last diff.
1896 patch = patches[patches.length - 1];
1897 diffs = patch.diffs;
1898 if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {
1899 // Add nullPadding equality.
1900 diffs.push([DIFF_EQUAL, nullPadding]);
1901 patch.length1 += paddingLength;
1902 patch.length2 += paddingLength;
1903 } else if (paddingLength > diffs[diffs.length - 1][1].length) {
1904 // Grow last equality.
1905 var extraLength = paddingLength - diffs[diffs.length - 1][1].length;
1906 diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);
1907 patch.length1 += extraLength;
1908 patch.length2 += extraLength;
1909 }
1910
1911 return nullPadding;
1912};
1913
1914
1915/**
1916 * Look through the patches and break up any which are longer than the maximum
1917 * limit of the match algorithm.
1918 * Intended to be called only from within patch_apply.
1919 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
1920 */
1921diff_match_patch.prototype.patch_splitMax = function(patches) {
1922 var patch_size = this.Match_MaxBits;
1923 for (var x = 0; x < patches.length; x++) {
1924 if (patches[x].length1 <= patch_size) {
1925 continue;
1926 }
1927 var bigpatch = patches[x];
1928 // Remove the big old patch.
1929 patches.splice(x--, 1);
1930 var start1 = bigpatch.start1;
1931 var start2 = bigpatch.start2;
1932 var precontext = '';
1933 while (bigpatch.diffs.length !== 0) {
1934 // Create one of several smaller patches.
1935 var patch = new diff_match_patch.patch_obj();
1936 var empty = true;
1937 patch.start1 = start1 - precontext.length;
1938 patch.start2 = start2 - precontext.length;
1939 if (precontext !== '') {
1940 patch.length1 = patch.length2 = precontext.length;
1941 patch.diffs.push([DIFF_EQUAL, precontext]);
1942 }
1943 while (bigpatch.diffs.length !== 0 &&
1944 patch.length1 < patch_size - this.Patch_Margin) {
1945 var diff_type = bigpatch.diffs[0][0];
1946 var diff_text = bigpatch.diffs[0][1];
1947 if (diff_type === DIFF_INSERT) {
1948 // Insertions are harmless.
1949 patch.length2 += diff_text.length;
1950 start2 += diff_text.length;
1951 patch.diffs.push(bigpatch.diffs.shift());
1952 empty = false;
1953 } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 &&
1954 patch.diffs[0][0] == DIFF_EQUAL &&
1955 diff_text.length > 2 * patch_size) {
1956 // This is a large deletion. Let it pass in one chunk.
1957 patch.length1 += diff_text.length;
1958 start1 += diff_text.length;
1959 empty = false;
1960 patch.diffs.push([diff_type, diff_text]);
1961 bigpatch.diffs.shift();
1962 } else {
1963 // Deletion or equality. Only take as much as we can stomach.
1964 diff_text = diff_text.substring(0,
1965 patch_size - patch.length1 - this.Patch_Margin);
1966 patch.length1 += diff_text.length;
1967 start1 += diff_text.length;
1968 if (diff_type === DIFF_EQUAL) {
1969 patch.length2 += diff_text.length;
1970 start2 += diff_text.length;
1971 } else {
1972 empty = false;
1973 }
1974 patch.diffs.push([diff_type, diff_text]);
1975 if (diff_text == bigpatch.diffs[0][1]) {
1976 bigpatch.diffs.shift();
1977 } else {
1978 bigpatch.diffs[0][1] =
1979 bigpatch.diffs[0][1].substring(diff_text.length);
1980 }
1981 }
1982 }
1983 // Compute the head context for the next patch.
1984 precontext = this.diff_text2(patch.diffs);
1985 precontext =
1986 precontext.substring(precontext.length - this.Patch_Margin);
1987 // Append the end context for this patch.
1988 var postcontext = this.diff_text1(bigpatch.diffs)
1989 .substring(0, this.Patch_Margin);
1990 if (postcontext !== '') {
1991 patch.length1 += postcontext.length;
1992 patch.length2 += postcontext.length;
1993 if (patch.diffs.length !== 0 &&
1994 patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) {
1995 patch.diffs[patch.diffs.length - 1][1] += postcontext;
1996 } else {
1997 patch.diffs.push([DIFF_EQUAL, postcontext]);
1998 }
1999 }
2000 if (!empty) {
2001 patches.splice(++x, 0, patch);
2002 }
2003 }
2004 }
2005};
2006
2007
2008/**
2009 * Take a list of patches and return a textual representation.
2010 * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
2011 * @return {string} Text representation of patches.
2012 */
2013diff_match_patch.prototype.patch_toText = function(patches) {
2014 var text = [];
2015 for (var x = 0; x < patches.length; x++) {
2016 text[x] = patches[x];
2017 }
2018 return text.join('');
2019};
2020
2021
2022/**
2023 * Parse a textual representation of patches and return a list of Patch objects.
2024 * @param {string} textline Text representation of patches.
2025 * @return {!Array.<!diff_match_patch.patch_obj>} Array of Patch objects.
2026 * @throws {!Error} If invalid input.
2027 */
2028diff_match_patch.prototype.patch_fromText = function(textline) {
2029 var patches = [];
2030 if (!textline) {
2031 return patches;
2032 }
2033 var text = textline.split('\n');
2034 var textPointer = 0;
2035 var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
2036 while (textPointer < text.length) {
2037 var m = text[textPointer].match(patchHeader);
2038 if (!m) {
2039 throw new Error('Invalid patch string: ' + text[textPointer]);
2040 }
2041 var patch = new diff_match_patch.patch_obj();
2042 patches.push(patch);
2043 patch.start1 = parseInt(m[1], 10);
2044 if (m[2] === '') {
2045 patch.start1--;
2046 patch.length1 = 1;
2047 } else if (m[2] == '0') {
2048 patch.length1 = 0;
2049 } else {
2050 patch.start1--;
2051 patch.length1 = parseInt(m[2], 10);
2052 }
2053
2054 patch.start2 = parseInt(m[3], 10);
2055 if (m[4] === '') {
2056 patch.start2--;
2057 patch.length2 = 1;
2058 } else if (m[4] == '0') {
2059 patch.length2 = 0;
2060 } else {
2061 patch.start2--;
2062 patch.length2 = parseInt(m[4], 10);
2063 }
2064 textPointer++;
2065
2066 while (textPointer < text.length) {
2067 var sign = text[textPointer].charAt(0);
2068 try {
2069 var line = decodeURI(text[textPointer].substring(1));
2070 } catch (ex) {
2071 // Malformed URI sequence.
2072 throw new Error('Illegal escape in patch_fromText: ' + line);
2073 }
2074 if (sign == '-') {
2075 // Deletion.
2076 patch.diffs.push([DIFF_DELETE, line]);
2077 } else if (sign == '+') {
2078 // Insertion.
2079 patch.diffs.push([DIFF_INSERT, line]);
2080 } else if (sign == ' ') {
2081 // Minor equality.
2082 patch.diffs.push([DIFF_EQUAL, line]);
2083 } else if (sign == '@') {
2084 // Start of next patch.
2085 break;
2086 } else if (sign === '') {
2087 // Blank line? Whatever.
2088 } else {
2089 // WTF?
2090 throw new Error('Invalid patch mode "' + sign + '" in: ' + line);
2091 }
2092 textPointer++;
2093 }
2094 }
2095 return patches;
2096};
2097
2098
2099/**
2100 * Class representing one patch operation.
2101 * @constructor
2102 */
2103diff_match_patch.patch_obj = function() {
2104 /** @type {!Array.<!diff_match_patch.Diff>} */
2105 this.diffs = [];
2106 /** @type {?number} */
2107 this.start1 = null;
2108 /** @type {?number} */
2109 this.start2 = null;
2110 /** @type {number} */
2111 this.length1 = 0;
2112 /** @type {number} */
2113 this.length2 = 0;
2114};
2115
2116
2117/**
2118 * Emmulate GNU diff's format.
2119 * Header: @@ -382,8 +481,9 @@
2120 * Indicies are printed as 1-based, not 0-based.
2121 * @return {string} The GNU diff string.
2122 */
2123diff_match_patch.patch_obj.prototype.toString = function() {
2124 var coords1, coords2;
2125 if (this.length1 === 0) {
2126 coords1 = this.start1 + ',0';
2127 } else if (this.length1 == 1) {
2128 coords1 = this.start1 + 1;
2129 } else {
2130 coords1 = (this.start1 + 1) + ',' + this.length1;
2131 }
2132 if (this.length2 === 0) {
2133 coords2 = this.start2 + ',0';
2134 } else if (this.length2 == 1) {
2135 coords2 = this.start2 + 1;
2136 } else {
2137 coords2 = (this.start2 + 1) + ',' + this.length2;
2138 }
2139 var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\n'];
2140 var op;
2141 // Escape the body of the patch with %xx notation.
2142 for (var x = 0; x < this.diffs.length; x++) {
2143 switch (this.diffs[x][0]) {
2144 case DIFF_INSERT:
2145 op = '+';
2146 break;
2147 case DIFF_DELETE:
2148 op = '-';
2149 break;
2150 case DIFF_EQUAL:
2151 op = ' ';
2152 break;
2153 }
2154 text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\n';
2155 }
2156 return text.join('').replace(/%20/g, ' ');
2157};
2158
2159
2160// The following export code was added by @ForbesLindesay
2161module.exports = diff_match_patch;
2162module.exports['diff_match_patch'] = diff_match_patch;
2163module.exports['DIFF_DELETE'] = DIFF_DELETE;
2164module.exports['DIFF_INSERT'] = DIFF_INSERT;
2165module.exports['DIFF_EQUAL'] = DIFF_EQUAL;
2166});
2167
2168var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
2169 return typeof obj;
2170} : function (obj) {
2171 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2172};
2173
2174var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
2175 return typeof obj === 'undefined' ? 'undefined' : _typeof(obj);
2176} : function (obj) {
2177 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof(obj);
2178};
2179
2180var classCallCheck$1 = function classCallCheck$$1(instance, Constructor) {
2181 if (!(instance instanceof Constructor)) {
2182 throw new TypeError("Cannot call a class as a function");
2183 }
2184};
2185
2186var createClass$1 = function () {
2187 function defineProperties(target, props) {
2188 for (var i = 0; i < props.length; i++) {
2189 var descriptor = props[i];
2190 descriptor.enumerable = descriptor.enumerable || false;
2191 descriptor.configurable = true;
2192 if ("value" in descriptor) descriptor.writable = true;
2193 Object.defineProperty(target, descriptor.key, descriptor);
2194 }
2195 }
2196
2197 return function (Constructor, protoProps, staticProps) {
2198 if (protoProps) defineProperties(Constructor.prototype, protoProps);
2199 if (staticProps) defineProperties(Constructor, staticProps);
2200 return Constructor;
2201 };
2202}();
2203
2204var get$1 = function get$$1(object, property, receiver) {
2205 if (object === null) object = Function.prototype;
2206 var desc = Object.getOwnPropertyDescriptor(object, property);
2207
2208 if (desc === undefined) {
2209 var parent = Object.getPrototypeOf(object);
2210
2211 if (parent === null) {
2212 return undefined;
2213 } else {
2214 return get$$1(parent, property, receiver);
2215 }
2216 } else if ("value" in desc) {
2217 return desc.value;
2218 } else {
2219 var getter = desc.get;
2220
2221 if (getter === undefined) {
2222 return undefined;
2223 }
2224
2225 return getter.call(receiver);
2226 }
2227};
2228
2229var inherits$1 = function inherits$$1(subClass, superClass) {
2230 if (typeof superClass !== "function" && superClass !== null) {
2231 throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
2232 }
2233
2234 subClass.prototype = Object.create(superClass && superClass.prototype, {
2235 constructor: {
2236 value: subClass,
2237 enumerable: false,
2238 writable: true,
2239 configurable: true
2240 }
2241 });
2242 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2243};
2244
2245var possibleConstructorReturn$1 = function possibleConstructorReturn$$1(self, call) {
2246 if (!self) {
2247 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2248 }
2249
2250 return call && ((typeof call === 'undefined' ? 'undefined' : _typeof(call)) === "object" || typeof call === "function") ? call : self;
2251};
2252
2253var slicedToArray$1 = function () {
2254 function sliceIterator(arr, i) {
2255 var _arr = [];
2256 var _n = true;
2257 var _d = false;
2258 var _e = undefined;
2259
2260 try {
2261 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
2262 _arr.push(_s.value);
2263
2264 if (i && _arr.length === i) break;
2265 }
2266 } catch (err) {
2267 _d = true;
2268 _e = err;
2269 } finally {
2270 try {
2271 if (!_n && _i["return"]) _i["return"]();
2272 } finally {
2273 if (_d) throw _e;
2274 }
2275 }
2276
2277 return _arr;
2278 }
2279
2280 return function (arr, i) {
2281 if (Array.isArray(arr)) {
2282 return arr;
2283 } else if (Symbol.iterator in Object(arr)) {
2284 return sliceIterator(arr, i);
2285 } else {
2286 throw new TypeError("Invalid attempt to destructure non-iterable instance");
2287 }
2288 };
2289}();
2290
2291var cov_z93lwrnu3 = function () {
2292 var path = '/Users/benja/proj/jsondiffpatch/src/processor.js',
2293 hash = '111c186e30b3622bcb132abb50bff6e1e123593a',
2294 global = new Function('return this')(),
2295 gcv = '__coverage__',
2296 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/processor.js', statementMap: { '0': { start: { line: 1, column: 16 }, end: { line: 71, column: 3 } }, '1': { start: { line: 3, column: 4 }, end: { line: 3, column: 49 } }, '2': { start: { line: 5, column: 4 }, end: { line: 5, column: 37 } }, '3': { start: { line: 6, column: 4 }, end: { line: 6, column: 20 } }, '4': { start: { line: 9, column: 2 }, end: { line: 69, column: 6 } }, '5': { start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }, '6': { start: { line: 13, column: 8 }, end: { line: 13, column: 36 } }, '7': { start: { line: 15, column: 6 }, end: { line: 15, column: 30 } }, '8': { start: { line: 20, column: 17 }, end: { line: 20, column: 24 } }, '9': { start: { line: 21, column: 6 }, end: { line: 27, column: 7 } }, '10': { start: { line: 22, column: 8 }, end: { line: 26, column: 9 } }, '11': { start: { line: 23, column: 10 }, end: { line: 23, column: 34 } }, '12': { start: { line: 25, column: 10 }, end: { line: 25, column: 34 } }, '13': { start: { line: 28, column: 6 }, end: { line: 34, column: 7 } }, '14': { start: { line: 29, column: 8 }, end: { line: 29, column: 20 } }, '15': { start: { line: 30, column: 8 }, end: { line: 32, column: 9 } }, '16': { start: { line: 31, column: 10 }, end: { line: 31, column: 22 } }, '17': { start: { line: 33, column: 8 }, end: { line: 33, column: 37 } }, '18': { start: { line: 35, column: 6 }, end: { line: 35, column: 28 } }, '19': { start: { line: 36, column: 6 }, end: { line: 36, column: 18 } }, '20': { start: { line: 41, column: 20 }, end: { line: 41, column: 25 } }, '21': { start: { line: 42, column: 6 }, end: { line: 42, column: 39 } }, '22': { start: { line: 43, column: 21 }, end: { line: 43, column: 52 } }, '23': { start: { line: 44, column: 21 }, end: { line: 44, column: 27 } }, '24': { start: { line: 45, column: 24 }, end: { line: 45, column: 30 } }, '25': { start: { line: 46, column: 6 }, end: { line: 66, column: 7 } }, '26': { start: { line: 47, column: 8 }, end: { line: 51, column: 9 } }, '27': { start: { line: 49, column: 10 }, end: { line: 49, column: 51 } }, '28': { start: { line: 50, column: 10 }, end: { line: 50, column: 43 } }, '29': { start: { line: 53, column: 8 }, end: { line: 55, column: 9 } }, '30': { start: { line: 54, column: 10 }, end: { line: 54, column: 41 } }, '31': { start: { line: 56, column: 8 }, end: { line: 56, column: 34 } }, '32': { start: { line: 57, column: 8 }, end: { line: 57, column: 30 } }, '33': { start: { line: 58, column: 8 }, end: { line: 58, column: 28 } }, '34': { start: { line: 59, column: 8 }, end: { line: 59, column: 24 } }, '35': { start: { line: 60, column: 8 }, end: { line: 65, column: 9 } }, '36': { start: { line: 61, column: 10 }, end: { line: 64, column: 11 } }, '37': { start: { line: 62, column: 12 }, end: { line: 62, column: 35 } }, '38': { start: { line: 63, column: 12 }, end: { line: 63, column: 72 } }, '39': { start: { line: 67, column: 6 }, end: { line: 67, column: 60 } }, '40': { start: { line: 70, column: 2 }, end: { line: 70, column: 19 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 1, column: 16 }, end: { line: 1, column: 17 } }, loc: { start: { line: 1, column: 28 }, end: { line: 71, column: 1 } }, line: 1 }, '1': { name: 'Processor', decl: { start: { line: 2, column: 11 }, end: { line: 2, column: 20 } }, loc: { start: { line: 2, column: 30 }, end: { line: 7, column: 3 } }, line: 2 }, '2': { name: 'options', decl: { start: { line: 11, column: 20 }, end: { line: 11, column: 27 } }, loc: { start: { line: 11, column: 38 }, end: { line: 16, column: 5 } }, line: 11 }, '3': { name: 'pipe', decl: { start: { line: 19, column: 20 }, end: { line: 19, column: 24 } }, loc: { start: { line: 19, column: 40 }, end: { line: 37, column: 5 } }, line: 19 }, '4': { name: 'process', decl: { start: { line: 40, column: 20 }, end: { line: 40, column: 27 } }, loc: { start: { line: 40, column: 41 }, end: { line: 68, column: 5 } }, line: 40 } }, branchMap: { '0': { loc: { start: { line: 5, column: 23 }, end: { line: 5, column: 36 } }, type: 'binary-expr', locations: [{ start: { line: 5, column: 23 }, end: { line: 5, column: 30 } }, { start: { line: 5, column: 34 }, end: { line: 5, column: 36 } }], line: 5 }, '1': { loc: { start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }, type: 'if', locations: [{ start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }, { start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }], line: 12 }, '2': { loc: { start: { line: 21, column: 6 }, end: { line: 27, column: 7 } }, type: 'if', locations: [{ start: { line: 21, column: 6 }, end: { line: 27, column: 7 } }, { start: { line: 21, column: 6 }, end: { line: 27, column: 7 } }], line: 21 }, '3': { loc: { start: { line: 22, column: 8 }, end: { line: 26, column: 9 } }, type: 'if', locations: [{ start: { line: 22, column: 8 }, end: { line: 26, column: 9 } }, { start: { line: 22, column: 8 }, end: { line: 26, column: 9 } }], line: 22 }, '4': { loc: { start: { line: 28, column: 6 }, end: { line: 34, column: 7 } }, type: 'if', locations: [{ start: { line: 28, column: 6 }, end: { line: 34, column: 7 } }, { start: { line: 28, column: 6 }, end: { line: 34, column: 7 } }], line: 28 }, '5': { loc: { start: { line: 28, column: 10 }, end: { line: 28, column: 27 } }, type: 'binary-expr', locations: [{ start: { line: 28, column: 10 }, end: { line: 28, column: 14 } }, { start: { line: 28, column: 18 }, end: { line: 28, column: 27 } }], line: 28 }, '6': { loc: { start: { line: 30, column: 8 }, end: { line: 32, column: 9 } }, type: 'if', locations: [{ start: { line: 30, column: 8 }, end: { line: 32, column: 9 } }, { start: { line: 30, column: 8 }, end: { line: 32, column: 9 } }], line: 30 }, '7': { loc: { start: { line: 43, column: 21 }, end: { line: 43, column: 52 } }, type: 'binary-expr', locations: [{ start: { line: 43, column: 21 }, end: { line: 43, column: 25 } }, { start: { line: 43, column: 29 }, end: { line: 43, column: 39 } }, { start: { line: 43, column: 43 }, end: { line: 43, column: 52 } }], line: 43 }, '8': { loc: { start: { line: 47, column: 8 }, end: { line: 51, column: 9 } }, type: 'if', locations: [{ start: { line: 47, column: 8 }, end: { line: 51, column: 9 } }, { start: { line: 47, column: 8 }, end: { line: 51, column: 9 } }], line: 47 }, '9': { loc: { start: { line: 53, column: 8 }, end: { line: 55, column: 9 } }, type: 'if', locations: [{ start: { line: 53, column: 8 }, end: { line: 55, column: 9 } }, { start: { line: 53, column: 8 }, end: { line: 55, column: 9 } }], line: 53 }, '10': { loc: { start: { line: 60, column: 8 }, end: { line: 65, column: 9 } }, type: 'if', locations: [{ start: { line: 60, column: 8 }, end: { line: 65, column: 9 } }, { start: { line: 60, column: 8 }, end: { line: 65, column: 9 } }], line: 60 }, '11': { loc: { start: { line: 61, column: 10 }, end: { line: 64, column: 11 } }, type: 'if', locations: [{ start: { line: 61, column: 10 }, end: { line: 64, column: 11 } }, { start: { line: 61, column: 10 }, end: { line: 64, column: 11 } }], line: 61 }, '12': { loc: { start: { line: 63, column: 23 }, end: { line: 63, column: 71 } }, type: 'binary-expr', locations: [{ start: { line: 63, column: 23 }, end: { line: 63, column: 43 } }, { start: { line: 63, column: 47 }, end: { line: 63, column: 59 } }, { start: { line: 63, column: 63 }, end: { line: 63, column: 71 } }], line: 63 }, '13': { loc: { start: { line: 67, column: 13 }, end: { line: 67, column: 59 } }, type: 'cond-expr', locations: [{ start: { line: 67, column: 33 }, end: { line: 67, column: 47 } }, { start: { line: 67, column: 50 }, end: { line: 67, column: 59 } }], line: 67 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0, 0], '13': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2297 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2298 return coverage[path];
2299 }coverageData.hash = hash;return coverage[path] = coverageData;
2300}();var Processor = (cov_z93lwrnu3.s[0]++, function () {
2301 cov_z93lwrnu3.f[0]++;function Processor(options) {
2302 cov_z93lwrnu3.f[1]++;cov_z93lwrnu3.s[1]++;classCallCheck$1(this, Processor);cov_z93lwrnu3.s[2]++;this.selfOptions = (cov_z93lwrnu3.b[0][0]++, options) || (cov_z93lwrnu3.b[0][1]++, {});cov_z93lwrnu3.s[3]++;this.pipes = {};
2303 }cov_z93lwrnu3.s[4]++;createClass$1(Processor, [{ key: 'options', value: function options(_options) {
2304 cov_z93lwrnu3.f[2]++;cov_z93lwrnu3.s[5]++;if (_options) {
2305 cov_z93lwrnu3.b[1][0]++;cov_z93lwrnu3.s[6]++;this.selfOptions = _options;
2306 } else {
2307 cov_z93lwrnu3.b[1][1]++;
2308 }cov_z93lwrnu3.s[7]++;return this.selfOptions;
2309 } }, { key: 'pipe', value: function pipe(name, pipeArg) {
2310 cov_z93lwrnu3.f[3]++;var pipe = (cov_z93lwrnu3.s[8]++, pipeArg);cov_z93lwrnu3.s[9]++;if (typeof name === 'string') {
2311 cov_z93lwrnu3.b[2][0]++;cov_z93lwrnu3.s[10]++;if (typeof pipe === 'undefined') {
2312 cov_z93lwrnu3.b[3][0]++;cov_z93lwrnu3.s[11]++;return this.pipes[name];
2313 } else {
2314 cov_z93lwrnu3.b[3][1]++;cov_z93lwrnu3.s[12]++;this.pipes[name] = pipe;
2315 }
2316 } else {
2317 cov_z93lwrnu3.b[2][1]++;
2318 }cov_z93lwrnu3.s[13]++;if ((cov_z93lwrnu3.b[5][0]++, name) && (cov_z93lwrnu3.b[5][1]++, name.name)) {
2319 cov_z93lwrnu3.b[4][0]++;cov_z93lwrnu3.s[14]++;pipe = name;cov_z93lwrnu3.s[15]++;if (pipe.processor === this) {
2320 cov_z93lwrnu3.b[6][0]++;cov_z93lwrnu3.s[16]++;return pipe;
2321 } else {
2322 cov_z93lwrnu3.b[6][1]++;
2323 }cov_z93lwrnu3.s[17]++;this.pipes[pipe.name] = pipe;
2324 } else {
2325 cov_z93lwrnu3.b[4][1]++;
2326 }cov_z93lwrnu3.s[18]++;pipe.processor = this;cov_z93lwrnu3.s[19]++;return pipe;
2327 } }, { key: 'process', value: function process(input, pipe) {
2328 cov_z93lwrnu3.f[4]++;var context = (cov_z93lwrnu3.s[20]++, input);cov_z93lwrnu3.s[21]++;context.options = this.options();var nextPipe = (cov_z93lwrnu3.s[22]++, (cov_z93lwrnu3.b[7][0]++, pipe) || (cov_z93lwrnu3.b[7][1]++, input.pipe) || (cov_z93lwrnu3.b[7][2]++, 'default'));var lastPipe = (cov_z93lwrnu3.s[23]++, void 0);var lastContext = (cov_z93lwrnu3.s[24]++, void 0);cov_z93lwrnu3.s[25]++;while (nextPipe) {
2329 cov_z93lwrnu3.s[26]++;if (typeof context.nextAfterChildren !== 'undefined') {
2330 cov_z93lwrnu3.b[8][0]++;cov_z93lwrnu3.s[27]++; // children processed and coming back to parent
2331 context.next = context.nextAfterChildren;cov_z93lwrnu3.s[28]++;context.nextAfterChildren = null;
2332 } else {
2333 cov_z93lwrnu3.b[8][1]++;
2334 }cov_z93lwrnu3.s[29]++;if (typeof nextPipe === 'string') {
2335 cov_z93lwrnu3.b[9][0]++;cov_z93lwrnu3.s[30]++;nextPipe = this.pipe(nextPipe);
2336 } else {
2337 cov_z93lwrnu3.b[9][1]++;
2338 }cov_z93lwrnu3.s[31]++;nextPipe.process(context);cov_z93lwrnu3.s[32]++;lastContext = context;cov_z93lwrnu3.s[33]++;lastPipe = nextPipe;cov_z93lwrnu3.s[34]++;nextPipe = null;cov_z93lwrnu3.s[35]++;if (context) {
2339 cov_z93lwrnu3.b[10][0]++;cov_z93lwrnu3.s[36]++;if (context.next) {
2340 cov_z93lwrnu3.b[11][0]++;cov_z93lwrnu3.s[37]++;context = context.next;cov_z93lwrnu3.s[38]++;nextPipe = (cov_z93lwrnu3.b[12][0]++, lastContext.nextPipe) || (cov_z93lwrnu3.b[12][1]++, context.pipe) || (cov_z93lwrnu3.b[12][2]++, lastPipe);
2341 } else {
2342 cov_z93lwrnu3.b[11][1]++;
2343 }
2344 } else {
2345 cov_z93lwrnu3.b[10][1]++;
2346 }
2347 }cov_z93lwrnu3.s[39]++;return context.hasResult ? (cov_z93lwrnu3.b[13][0]++, context.result) : (cov_z93lwrnu3.b[13][1]++, undefined);
2348 } }]);cov_z93lwrnu3.s[40]++;return Processor;
2349}());
2350
2351var cov_mwia6hc6s = function () {
2352 var path = '/Users/benja/proj/jsondiffpatch/src/pipe.js',
2353 hash = '74d5af74abfffcb914d9f6d33955ea80539f7771',
2354 global = new Function('return this')(),
2355 gcv = '__coverage__',
2356 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/pipe.js', statementMap: { '0': { start: { line: 1, column: 11 }, end: { line: 172, column: 3 } }, '1': { start: { line: 3, column: 4 }, end: { line: 3, column: 44 } }, '2': { start: { line: 5, column: 4 }, end: { line: 5, column: 21 } }, '3': { start: { line: 6, column: 4 }, end: { line: 6, column: 22 } }, '4': { start: { line: 9, column: 2 }, end: { line: 170, column: 6 } }, '5': { start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }, '6': { start: { line: 13, column: 8 }, end: { line: 13, column: 72 } }, '7': { start: { line: 15, column: 18 }, end: { line: 15, column: 28 } }, '8': { start: { line: 16, column: 19 }, end: { line: 16, column: 38 } }, '9': { start: { line: 17, column: 20 }, end: { line: 17, column: 25 } }, '10': { start: { line: 18, column: 6 }, end: { line: 28, column: 7 } }, '11': { start: { line: 19, column: 21 }, end: { line: 19, column: 40 } }, '12': { start: { line: 20, column: 8 }, end: { line: 22, column: 9 } }, '13': { start: { line: 21, column: 10 }, end: { line: 21, column: 51 } }, '14': { start: { line: 23, column: 8 }, end: { line: 23, column: 24 } }, '15': { start: { line: 24, column: 8 }, end: { line: 27, column: 9 } }, '16': { start: { line: 25, column: 10 }, end: { line: 25, column: 34 } }, '17': { start: { line: 26, column: 10 }, end: { line: 26, column: 16 } }, '18': { start: { line: 29, column: 6 }, end: { line: 31, column: 7 } }, '19': { start: { line: 30, column: 8 }, end: { line: 30, column: 34 } }, '20': { start: { line: 36, column: 6 }, end: { line: 36, column: 68 } }, '21': { start: { line: 43, column: 6 }, end: { line: 43, column: 64 } }, '22': { start: { line: 44, column: 6 }, end: { line: 44, column: 18 } }, '23': { start: { line: 51, column: 6 }, end: { line: 51, column: 69 } }, '24': { start: { line: 52, column: 6 }, end: { line: 52, column: 18 } }, '25': { start: { line: 57, column: 6 }, end: { line: 59, column: 7 } }, '26': { start: { line: 58, column: 8 }, end: { line: 58, column: 53 } }, '27': { start: { line: 60, column: 6 }, end: { line: 65, column: 7 } }, '28': { start: { line: 61, column: 21 }, end: { line: 61, column: 40 } }, '29': { start: { line: 62, column: 8 }, end: { line: 64, column: 9 } }, '30': { start: { line: 63, column: 10 }, end: { line: 63, column: 23 } }, '31': { start: { line: 66, column: 6 }, end: { line: 66, column: 57 } }, '32': { start: { line: 71, column: 18 }, end: { line: 71, column: 20 } }, '33': { start: { line: 73, column: 38 }, end: { line: 73, column: 42 } }, '34': { start: { line: 74, column: 30 }, end: { line: 74, column: 35 } }, '35': { start: { line: 75, column: 27 }, end: { line: 75, column: 36 } }, '36': { start: { line: 77, column: 6 }, end: { line: 96, column: 7 } }, '37': { start: { line: 78, column: 8 }, end: { line: 82, column: 9 } }, '38': { start: { line: 79, column: 23 }, end: { line: 79, column: 34 } }, '39': { start: { line: 81, column: 10 }, end: { line: 81, column: 40 } }, '40': { start: { line: 84, column: 8 }, end: { line: 84, column: 33 } }, '41': { start: { line: 85, column: 8 }, end: { line: 85, column: 29 } }, '42': { start: { line: 87, column: 8 }, end: { line: 95, column: 9 } }, '43': { start: { line: 88, column: 10 }, end: { line: 90, column: 11 } }, '44': { start: { line: 89, column: 12 }, end: { line: 89, column: 31 } }, '45': { start: { line: 92, column: 10 }, end: { line: 94, column: 11 } }, '46': { start: { line: 93, column: 12 }, end: { line: 93, column: 33 } }, '47': { start: { line: 98, column: 6 }, end: { line: 98, column: 19 } }, '48': { start: { line: 103, column: 18 }, end: { line: 103, column: 42 } }, '49': { start: { line: 104, column: 19 }, end: { line: 104, column: 59 } }, '50': { start: { line: 105, column: 6 }, end: { line: 107, column: 7 } }, '51': { start: { line: 106, column: 8 }, end: { line: 106, column: 48 } }, '52': { start: { line: 108, column: 6 }, end: { line: 108, column: 35 } }, '53': { start: { line: 109, column: 6 }, end: { line: 109, column: 57 } }, '54': { start: { line: 110, column: 6 }, end: { line: 110, column: 18 } }, '55': { start: { line: 115, column: 18 }, end: { line: 115, column: 42 } }, '56': { start: { line: 116, column: 19 }, end: { line: 116, column: 59 } }, '57': { start: { line: 117, column: 6 }, end: { line: 119, column: 7 } }, '58': { start: { line: 118, column: 8 }, end: { line: 118, column: 48 } }, '59': { start: { line: 120, column: 6 }, end: { line: 120, column: 31 } }, '60': { start: { line: 121, column: 6 }, end: { line: 121, column: 57 } }, '61': { start: { line: 122, column: 6 }, end: { line: 122, column: 18 } }, '62': { start: { line: 127, column: 18 }, end: { line: 127, column: 42 } }, '63': { start: { line: 128, column: 19 }, end: { line: 128, column: 59 } }, '64': { start: { line: 129, column: 6 }, end: { line: 131, column: 7 } }, '65': { start: { line: 130, column: 8 }, end: { line: 130, column: 48 } }, '66': { start: { line: 132, column: 6 }, end: { line: 132, column: 31 } }, '67': { start: { line: 133, column: 6 }, end: { line: 133, column: 57 } }, '68': { start: { line: 134, column: 6 }, end: { line: 134, column: 18 } }, '69': { start: { line: 139, column: 18 }, end: { line: 139, column: 42 } }, '70': { start: { line: 140, column: 6 }, end: { line: 140, column: 36 } }, '71': { start: { line: 141, column: 6 }, end: { line: 141, column: 18 } }, '72': { start: { line: 146, column: 6 }, end: { line: 146, column: 30 } }, '73': { start: { line: 147, column: 6 }, end: { line: 147, column: 18 } }, '74': { start: { line: 152, column: 6 }, end: { line: 155, column: 7 } }, '75': { start: { line: 153, column: 8 }, end: { line: 153, column: 32 } }, '76': { start: { line: 154, column: 8 }, end: { line: 154, column: 15 } }, '77': { start: { line: 156, column: 6 }, end: { line: 158, column: 7 } }, '78': { start: { line: 157, column: 8 }, end: { line: 157, column: 15 } }, '79': { start: { line: 159, column: 17 }, end: { line: 159, column: 21 } }, '80': { start: { line: 160, column: 6 }, end: { line: 167, column: 8 } }, '81': { start: { line: 161, column: 8 }, end: { line: 166, column: 9 } }, '82': { start: { line: 162, column: 10 }, end: { line: 162, column: 31 } }, '83': { start: { line: 163, column: 22 }, end: { line: 163, column: 54 } }, '84': { start: { line: 164, column: 10 }, end: { line: 164, column: 32 } }, '85': { start: { line: 165, column: 10 }, end: { line: 165, column: 22 } }, '86': { start: { line: 168, column: 6 }, end: { line: 168, column: 18 } }, '87': { start: { line: 171, column: 2 }, end: { line: 171, column: 14 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } }, loc: { start: { line: 1, column: 23 }, end: { line: 172, column: 1 } }, line: 1 }, '1': { name: 'Pipe', decl: { start: { line: 2, column: 11 }, end: { line: 2, column: 15 } }, loc: { start: { line: 2, column: 22 }, end: { line: 7, column: 3 } }, line: 2 }, '2': { name: 'process', decl: { start: { line: 11, column: 20 }, end: { line: 11, column: 27 } }, loc: { start: { line: 11, column: 35 }, end: { line: 32, column: 5 } }, line: 11 }, '3': { name: 'log', decl: { start: { line: 35, column: 20 }, end: { line: 35, column: 23 } }, loc: { start: { line: 35, column: 29 }, end: { line: 37, column: 5 } }, line: 35 }, '4': { name: 'append', decl: { start: { line: 40, column: 20 }, end: { line: 40, column: 26 } }, loc: { start: { line: 40, column: 29 }, end: { line: 45, column: 5 } }, line: 40 }, '5': { name: 'prepend', decl: { start: { line: 48, column: 20 }, end: { line: 48, column: 27 } }, loc: { start: { line: 48, column: 30 }, end: { line: 53, column: 5 } }, line: 48 }, '6': { name: 'indexOf', decl: { start: { line: 56, column: 20 }, end: { line: 56, column: 27 } }, loc: { start: { line: 56, column: 40 }, end: { line: 67, column: 5 } }, line: 56 }, '7': { name: 'list', decl: { start: { line: 70, column: 20 }, end: { line: 70, column: 24 } }, loc: { start: { line: 70, column: 27 }, end: { line: 99, column: 5 } }, line: 70 }, '8': { name: 'after', decl: { start: { line: 102, column: 20 }, end: { line: 102, column: 25 } }, loc: { start: { line: 102, column: 38 }, end: { line: 111, column: 5 } }, line: 102 }, '9': { name: 'before', decl: { start: { line: 114, column: 20 }, end: { line: 114, column: 26 } }, loc: { start: { line: 114, column: 39 }, end: { line: 123, column: 5 } }, line: 114 }, '10': { name: 'replace', decl: { start: { line: 126, column: 20 }, end: { line: 126, column: 27 } }, loc: { start: { line: 126, column: 40 }, end: { line: 135, column: 5 } }, line: 126 }, '11': { name: 'remove', decl: { start: { line: 138, column: 20 }, end: { line: 138, column: 26 } }, loc: { start: { line: 138, column: 39 }, end: { line: 142, column: 5 } }, line: 138 }, '12': { name: 'clear', decl: { start: { line: 145, column: 20 }, end: { line: 145, column: 25 } }, loc: { start: { line: 145, column: 28 }, end: { line: 148, column: 5 } }, line: 145 }, '13': { name: 'shouldHaveResult', decl: { start: { line: 151, column: 20 }, end: { line: 151, column: 36 } }, loc: { start: { line: 151, column: 45 }, end: { line: 169, column: 5 } }, line: 151 }, '14': { name: '(anonymous_14)', decl: { start: { line: 160, column: 25 }, end: { line: 160, column: 26 } }, loc: { start: { line: 160, column: 44 }, end: { line: 167, column: 7 } }, line: 160 } }, branchMap: { '0': { loc: { start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }, type: 'if', locations: [{ start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }, { start: { line: 12, column: 6 }, end: { line: 14, column: 7 } }], line: 12 }, '1': { loc: { start: { line: 20, column: 8 }, end: { line: 22, column: 9 } }, type: 'if', locations: [{ start: { line: 20, column: 8 }, end: { line: 22, column: 9 } }, { start: { line: 20, column: 8 }, end: { line: 22, column: 9 } }], line: 20 }, '2': { loc: { start: { line: 24, column: 8 }, end: { line: 27, column: 9 } }, type: 'if', locations: [{ start: { line: 24, column: 8 }, end: { line: 27, column: 9 } }, { start: { line: 24, column: 8 }, end: { line: 27, column: 9 } }], line: 24 }, '3': { loc: { start: { line: 24, column: 12 }, end: { line: 24, column: 121 } }, type: 'binary-expr', locations: [{ start: { line: 24, column: 12 }, end: { line: 24, column: 102 } }, { start: { line: 24, column: 106 }, end: { line: 24, column: 121 } }], line: 24 }, '4': { loc: { start: { line: 24, column: 13 }, end: { line: 24, column: 88 } }, type: 'cond-expr', locations: [{ start: { line: 24, column: 46 }, end: { line: 24, column: 57 } }, { start: { line: 24, column: 60 }, end: { line: 24, column: 88 } }], line: 24 }, '5': { loc: { start: { line: 29, column: 6 }, end: { line: 31, column: 7 } }, type: 'if', locations: [{ start: { line: 29, column: 6 }, end: { line: 31, column: 7 } }, { start: { line: 29, column: 6 }, end: { line: 31, column: 7 } }], line: 29 }, '6': { loc: { start: { line: 29, column: 10 }, end: { line: 29, column: 43 } }, type: 'binary-expr', locations: [{ start: { line: 29, column: 10 }, end: { line: 29, column: 23 } }, { start: { line: 29, column: 27 }, end: { line: 29, column: 43 } }], line: 29 }, '7': { loc: { start: { line: 57, column: 6 }, end: { line: 59, column: 7 } }, type: 'if', locations: [{ start: { line: 57, column: 6 }, end: { line: 59, column: 7 } }, { start: { line: 57, column: 6 }, end: { line: 59, column: 7 } }], line: 57 }, '8': { loc: { start: { line: 62, column: 8 }, end: { line: 64, column: 9 } }, type: 'if', locations: [{ start: { line: 62, column: 8 }, end: { line: 64, column: 9 } }, { start: { line: 62, column: 8 }, end: { line: 64, column: 9 } }], line: 62 }, '9': { loc: { start: { line: 88, column: 10 }, end: { line: 90, column: 11 } }, type: 'if', locations: [{ start: { line: 88, column: 10 }, end: { line: 90, column: 11 } }, { start: { line: 88, column: 10 }, end: { line: 90, column: 11 } }], line: 88 }, '10': { loc: { start: { line: 88, column: 14 }, end: { line: 88, column: 60 } }, type: 'binary-expr', locations: [{ start: { line: 88, column: 14 }, end: { line: 88, column: 40 } }, { start: { line: 88, column: 44 }, end: { line: 88, column: 60 } }], line: 88 }, '11': { loc: { start: { line: 92, column: 10 }, end: { line: 94, column: 11 } }, type: 'if', locations: [{ start: { line: 92, column: 10 }, end: { line: 94, column: 11 } }, { start: { line: 92, column: 10 }, end: { line: 94, column: 11 } }], line: 92 }, '12': { loc: { start: { line: 105, column: 6 }, end: { line: 107, column: 7 } }, type: 'if', locations: [{ start: { line: 105, column: 6 }, end: { line: 107, column: 7 } }, { start: { line: 105, column: 6 }, end: { line: 107, column: 7 } }], line: 105 }, '13': { loc: { start: { line: 117, column: 6 }, end: { line: 119, column: 7 } }, type: 'if', locations: [{ start: { line: 117, column: 6 }, end: { line: 119, column: 7 } }, { start: { line: 117, column: 6 }, end: { line: 119, column: 7 } }], line: 117 }, '14': { loc: { start: { line: 129, column: 6 }, end: { line: 131, column: 7 } }, type: 'if', locations: [{ start: { line: 129, column: 6 }, end: { line: 131, column: 7 } }, { start: { line: 129, column: 6 }, end: { line: 131, column: 7 } }], line: 129 }, '15': { loc: { start: { line: 152, column: 6 }, end: { line: 155, column: 7 } }, type: 'if', locations: [{ start: { line: 152, column: 6 }, end: { line: 155, column: 7 } }, { start: { line: 152, column: 6 }, end: { line: 155, column: 7 } }], line: 152 }, '16': { loc: { start: { line: 156, column: 6 }, end: { line: 158, column: 7 } }, type: 'if', locations: [{ start: { line: 156, column: 6 }, end: { line: 158, column: 7 } }, { start: { line: 156, column: 6 }, end: { line: 158, column: 7 } }], line: 156 }, '17': { loc: { start: { line: 161, column: 8 }, end: { line: 166, column: 9 } }, type: 'if', locations: [{ start: { line: 161, column: 8 }, end: { line: 166, column: 9 } }, { start: { line: 161, column: 8 }, end: { line: 166, column: 9 } }], line: 161 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0, '86': 0, '87': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2357 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2358 return coverage[path];
2359 }coverageData.hash = hash;return coverage[path] = coverageData;
2360}();var Pipe = (cov_mwia6hc6s.s[0]++, function () {
2361 cov_mwia6hc6s.f[0]++;function Pipe(name) {
2362 cov_mwia6hc6s.f[1]++;cov_mwia6hc6s.s[1]++;classCallCheck$1(this, Pipe);cov_mwia6hc6s.s[2]++;this.name = name;cov_mwia6hc6s.s[3]++;this.filters = [];
2363 }cov_mwia6hc6s.s[4]++;createClass$1(Pipe, [{ key: 'process', value: function process(input) {
2364 cov_mwia6hc6s.f[2]++;cov_mwia6hc6s.s[5]++;if (!this.processor) {
2365 cov_mwia6hc6s.b[0][0]++;cov_mwia6hc6s.s[6]++;throw new Error('add this pipe to a processor before using it');
2366 } else {
2367 cov_mwia6hc6s.b[0][1]++;
2368 }var debug = (cov_mwia6hc6s.s[7]++, this.debug);var length = (cov_mwia6hc6s.s[8]++, this.filters.length);var context = (cov_mwia6hc6s.s[9]++, input);cov_mwia6hc6s.s[10]++;for (var index = 0; index < length; index++) {
2369 var filter = (cov_mwia6hc6s.s[11]++, this.filters[index]);cov_mwia6hc6s.s[12]++;if (debug) {
2370 cov_mwia6hc6s.b[1][0]++;cov_mwia6hc6s.s[13]++;this.log('filter: ' + filter.filterName);
2371 } else {
2372 cov_mwia6hc6s.b[1][1]++;
2373 }cov_mwia6hc6s.s[14]++;filter(context);cov_mwia6hc6s.s[15]++;if ((cov_mwia6hc6s.b[3][0]++, (typeof context === 'undefined' ? (cov_mwia6hc6s.b[4][0]++, 'undefined') : (cov_mwia6hc6s.b[4][1]++, _typeof$1(context))) === 'object') && (cov_mwia6hc6s.b[3][1]++, context.exiting)) {
2374 cov_mwia6hc6s.b[2][0]++;cov_mwia6hc6s.s[16]++;context.exiting = false;cov_mwia6hc6s.s[17]++;break;
2375 } else {
2376 cov_mwia6hc6s.b[2][1]++;
2377 }
2378 }cov_mwia6hc6s.s[18]++;if ((cov_mwia6hc6s.b[6][0]++, !context.next) && (cov_mwia6hc6s.b[6][1]++, this.resultCheck)) {
2379 cov_mwia6hc6s.b[5][0]++;cov_mwia6hc6s.s[19]++;this.resultCheck(context);
2380 } else {
2381 cov_mwia6hc6s.b[5][1]++;
2382 }
2383 } }, { key: 'log', value: function log(msg) {
2384 cov_mwia6hc6s.f[3]++;cov_mwia6hc6s.s[20]++;console.log('[jsondiffpatch] ' + this.name + ' pipe, ' + msg);
2385 } }, { key: 'append', value: function append() {
2386 cov_mwia6hc6s.f[4]++;var _filters;cov_mwia6hc6s.s[21]++;(_filters = this.filters).push.apply(_filters, arguments);cov_mwia6hc6s.s[22]++;return this;
2387 } }, { key: 'prepend', value: function prepend() {
2388 cov_mwia6hc6s.f[5]++;var _filters2;cov_mwia6hc6s.s[23]++;(_filters2 = this.filters).unshift.apply(_filters2, arguments);cov_mwia6hc6s.s[24]++;return this;
2389 } }, { key: 'indexOf', value: function indexOf(filterName) {
2390 cov_mwia6hc6s.f[6]++;cov_mwia6hc6s.s[25]++;if (!filterName) {
2391 cov_mwia6hc6s.b[7][0]++;cov_mwia6hc6s.s[26]++;throw new Error('a filter name is required');
2392 } else {
2393 cov_mwia6hc6s.b[7][1]++;
2394 }cov_mwia6hc6s.s[27]++;for (var index = 0; index < this.filters.length; index++) {
2395 var filter = (cov_mwia6hc6s.s[28]++, this.filters[index]);cov_mwia6hc6s.s[29]++;if (filter.filterName === filterName) {
2396 cov_mwia6hc6s.b[8][0]++;cov_mwia6hc6s.s[30]++;return index;
2397 } else {
2398 cov_mwia6hc6s.b[8][1]++;
2399 }
2400 }cov_mwia6hc6s.s[31]++;throw new Error('filter not found: ' + filterName);
2401 } }, { key: 'list', value: function list() {
2402 cov_mwia6hc6s.f[7]++;var names = (cov_mwia6hc6s.s[32]++, []);var _iteratorNormalCompletion = (cov_mwia6hc6s.s[33]++, true);var _didIteratorError = (cov_mwia6hc6s.s[34]++, false);var _iteratorError = (cov_mwia6hc6s.s[35]++, undefined);cov_mwia6hc6s.s[36]++;try {
2403 cov_mwia6hc6s.s[37]++;for (var _iterator = this.filters[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2404 var filter = (cov_mwia6hc6s.s[38]++, _step.value);cov_mwia6hc6s.s[39]++;names.push(filter.filterName);
2405 }
2406 } catch (err) {
2407 cov_mwia6hc6s.s[40]++;_didIteratorError = true;cov_mwia6hc6s.s[41]++;_iteratorError = err;
2408 } finally {
2409 cov_mwia6hc6s.s[42]++;try {
2410 cov_mwia6hc6s.s[43]++;if ((cov_mwia6hc6s.b[10][0]++, !_iteratorNormalCompletion) && (cov_mwia6hc6s.b[10][1]++, _iterator.return)) {
2411 cov_mwia6hc6s.b[9][0]++;cov_mwia6hc6s.s[44]++;_iterator.return();
2412 } else {
2413 cov_mwia6hc6s.b[9][1]++;
2414 }
2415 } finally {
2416 cov_mwia6hc6s.s[45]++;if (_didIteratorError) {
2417 cov_mwia6hc6s.b[11][0]++;cov_mwia6hc6s.s[46]++;throw _iteratorError;
2418 } else {
2419 cov_mwia6hc6s.b[11][1]++;
2420 }
2421 }
2422 }cov_mwia6hc6s.s[47]++;return names;
2423 } }, { key: 'after', value: function after(filterName) {
2424 cov_mwia6hc6s.f[8]++;var index = (cov_mwia6hc6s.s[48]++, this.indexOf(filterName));var params = (cov_mwia6hc6s.s[49]++, Array.prototype.slice.call(arguments, 1));cov_mwia6hc6s.s[50]++;if (!params.length) {
2425 cov_mwia6hc6s.b[12][0]++;cov_mwia6hc6s.s[51]++;throw new Error('a filter is required');
2426 } else {
2427 cov_mwia6hc6s.b[12][1]++;
2428 }cov_mwia6hc6s.s[52]++;params.unshift(index + 1, 0);cov_mwia6hc6s.s[53]++;Array.prototype.splice.apply(this.filters, params);cov_mwia6hc6s.s[54]++;return this;
2429 } }, { key: 'before', value: function before(filterName) {
2430 cov_mwia6hc6s.f[9]++;var index = (cov_mwia6hc6s.s[55]++, this.indexOf(filterName));var params = (cov_mwia6hc6s.s[56]++, Array.prototype.slice.call(arguments, 1));cov_mwia6hc6s.s[57]++;if (!params.length) {
2431 cov_mwia6hc6s.b[13][0]++;cov_mwia6hc6s.s[58]++;throw new Error('a filter is required');
2432 } else {
2433 cov_mwia6hc6s.b[13][1]++;
2434 }cov_mwia6hc6s.s[59]++;params.unshift(index, 0);cov_mwia6hc6s.s[60]++;Array.prototype.splice.apply(this.filters, params);cov_mwia6hc6s.s[61]++;return this;
2435 } }, { key: 'replace', value: function replace(filterName) {
2436 cov_mwia6hc6s.f[10]++;var index = (cov_mwia6hc6s.s[62]++, this.indexOf(filterName));var params = (cov_mwia6hc6s.s[63]++, Array.prototype.slice.call(arguments, 1));cov_mwia6hc6s.s[64]++;if (!params.length) {
2437 cov_mwia6hc6s.b[14][0]++;cov_mwia6hc6s.s[65]++;throw new Error('a filter is required');
2438 } else {
2439 cov_mwia6hc6s.b[14][1]++;
2440 }cov_mwia6hc6s.s[66]++;params.unshift(index, 1);cov_mwia6hc6s.s[67]++;Array.prototype.splice.apply(this.filters, params);cov_mwia6hc6s.s[68]++;return this;
2441 } }, { key: 'remove', value: function remove(filterName) {
2442 cov_mwia6hc6s.f[11]++;var index = (cov_mwia6hc6s.s[69]++, this.indexOf(filterName));cov_mwia6hc6s.s[70]++;this.filters.splice(index, 1);cov_mwia6hc6s.s[71]++;return this;
2443 } }, { key: 'clear', value: function clear() {
2444 cov_mwia6hc6s.f[12]++;cov_mwia6hc6s.s[72]++;this.filters.length = 0;cov_mwia6hc6s.s[73]++;return this;
2445 } }, { key: 'shouldHaveResult', value: function shouldHaveResult(should) {
2446 cov_mwia6hc6s.f[13]++;cov_mwia6hc6s.s[74]++;if (should === false) {
2447 cov_mwia6hc6s.b[15][0]++;cov_mwia6hc6s.s[75]++;this.resultCheck = null;cov_mwia6hc6s.s[76]++;return;
2448 } else {
2449 cov_mwia6hc6s.b[15][1]++;
2450 }cov_mwia6hc6s.s[77]++;if (this.resultCheck) {
2451 cov_mwia6hc6s.b[16][0]++;cov_mwia6hc6s.s[78]++;return;
2452 } else {
2453 cov_mwia6hc6s.b[16][1]++;
2454 }var pipe = (cov_mwia6hc6s.s[79]++, this);cov_mwia6hc6s.s[80]++;this.resultCheck = function (context) {
2455 cov_mwia6hc6s.f[14]++;cov_mwia6hc6s.s[81]++;if (!context.hasResult) {
2456 cov_mwia6hc6s.b[17][0]++;cov_mwia6hc6s.s[82]++;console.log(context);var error = (cov_mwia6hc6s.s[83]++, new Error(pipe.name + ' failed'));cov_mwia6hc6s.s[84]++;error.noResult = true;cov_mwia6hc6s.s[85]++;throw error;
2457 } else {
2458 cov_mwia6hc6s.b[17][1]++;
2459 }
2460 };cov_mwia6hc6s.s[86]++;return this;
2461 } }]);cov_mwia6hc6s.s[87]++;return Pipe;
2462}());
2463
2464var cov_15dz7p942d = function () {
2465 var path = '/Users/benja/proj/jsondiffpatch/src/contexts/context.js',
2466 hash = 'd8af74e6f94b0d75ab256641f76a0c75f3293d60',
2467 global = new Function('return this')(),
2468 gcv = '__coverage__',
2469 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/contexts/context.js', statementMap: { '0': { start: { line: 3, column: 14 }, end: { line: 56, column: 3 } }, '1': { start: { line: 5, column: 4 }, end: { line: 5, column: 47 } }, '2': { start: { line: 8, column: 2 }, end: { line: 54, column: 6 } }, '3': { start: { line: 11, column: 6 }, end: { line: 11, column: 27 } }, '4': { start: { line: 12, column: 6 }, end: { line: 12, column: 28 } }, '5': { start: { line: 13, column: 6 }, end: { line: 13, column: 18 } }, '6': { start: { line: 18, column: 6 }, end: { line: 18, column: 26 } }, '7': { start: { line: 19, column: 6 }, end: { line: 19, column: 18 } }, '8': { start: { line: 24, column: 6 }, end: { line: 31, column: 7 } }, '9': { start: { line: 25, column: 8 }, end: { line: 25, column: 29 } }, '10': { start: { line: 27, column: 8 }, end: { line: 27, column: 25 } }, '11': { start: { line: 28, column: 8 }, end: { line: 30, column: 9 } }, '12': { start: { line: 29, column: 10 }, end: { line: 29, column: 31 } }, '13': { start: { line: 32, column: 6 }, end: { line: 32, column: 18 } }, '14': { start: { line: 37, column: 6 }, end: { line: 37, column: 26 } }, '15': { start: { line: 38, column: 6 }, end: { line: 40, column: 7 } }, '16': { start: { line: 39, column: 8 }, end: { line: 39, column: 31 } }, '17': { start: { line: 41, column: 6 }, end: { line: 41, column: 37 } }, '18': { start: { line: 42, column: 6 }, end: { line: 42, column: 52 } }, '19': { start: { line: 43, column: 6 }, end: { line: 50, column: 7 } }, '20': { start: { line: 44, column: 8 }, end: { line: 44, column: 32 } }, '21': { start: { line: 45, column: 8 }, end: { line: 45, column: 51 } }, '22': { start: { line: 46, column: 8 }, end: { line: 46, column: 26 } }, '23': { start: { line: 48, column: 8 }, end: { line: 48, column: 61 } }, '24': { start: { line: 49, column: 8 }, end: { line: 49, column: 34 } }, '25': { start: { line: 51, column: 6 }, end: { line: 51, column: 24 } }, '26': { start: { line: 52, column: 6 }, end: { line: 52, column: 18 } }, '27': { start: { line: 55, column: 2 }, end: { line: 55, column: 17 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 3, column: 14 }, end: { line: 3, column: 15 } }, loc: { start: { line: 3, column: 26 }, end: { line: 56, column: 1 } }, line: 3 }, '1': { name: 'Context', decl: { start: { line: 4, column: 11 }, end: { line: 4, column: 18 } }, loc: { start: { line: 4, column: 21 }, end: { line: 6, column: 3 } }, line: 4 }, '2': { name: 'setResult', decl: { start: { line: 10, column: 20 }, end: { line: 10, column: 29 } }, loc: { start: { line: 10, column: 38 }, end: { line: 14, column: 5 } }, line: 10 }, '3': { name: 'exit', decl: { start: { line: 17, column: 20 }, end: { line: 17, column: 24 } }, loc: { start: { line: 17, column: 27 }, end: { line: 20, column: 5 } }, line: 17 }, '4': { name: 'switchTo', decl: { start: { line: 23, column: 20 }, end: { line: 23, column: 28 } }, loc: { start: { line: 23, column: 41 }, end: { line: 33, column: 5 } }, line: 23 }, '5': { name: 'push', decl: { start: { line: 36, column: 20 }, end: { line: 36, column: 24 } }, loc: { start: { line: 36, column: 38 }, end: { line: 53, column: 5 } }, line: 36 } }, branchMap: { '0': { loc: { start: { line: 24, column: 6 }, end: { line: 31, column: 7 } }, type: 'if', locations: [{ start: { line: 24, column: 6 }, end: { line: 31, column: 7 } }, { start: { line: 24, column: 6 }, end: { line: 31, column: 7 } }], line: 24 }, '1': { loc: { start: { line: 24, column: 10 }, end: { line: 24, column: 58 } }, type: 'binary-expr', locations: [{ start: { line: 24, column: 10 }, end: { line: 24, column: 34 } }, { start: { line: 24, column: 38 }, end: { line: 24, column: 58 } }], line: 24 }, '2': { loc: { start: { line: 28, column: 8 }, end: { line: 30, column: 9 } }, type: 'if', locations: [{ start: { line: 28, column: 8 }, end: { line: 30, column: 9 } }, { start: { line: 28, column: 8 }, end: { line: 30, column: 9 } }], line: 28 }, '3': { loc: { start: { line: 38, column: 6 }, end: { line: 40, column: 7 } }, type: 'if', locations: [{ start: { line: 38, column: 6 }, end: { line: 40, column: 7 } }, { start: { line: 38, column: 6 }, end: { line: 40, column: 7 } }], line: 38 }, '4': { loc: { start: { line: 41, column: 19 }, end: { line: 41, column: 36 } }, type: 'binary-expr', locations: [{ start: { line: 41, column: 19 }, end: { line: 41, column: 28 } }, { start: { line: 41, column: 32 }, end: { line: 41, column: 36 } }], line: 41 }, '5': { loc: { start: { line: 42, column: 22 }, end: { line: 42, column: 51 } }, type: 'binary-expr', locations: [{ start: { line: 42, column: 22 }, end: { line: 42, column: 35 } }, { start: { line: 42, column: 39 }, end: { line: 42, column: 51 } }], line: 42 }, '6': { loc: { start: { line: 43, column: 6 }, end: { line: 50, column: 7 } }, type: 'if', locations: [{ start: { line: 43, column: 6 }, end: { line: 50, column: 7 } }, { start: { line: 43, column: 6 }, end: { line: 50, column: 7 } }], line: 43 }, '7': { loc: { start: { line: 45, column: 33 }, end: { line: 45, column: 50 } }, type: 'binary-expr', locations: [{ start: { line: 45, column: 33 }, end: { line: 45, column: 42 } }, { start: { line: 45, column: 46 }, end: { line: 45, column: 50 } }], line: 45 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2470 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2471 return coverage[path];
2472 }coverageData.hash = hash;return coverage[path] = coverageData;
2473}();var Context = (cov_15dz7p942d.s[0]++, function () {
2474 cov_15dz7p942d.f[0]++;function Context() {
2475 cov_15dz7p942d.f[1]++;cov_15dz7p942d.s[1]++;classCallCheck$1(this, Context);
2476 }cov_15dz7p942d.s[2]++;createClass$1(Context, [{ key: 'setResult', value: function setResult(result) {
2477 cov_15dz7p942d.f[2]++;cov_15dz7p942d.s[3]++;this.result = result;cov_15dz7p942d.s[4]++;this.hasResult = true;cov_15dz7p942d.s[5]++;return this;
2478 } }, { key: 'exit', value: function exit() {
2479 cov_15dz7p942d.f[3]++;cov_15dz7p942d.s[6]++;this.exiting = true;cov_15dz7p942d.s[7]++;return this;
2480 } }, { key: 'switchTo', value: function switchTo(next, pipe) {
2481 cov_15dz7p942d.f[4]++;cov_15dz7p942d.s[8]++;if ((cov_15dz7p942d.b[1][0]++, typeof next === 'string') || (cov_15dz7p942d.b[1][1]++, next instanceof Pipe)) {
2482 cov_15dz7p942d.b[0][0]++;cov_15dz7p942d.s[9]++;this.nextPipe = next;
2483 } else {
2484 cov_15dz7p942d.b[0][1]++;cov_15dz7p942d.s[10]++;this.next = next;cov_15dz7p942d.s[11]++;if (pipe) {
2485 cov_15dz7p942d.b[2][0]++;cov_15dz7p942d.s[12]++;this.nextPipe = pipe;
2486 } else {
2487 cov_15dz7p942d.b[2][1]++;
2488 }
2489 }cov_15dz7p942d.s[13]++;return this;
2490 } }, { key: 'push', value: function push(child, name) {
2491 cov_15dz7p942d.f[5]++;cov_15dz7p942d.s[14]++;child.parent = this;cov_15dz7p942d.s[15]++;if (typeof name !== 'undefined') {
2492 cov_15dz7p942d.b[3][0]++;cov_15dz7p942d.s[16]++;child.childName = name;
2493 } else {
2494 cov_15dz7p942d.b[3][1]++;
2495 }cov_15dz7p942d.s[17]++;child.root = (cov_15dz7p942d.b[4][0]++, this.root) || (cov_15dz7p942d.b[4][1]++, this);cov_15dz7p942d.s[18]++;child.options = (cov_15dz7p942d.b[5][0]++, child.options) || (cov_15dz7p942d.b[5][1]++, this.options);cov_15dz7p942d.s[19]++;if (!this.children) {
2496 cov_15dz7p942d.b[6][0]++;cov_15dz7p942d.s[20]++;this.children = [child];cov_15dz7p942d.s[21]++;this.nextAfterChildren = (cov_15dz7p942d.b[7][0]++, this.next) || (cov_15dz7p942d.b[7][1]++, null);cov_15dz7p942d.s[22]++;this.next = child;
2497 } else {
2498 cov_15dz7p942d.b[6][1]++;cov_15dz7p942d.s[23]++;this.children[this.children.length - 1].next = child;cov_15dz7p942d.s[24]++;this.children.push(child);
2499 }cov_15dz7p942d.s[25]++;child.next = this;cov_15dz7p942d.s[26]++;return this;
2500 } }]);cov_15dz7p942d.s[27]++;return Context;
2501}());
2502
2503var cov_2ces1qo8h1 = function () {
2504 var path = '/Users/benja/proj/jsondiffpatch/src/clone.js',
2505 hash = 'b42c839cc01fdbfba8802dced1ea6cd089d41859',
2506 global = new Function('return this')(),
2507 gcv = '__coverage__',
2508 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/clone.js', statementMap: { '0': { start: { line: 1, column: 14 }, end: { line: 3, column: 1 } }, '1': { start: { line: 2, column: 2 }, end: { line: 2, column: 28 } }, '2': { start: { line: 6, column: 19 }, end: { line: 6, column: 61 } }, '3': { start: { line: 7, column: 2 }, end: { line: 7, column: 50 } }, '4': { start: { line: 11, column: 2 }, end: { line: 13, column: 3 } }, '5': { start: { line: 12, column: 4 }, end: { line: 12, column: 15 } }, '6': { start: { line: 14, column: 2 }, end: { line: 16, column: 3 } }, '7': { start: { line: 15, column: 4 }, end: { line: 15, column: 16 } }, '8': { start: { line: 17, column: 2 }, end: { line: 19, column: 3 } }, '9': { start: { line: 18, column: 4 }, end: { line: 18, column: 26 } }, '10': { start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }, '11': { start: { line: 21, column: 4 }, end: { line: 21, column: 35 } }, '12': { start: { line: 23, column: 2 }, end: { line: 25, column: 3 } }, '13': { start: { line: 24, column: 4 }, end: { line: 24, column: 28 } }, '14': { start: { line: 26, column: 15 }, end: { line: 26, column: 17 } }, '15': { start: { line: 27, column: 2 }, end: { line: 31, column: 3 } }, '16': { start: { line: 28, column: 4 }, end: { line: 30, column: 5 } }, '17': { start: { line: 29, column: 6 }, end: { line: 29, column: 38 } }, '18': { start: { line: 32, column: 2 }, end: { line: 32, column: 16 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 1, column: 68 }, end: { line: 1, column: 69 } }, loc: { start: { line: 1, column: 81 }, end: { line: 3, column: 1 } }, line: 1 }, '1': { name: 'cloneRegExp', decl: { start: { line: 5, column: 9 }, end: { line: 5, column: 20 } }, loc: { start: { line: 5, column: 25 }, end: { line: 8, column: 1 } }, line: 5 }, '2': { name: 'clone', decl: { start: { line: 10, column: 24 }, end: { line: 10, column: 29 } }, loc: { start: { line: 10, column: 35 }, end: { line: 33, column: 1 } }, line: 10 } }, branchMap: { '0': { loc: { start: { line: 1, column: 14 }, end: { line: 3, column: 1 } }, type: 'cond-expr', locations: [{ start: { line: 1, column: 52 }, end: { line: 1, column: 65 } }, { start: { line: 1, column: 68 }, end: { line: 3, column: 1 } }], line: 1 }, '1': { loc: { start: { line: 11, column: 2 }, end: { line: 13, column: 3 } }, type: 'if', locations: [{ start: { line: 11, column: 2 }, end: { line: 13, column: 3 } }, { start: { line: 11, column: 2 }, end: { line: 13, column: 3 } }], line: 11 }, '2': { loc: { start: { line: 11, column: 7 }, end: { line: 11, column: 74 } }, type: 'cond-expr', locations: [{ start: { line: 11, column: 36 }, end: { line: 11, column: 47 } }, { start: { line: 11, column: 50 }, end: { line: 11, column: 74 } }], line: 11 }, '3': { loc: { start: { line: 14, column: 2 }, end: { line: 16, column: 3 } }, type: 'if', locations: [{ start: { line: 14, column: 2 }, end: { line: 16, column: 3 } }, { start: { line: 14, column: 2 }, end: { line: 16, column: 3 } }], line: 14 }, '4': { loc: { start: { line: 17, column: 2 }, end: { line: 19, column: 3 } }, type: 'if', locations: [{ start: { line: 17, column: 2 }, end: { line: 19, column: 3 } }, { start: { line: 17, column: 2 }, end: { line: 19, column: 3 } }], line: 17 }, '5': { loc: { start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }, type: 'if', locations: [{ start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }, { start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }], line: 20 }, '6': { loc: { start: { line: 23, column: 2 }, end: { line: 25, column: 3 } }, type: 'if', locations: [{ start: { line: 23, column: 2 }, end: { line: 25, column: 3 } }, { start: { line: 23, column: 2 }, end: { line: 25, column: 3 } }], line: 23 }, '7': { loc: { start: { line: 28, column: 4 }, end: { line: 30, column: 5 } }, type: 'if', locations: [{ start: { line: 28, column: 4 }, end: { line: 30, column: 5 } }, { start: { line: 28, column: 4 }, end: { line: 30, column: 5 } }], line: 28 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0 }, f: { '0': 0, '1': 0, '2': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2509 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2510 return coverage[path];
2511 }coverageData.hash = hash;return coverage[path] = coverageData;
2512}();var isArray = (cov_2ces1qo8h1.s[0]++, typeof Array.isArray === 'function' ? (cov_2ces1qo8h1.b[0][0]++, Array.isArray) : (cov_2ces1qo8h1.b[0][1]++, function (a) {
2513 cov_2ces1qo8h1.f[0]++;cov_2ces1qo8h1.s[1]++;return a instanceof Array;
2514}));function cloneRegExp(re) {
2515 cov_2ces1qo8h1.f[1]++;var regexMatch = (cov_2ces1qo8h1.s[2]++, /^\/(.*)\/([gimyu]*)$/.exec(re.toString()));cov_2ces1qo8h1.s[3]++;return new RegExp(regexMatch[1], regexMatch[2]);
2516}function clone(arg) {
2517 cov_2ces1qo8h1.f[2]++;cov_2ces1qo8h1.s[4]++;if ((typeof arg === 'undefined' ? (cov_2ces1qo8h1.b[2][0]++, 'undefined') : (cov_2ces1qo8h1.b[2][1]++, _typeof$1(arg))) !== 'object') {
2518 cov_2ces1qo8h1.b[1][0]++;cov_2ces1qo8h1.s[5]++;return arg;
2519 } else {
2520 cov_2ces1qo8h1.b[1][1]++;
2521 }cov_2ces1qo8h1.s[6]++;if (arg === null) {
2522 cov_2ces1qo8h1.b[3][0]++;cov_2ces1qo8h1.s[7]++;return null;
2523 } else {
2524 cov_2ces1qo8h1.b[3][1]++;
2525 }cov_2ces1qo8h1.s[8]++;if (isArray(arg)) {
2526 cov_2ces1qo8h1.b[4][0]++;cov_2ces1qo8h1.s[9]++;return arg.map(clone);
2527 } else {
2528 cov_2ces1qo8h1.b[4][1]++;
2529 }cov_2ces1qo8h1.s[10]++;if (arg instanceof Date) {
2530 cov_2ces1qo8h1.b[5][0]++;cov_2ces1qo8h1.s[11]++;return new Date(arg.getTime());
2531 } else {
2532 cov_2ces1qo8h1.b[5][1]++;
2533 }cov_2ces1qo8h1.s[12]++;if (arg instanceof RegExp) {
2534 cov_2ces1qo8h1.b[6][0]++;cov_2ces1qo8h1.s[13]++;return cloneRegExp(arg);
2535 } else {
2536 cov_2ces1qo8h1.b[6][1]++;
2537 }var cloned = (cov_2ces1qo8h1.s[14]++, {});cov_2ces1qo8h1.s[15]++;for (var name in arg) {
2538 cov_2ces1qo8h1.s[16]++;if (Object.prototype.hasOwnProperty.call(arg, name)) {
2539 cov_2ces1qo8h1.b[7][0]++;cov_2ces1qo8h1.s[17]++;cloned[name] = clone(arg[name]);
2540 } else {
2541 cov_2ces1qo8h1.b[7][1]++;
2542 }
2543 }cov_2ces1qo8h1.s[18]++;return cloned;
2544}
2545
2546var cov_16togqrbp8 = function () {
2547 var path = '/Users/benja/proj/jsondiffpatch/src/contexts/diff.js',
2548 hash = '90bb9cbdad306b0254c6caaccb0a396d5a9299a4',
2549 global = new Function('return this')(),
2550 gcv = '__coverage__',
2551 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/contexts/diff.js', statementMap: { '0': { start: { line: 4, column: 18 }, end: { line: 34, column: 10 } }, '1': { start: { line: 5, column: 2 }, end: { line: 5, column: 47 } }, '2': { start: { line: 8, column: 4 }, end: { line: 8, column: 51 } }, '3': { start: { line: 10, column: 16 }, end: { line: 10, column: 134 } }, '4': { start: { line: 12, column: 4 }, end: { line: 12, column: 22 } }, '5': { start: { line: 13, column: 4 }, end: { line: 13, column: 24 } }, '6': { start: { line: 14, column: 4 }, end: { line: 14, column: 24 } }, '7': { start: { line: 15, column: 4 }, end: { line: 15, column: 17 } }, '8': { start: { line: 18, column: 2 }, end: { line: 32, column: 6 } }, '9': { start: { line: 21, column: 6 }, end: { line: 29, column: 7 } }, '10': { start: { line: 22, column: 20 }, end: { line: 22, column: 116 } }, '11': { start: { line: 23, column: 8 }, end: { line: 25, column: 9 } }, '12': { start: { line: 24, column: 10 }, end: { line: 24, column: 39 } }, '13': { start: { line: 26, column: 8 }, end: { line: 28, column: 9 } }, '14': { start: { line: 27, column: 10 }, end: { line: 27, column: 39 } }, '15': { start: { line: 30, column: 6 }, end: { line: 30, column: 64 } }, '16': { start: { line: 33, column: 2 }, end: { line: 33, column: 21 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 4, column: 18 }, end: { line: 4, column: 19 } }, loc: { start: { line: 4, column: 38 }, end: { line: 34, column: 1 } }, line: 4 }, '1': { name: 'DiffContext', decl: { start: { line: 7, column: 11 }, end: { line: 7, column: 22 } }, loc: { start: { line: 7, column: 36 }, end: { line: 16, column: 3 } }, line: 7 }, '2': { name: 'setResult', decl: { start: { line: 20, column: 20 }, end: { line: 20, column: 29 } }, loc: { start: { line: 20, column: 38 }, end: { line: 31, column: 5 } }, line: 20 } }, branchMap: { '0': { loc: { start: { line: 10, column: 62 }, end: { line: 10, column: 121 } }, type: 'binary-expr', locations: [{ start: { line: 10, column: 62 }, end: { line: 10, column: 83 } }, { start: { line: 10, column: 87 }, end: { line: 10, column: 121 } }], line: 10 }, '1': { loc: { start: { line: 21, column: 6 }, end: { line: 29, column: 7 } }, type: 'if', locations: [{ start: { line: 21, column: 6 }, end: { line: 29, column: 7 } }, { start: { line: 21, column: 6 }, end: { line: 29, column: 7 } }], line: 21 }, '2': { loc: { start: { line: 21, column: 10 }, end: { line: 21, column: 130 } }, type: 'binary-expr', locations: [{ start: { line: 21, column: 10 }, end: { line: 21, column: 38 } }, { start: { line: 21, column: 42 }, end: { line: 21, column: 130 } }], line: 21 }, '3': { loc: { start: { line: 21, column: 43 }, end: { line: 21, column: 116 } }, type: 'cond-expr', locations: [{ start: { line: 21, column: 75 }, end: { line: 21, column: 86 } }, { start: { line: 21, column: 89 }, end: { line: 21, column: 116 } }], line: 21 }, '4': { loc: { start: { line: 22, column: 20 }, end: { line: 22, column: 116 } }, type: 'cond-expr', locations: [{ start: { line: 22, column: 73 }, end: { line: 22, column: 101 } }, { start: { line: 22, column: 104 }, end: { line: 22, column: 116 } }], line: 22 }, '5': { loc: { start: { line: 23, column: 8 }, end: { line: 25, column: 9 } }, type: 'if', locations: [{ start: { line: 23, column: 8 }, end: { line: 25, column: 9 } }, { start: { line: 23, column: 8 }, end: { line: 25, column: 9 } }], line: 23 }, '6': { loc: { start: { line: 26, column: 8 }, end: { line: 28, column: 9 } }, type: 'if', locations: [{ start: { line: 26, column: 8 }, end: { line: 28, column: 9 } }, { start: { line: 26, column: 8 }, end: { line: 28, column: 9 } }], line: 26 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0 }, f: { '0': 0, '1': 0, '2': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2552 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2553 return coverage[path];
2554 }coverageData.hash = hash;return coverage[path] = coverageData;
2555}();var DiffContext = (cov_16togqrbp8.s[0]++, function (_Context) {
2556 cov_16togqrbp8.f[0]++;cov_16togqrbp8.s[1]++;inherits$1(DiffContext, _Context);function DiffContext(left, right) {
2557 cov_16togqrbp8.f[1]++;cov_16togqrbp8.s[2]++;classCallCheck$1(this, DiffContext);var _this = (cov_16togqrbp8.s[3]++, possibleConstructorReturn$1(this, ((cov_16togqrbp8.b[0][0]++, DiffContext.__proto__) || (cov_16togqrbp8.b[0][1]++, Object.getPrototypeOf(DiffContext))).call(this)));cov_16togqrbp8.s[4]++;_this.left = left;cov_16togqrbp8.s[5]++;_this.right = right;cov_16togqrbp8.s[6]++;_this.pipe = 'diff';cov_16togqrbp8.s[7]++;return _this;
2558 }cov_16togqrbp8.s[8]++;createClass$1(DiffContext, [{ key: 'setResult', value: function setResult(result) {
2559 cov_16togqrbp8.f[2]++;cov_16togqrbp8.s[9]++;if ((cov_16togqrbp8.b[2][0]++, this.options.cloneDiffValues) && (cov_16togqrbp8.b[2][1]++, (typeof result === 'undefined' ? (cov_16togqrbp8.b[3][0]++, 'undefined') : (cov_16togqrbp8.b[3][1]++, _typeof$1(result))) === 'object')) {
2560 cov_16togqrbp8.b[1][0]++;var clone$$1 = (cov_16togqrbp8.s[10]++, typeof this.options.cloneDiffValues === 'function' ? (cov_16togqrbp8.b[4][0]++, this.options.cloneDiffValues) : (cov_16togqrbp8.b[4][1]++, clone));cov_16togqrbp8.s[11]++;if (_typeof$1(result[0]) === 'object') {
2561 cov_16togqrbp8.b[5][0]++;cov_16togqrbp8.s[12]++;result[0] = clone$$1(result[0]);
2562 } else {
2563 cov_16togqrbp8.b[5][1]++;
2564 }cov_16togqrbp8.s[13]++;if (_typeof$1(result[1]) === 'object') {
2565 cov_16togqrbp8.b[6][0]++;cov_16togqrbp8.s[14]++;result[1] = clone$$1(result[1]);
2566 } else {
2567 cov_16togqrbp8.b[6][1]++;
2568 }
2569 } else {
2570 cov_16togqrbp8.b[1][1]++;
2571 }cov_16togqrbp8.s[15]++;return Context.prototype.setResult.apply(this, arguments);
2572 } }]);cov_16togqrbp8.s[16]++;return DiffContext;
2573}(Context));
2574
2575var cov_1lch9qj04n = function () {
2576 var path = '/Users/benja/proj/jsondiffpatch/src/contexts/patch.js',
2577 hash = '60e4c19ac942f0d668ee8b1d8ccd4c42e2bbeee8',
2578 global = new Function('return this')(),
2579 gcv = '__coverage__',
2580 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/contexts/patch.js', statementMap: { '0': { start: { line: 3, column: 19 }, end: { line: 18, column: 10 } }, '1': { start: { line: 4, column: 2 }, end: { line: 4, column: 48 } }, '2': { start: { line: 7, column: 4 }, end: { line: 7, column: 52 } }, '3': { start: { line: 9, column: 16 }, end: { line: 9, column: 136 } }, '4': { start: { line: 11, column: 4 }, end: { line: 11, column: 22 } }, '5': { start: { line: 12, column: 4 }, end: { line: 12, column: 24 } }, '6': { start: { line: 13, column: 4 }, end: { line: 13, column: 25 } }, '7': { start: { line: 14, column: 4 }, end: { line: 14, column: 17 } }, '8': { start: { line: 17, column: 2 }, end: { line: 17, column: 22 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 3, column: 19 }, end: { line: 3, column: 20 } }, loc: { start: { line: 3, column: 39 }, end: { line: 18, column: 1 } }, line: 3 }, '1': { name: 'PatchContext', decl: { start: { line: 6, column: 11 }, end: { line: 6, column: 23 } }, loc: { start: { line: 6, column: 37 }, end: { line: 15, column: 3 } }, line: 6 } }, branchMap: { '0': { loc: { start: { line: 9, column: 62 }, end: { line: 9, column: 123 } }, type: 'binary-expr', locations: [{ start: { line: 9, column: 62 }, end: { line: 9, column: 84 } }, { start: { line: 9, column: 88 }, end: { line: 9, column: 123 } }], line: 9 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0 }, f: { '0': 0, '1': 0 }, b: { '0': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2581 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2582 return coverage[path];
2583 }coverageData.hash = hash;return coverage[path] = coverageData;
2584}();var PatchContext = (cov_1lch9qj04n.s[0]++, function (_Context) {
2585 cov_1lch9qj04n.f[0]++;cov_1lch9qj04n.s[1]++;inherits$1(PatchContext, _Context);function PatchContext(left, delta) {
2586 cov_1lch9qj04n.f[1]++;cov_1lch9qj04n.s[2]++;classCallCheck$1(this, PatchContext);var _this = (cov_1lch9qj04n.s[3]++, possibleConstructorReturn$1(this, ((cov_1lch9qj04n.b[0][0]++, PatchContext.__proto__) || (cov_1lch9qj04n.b[0][1]++, Object.getPrototypeOf(PatchContext))).call(this)));cov_1lch9qj04n.s[4]++;_this.left = left;cov_1lch9qj04n.s[5]++;_this.delta = delta;cov_1lch9qj04n.s[6]++;_this.pipe = 'patch';cov_1lch9qj04n.s[7]++;return _this;
2587 }cov_1lch9qj04n.s[8]++;return PatchContext;
2588}(Context));
2589
2590var cov_15hv6xp4jc = function () {
2591 var path = '/Users/benja/proj/jsondiffpatch/src/contexts/reverse.js',
2592 hash = 'e404bb01b76ce93560e185b5c0356e677942aae3',
2593 global = new Function('return this')(),
2594 gcv = '__coverage__',
2595 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/contexts/reverse.js', statementMap: { '0': { start: { line: 3, column: 21 }, end: { line: 17, column: 10 } }, '1': { start: { line: 4, column: 2 }, end: { line: 4, column: 50 } }, '2': { start: { line: 7, column: 4 }, end: { line: 7, column: 54 } }, '3': { start: { line: 9, column: 16 }, end: { line: 9, column: 140 } }, '4': { start: { line: 11, column: 4 }, end: { line: 11, column: 24 } }, '5': { start: { line: 12, column: 4 }, end: { line: 12, column: 27 } }, '6': { start: { line: 13, column: 4 }, end: { line: 13, column: 17 } }, '7': { start: { line: 16, column: 2 }, end: { line: 16, column: 24 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 3, column: 21 }, end: { line: 3, column: 22 } }, loc: { start: { line: 3, column: 41 }, end: { line: 17, column: 1 } }, line: 3 }, '1': { name: 'ReverseContext', decl: { start: { line: 6, column: 11 }, end: { line: 6, column: 25 } }, loc: { start: { line: 6, column: 33 }, end: { line: 14, column: 3 } }, line: 6 } }, branchMap: { '0': { loc: { start: { line: 9, column: 62 }, end: { line: 9, column: 127 } }, type: 'binary-expr', locations: [{ start: { line: 9, column: 62 }, end: { line: 9, column: 86 } }, { start: { line: 9, column: 90 }, end: { line: 9, column: 127 } }], line: 9 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0 }, f: { '0': 0, '1': 0 }, b: { '0': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2596 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2597 return coverage[path];
2598 }coverageData.hash = hash;return coverage[path] = coverageData;
2599}();var ReverseContext = (cov_15hv6xp4jc.s[0]++, function (_Context) {
2600 cov_15hv6xp4jc.f[0]++;cov_15hv6xp4jc.s[1]++;inherits$1(ReverseContext, _Context);function ReverseContext(delta) {
2601 cov_15hv6xp4jc.f[1]++;cov_15hv6xp4jc.s[2]++;classCallCheck$1(this, ReverseContext);var _this = (cov_15hv6xp4jc.s[3]++, possibleConstructorReturn$1(this, ((cov_15hv6xp4jc.b[0][0]++, ReverseContext.__proto__) || (cov_15hv6xp4jc.b[0][1]++, Object.getPrototypeOf(ReverseContext))).call(this)));cov_15hv6xp4jc.s[4]++;_this.delta = delta;cov_15hv6xp4jc.s[5]++;_this.pipe = 'reverse';cov_15hv6xp4jc.s[6]++;return _this;
2602 }cov_15hv6xp4jc.s[7]++;return ReverseContext;
2603}(Context));
2604
2605var cov_1c74kci15l = function () {
2606 var path = '/Users/benja/proj/jsondiffpatch/src/filters/trivial.js',
2607 hash = '98d37903597642b2333c51a70abec4329d29cfc3',
2608 global = new Function('return this')(),
2609 gcv = '__coverage__',
2610 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/filters/trivial.js', statementMap: { '0': { start: { line: 1, column: 14 }, end: { line: 3, column: 1 } }, '1': { start: { line: 2, column: 2 }, end: { line: 2, column: 28 } }, '2': { start: { line: 5, column: 24 }, end: { line: 52, column: 1 } }, '3': { start: { line: 6, column: 2 }, end: { line: 9, column: 3 } }, '4': { start: { line: 7, column: 4 }, end: { line: 7, column: 40 } }, '5': { start: { line: 8, column: 4 }, end: { line: 8, column: 11 } }, '6': { start: { line: 10, column: 2 }, end: { line: 16, column: 3 } }, '7': { start: { line: 11, column: 4 }, end: { line: 13, column: 5 } }, '8': { start: { line: 12, column: 6 }, end: { line: 12, column: 53 } }, '9': { start: { line: 14, column: 4 }, end: { line: 14, column: 46 } }, '10': { start: { line: 15, column: 4 }, end: { line: 15, column: 11 } }, '11': { start: { line: 17, column: 2 }, end: { line: 20, column: 3 } }, '12': { start: { line: 18, column: 4 }, end: { line: 18, column: 51 } }, '13': { start: { line: 19, column: 4 }, end: { line: 19, column: 11 } }, '14': { start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }, '15': { start: { line: 22, column: 4 }, end: { line: 22, column: 51 } }, '16': { start: { line: 24, column: 2 }, end: { line: 24, column: 88 } }, '17': { start: { line: 25, column: 2 }, end: { line: 25, column: 91 } }, '18': { start: { line: 26, column: 2 }, end: { line: 29, column: 3 } }, '19': { start: { line: 27, column: 4 }, end: { line: 27, column: 60 } }, '20': { start: { line: 28, column: 4 }, end: { line: 28, column: 11 } }, '21': { start: { line: 30, column: 2 }, end: { line: 33, column: 3 } }, '22': { start: { line: 31, column: 4 }, end: { line: 31, column: 60 } }, '23': { start: { line: 32, column: 4 }, end: { line: 32, column: 11 } }, '24': { start: { line: 34, column: 2 }, end: { line: 36, column: 3 } }, '25': { start: { line: 35, column: 4 }, end: { line: 35, column: 48 } }, '26': { start: { line: 37, column: 2 }, end: { line: 39, column: 3 } }, '27': { start: { line: 38, column: 4 }, end: { line: 38, column: 50 } }, '28': { start: { line: 40, column: 2 }, end: { line: 43, column: 3 } }, '29': { start: { line: 41, column: 4 }, end: { line: 41, column: 60 } }, '30': { start: { line: 42, column: 4 }, end: { line: 42, column: 11 } }, '31': { start: { line: 45, column: 2 }, end: { line: 51, column: 3 } }, '32': { start: { line: 46, column: 4 }, end: { line: 50, column: 5 } }, '33': { start: { line: 47, column: 6 }, end: { line: 47, column: 84 } }, '34': { start: { line: 49, column: 6 }, end: { line: 49, column: 62 } }, '35': { start: { line: 53, column: 0 }, end: { line: 53, column: 34 } }, '36': { start: { line: 55, column: 25 }, end: { line: 82, column: 1 } }, '37': { start: { line: 56, column: 2 }, end: { line: 59, column: 3 } }, '38': { start: { line: 57, column: 4 }, end: { line: 57, column: 43 } }, '39': { start: { line: 58, column: 4 }, end: { line: 58, column: 11 } }, '40': { start: { line: 60, column: 2 }, end: { line: 60, column: 43 } }, '41': { start: { line: 61, column: 2 }, end: { line: 63, column: 3 } }, '42': { start: { line: 62, column: 4 }, end: { line: 62, column: 11 } }, '43': { start: { line: 64, column: 2 }, end: { line: 67, column: 3 } }, '44': { start: { line: 65, column: 4 }, end: { line: 65, column: 47 } }, '45': { start: { line: 66, column: 4 }, end: { line: 66, column: 11 } }, '46': { start: { line: 68, column: 2 }, end: { line: 78, column: 3 } }, '47': { start: { line: 69, column: 4 }, end: { line: 75, column: 5 } }, '48': { start: { line: 70, column: 22 }, end: { line: 70, column: 67 } }, '49': { start: { line: 71, column: 6 }, end: { line: 74, column: 7 } }, '50': { start: { line: 72, column: 8 }, end: { line: 72, column: 73 } }, '51': { start: { line: 73, column: 8 }, end: { line: 73, column: 15 } }, '52': { start: { line: 76, column: 4 }, end: { line: 76, column: 47 } }, '53': { start: { line: 77, column: 4 }, end: { line: 77, column: 11 } }, '54': { start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }, '55': { start: { line: 80, column: 4 }, end: { line: 80, column: 40 } }, '56': { start: { line: 83, column: 0 }, end: { line: 83, column: 35 } }, '57': { start: { line: 85, column: 27 }, end: { line: 105, column: 1 } }, '58': { start: { line: 86, column: 2 }, end: { line: 89, column: 3 } }, '59': { start: { line: 87, column: 4 }, end: { line: 87, column: 44 } }, '60': { start: { line: 88, column: 4 }, end: { line: 88, column: 11 } }, '61': { start: { line: 90, column: 2 }, end: { line: 90, column: 43 } }, '62': { start: { line: 91, column: 2 }, end: { line: 93, column: 3 } }, '63': { start: { line: 92, column: 4 }, end: { line: 92, column: 11 } }, '64': { start: { line: 94, column: 2 }, end: { line: 97, column: 3 } }, '65': { start: { line: 95, column: 4 }, end: { line: 95, column: 55 } }, '66': { start: { line: 96, column: 4 }, end: { line: 96, column: 11 } }, '67': { start: { line: 98, column: 2 }, end: { line: 101, column: 3 } }, '68': { start: { line: 99, column: 4 }, end: { line: 99, column: 67 } }, '69': { start: { line: 100, column: 4 }, end: { line: 100, column: 11 } }, '70': { start: { line: 102, column: 2 }, end: { line: 104, column: 3 } }, '71': { start: { line: 103, column: 4 }, end: { line: 103, column: 49 } }, '72': { start: { line: 106, column: 0 }, end: { line: 106, column: 37 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 1, column: 68 }, end: { line: 1, column: 69 } }, loc: { start: { line: 1, column: 81 }, end: { line: 3, column: 1 } }, line: 1 }, '1': { name: 'trivialMatchesDiffFilter', decl: { start: { line: 5, column: 33 }, end: { line: 5, column: 57 } }, loc: { start: { line: 5, column: 67 }, end: { line: 52, column: 1 } }, line: 5 }, '2': { name: 'trivialMatchesPatchFilter', decl: { start: { line: 55, column: 34 }, end: { line: 55, column: 59 } }, loc: { start: { line: 55, column: 69 }, end: { line: 82, column: 1 } }, line: 55 }, '3': { name: 'trivialReferseFilter', decl: { start: { line: 85, column: 36 }, end: { line: 85, column: 56 } }, loc: { start: { line: 85, column: 66 }, end: { line: 105, column: 1 } }, line: 85 } }, branchMap: { '0': { loc: { start: { line: 1, column: 14 }, end: { line: 3, column: 1 } }, type: 'cond-expr', locations: [{ start: { line: 1, column: 52 }, end: { line: 1, column: 65 } }, { start: { line: 1, column: 68 }, end: { line: 3, column: 1 } }], line: 1 }, '1': { loc: { start: { line: 6, column: 2 }, end: { line: 9, column: 3 } }, type: 'if', locations: [{ start: { line: 6, column: 2 }, end: { line: 9, column: 3 } }, { start: { line: 6, column: 2 }, end: { line: 9, column: 3 } }], line: 6 }, '2': { loc: { start: { line: 10, column: 2 }, end: { line: 16, column: 3 } }, type: 'if', locations: [{ start: { line: 10, column: 2 }, end: { line: 16, column: 3 } }, { start: { line: 10, column: 2 }, end: { line: 16, column: 3 } }], line: 10 }, '3': { loc: { start: { line: 11, column: 4 }, end: { line: 13, column: 5 } }, type: 'if', locations: [{ start: { line: 11, column: 4 }, end: { line: 13, column: 5 } }, { start: { line: 11, column: 4 }, end: { line: 13, column: 5 } }], line: 11 }, '4': { loc: { start: { line: 17, column: 2 }, end: { line: 20, column: 3 } }, type: 'if', locations: [{ start: { line: 17, column: 2 }, end: { line: 20, column: 3 } }, { start: { line: 17, column: 2 }, end: { line: 20, column: 3 } }], line: 17 }, '5': { loc: { start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }, type: 'if', locations: [{ start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }, { start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }], line: 21 }, '6': { loc: { start: { line: 21, column: 6 }, end: { line: 21, column: 79 } }, type: 'binary-expr', locations: [{ start: { line: 21, column: 6 }, end: { line: 21, column: 40 } }, { start: { line: 21, column: 44 }, end: { line: 21, column: 79 } }], line: 21 }, '7': { loc: { start: { line: 24, column: 21 }, end: { line: 24, column: 87 } }, type: 'cond-expr', locations: [{ start: { line: 24, column: 45 }, end: { line: 24, column: 51 } }, { start: { line: 24, column: 54 }, end: { line: 24, column: 87 } }], line: 24 }, '8': { loc: { start: { line: 25, column: 22 }, end: { line: 25, column: 90 } }, type: 'cond-expr', locations: [{ start: { line: 25, column: 47 }, end: { line: 25, column: 53 } }, { start: { line: 25, column: 56 }, end: { line: 25, column: 90 } }], line: 25 }, '9': { loc: { start: { line: 26, column: 2 }, end: { line: 29, column: 3 } }, type: 'if', locations: [{ start: { line: 26, column: 2 }, end: { line: 29, column: 3 } }, { start: { line: 26, column: 2 }, end: { line: 29, column: 3 } }], line: 26 }, '10': { loc: { start: { line: 30, column: 2 }, end: { line: 33, column: 3 } }, type: 'if', locations: [{ start: { line: 30, column: 2 }, end: { line: 33, column: 3 } }, { start: { line: 30, column: 2 }, end: { line: 33, column: 3 } }], line: 30 }, '11': { loc: { start: { line: 30, column: 6 }, end: { line: 30, column: 69 } }, type: 'binary-expr', locations: [{ start: { line: 30, column: 6 }, end: { line: 30, column: 36 } }, { start: { line: 30, column: 40 }, end: { line: 30, column: 69 } }], line: 30 }, '12': { loc: { start: { line: 34, column: 2 }, end: { line: 36, column: 3 } }, type: 'if', locations: [{ start: { line: 34, column: 2 }, end: { line: 36, column: 3 } }, { start: { line: 34, column: 2 }, end: { line: 36, column: 3 } }], line: 34 }, '13': { loc: { start: { line: 37, column: 2 }, end: { line: 39, column: 3 } }, type: 'if', locations: [{ start: { line: 37, column: 2 }, end: { line: 39, column: 3 } }, { start: { line: 37, column: 2 }, end: { line: 39, column: 3 } }], line: 37 }, '14': { loc: { start: { line: 40, column: 2 }, end: { line: 43, column: 3 } }, type: 'if', locations: [{ start: { line: 40, column: 2 }, end: { line: 43, column: 3 } }, { start: { line: 40, column: 2 }, end: { line: 43, column: 3 } }], line: 40 }, '15': { loc: { start: { line: 45, column: 2 }, end: { line: 51, column: 3 } }, type: 'if', locations: [{ start: { line: 45, column: 2 }, end: { line: 51, column: 3 } }, { start: { line: 45, column: 2 }, end: { line: 51, column: 3 } }], line: 45 }, '16': { loc: { start: { line: 46, column: 4 }, end: { line: 50, column: 5 } }, type: 'if', locations: [{ start: { line: 46, column: 4 }, end: { line: 50, column: 5 } }, { start: { line: 46, column: 4 }, end: { line: 50, column: 5 } }], line: 46 }, '17': { loc: { start: { line: 56, column: 2 }, end: { line: 59, column: 3 } }, type: 'if', locations: [{ start: { line: 56, column: 2 }, end: { line: 59, column: 3 } }, { start: { line: 56, column: 2 }, end: { line: 59, column: 3 } }], line: 56 }, '18': { loc: { start: { line: 61, column: 2 }, end: { line: 63, column: 3 } }, type: 'if', locations: [{ start: { line: 61, column: 2 }, end: { line: 63, column: 3 } }, { start: { line: 61, column: 2 }, end: { line: 63, column: 3 } }], line: 61 }, '19': { loc: { start: { line: 64, column: 2 }, end: { line: 67, column: 3 } }, type: 'if', locations: [{ start: { line: 64, column: 2 }, end: { line: 67, column: 3 } }, { start: { line: 64, column: 2 }, end: { line: 67, column: 3 } }], line: 64 }, '20': { loc: { start: { line: 68, column: 2 }, end: { line: 78, column: 3 } }, type: 'if', locations: [{ start: { line: 68, column: 2 }, end: { line: 78, column: 3 } }, { start: { line: 68, column: 2 }, end: { line: 78, column: 3 } }], line: 68 }, '21': { loc: { start: { line: 69, column: 4 }, end: { line: 75, column: 5 } }, type: 'if', locations: [{ start: { line: 69, column: 4 }, end: { line: 75, column: 5 } }, { start: { line: 69, column: 4 }, end: { line: 75, column: 5 } }], line: 69 }, '22': { loc: { start: { line: 71, column: 6 }, end: { line: 74, column: 7 } }, type: 'if', locations: [{ start: { line: 71, column: 6 }, end: { line: 74, column: 7 } }, { start: { line: 71, column: 6 }, end: { line: 74, column: 7 } }], line: 71 }, '23': { loc: { start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }, type: 'if', locations: [{ start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }, { start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }], line: 79 }, '24': { loc: { start: { line: 79, column: 6 }, end: { line: 79, column: 58 } }, type: 'binary-expr', locations: [{ start: { line: 79, column: 6 }, end: { line: 79, column: 32 } }, { start: { line: 79, column: 36 }, end: { line: 79, column: 58 } }], line: 79 }, '25': { loc: { start: { line: 86, column: 2 }, end: { line: 89, column: 3 } }, type: 'if', locations: [{ start: { line: 86, column: 2 }, end: { line: 89, column: 3 } }, { start: { line: 86, column: 2 }, end: { line: 89, column: 3 } }], line: 86 }, '26': { loc: { start: { line: 91, column: 2 }, end: { line: 93, column: 3 } }, type: 'if', locations: [{ start: { line: 91, column: 2 }, end: { line: 93, column: 3 } }, { start: { line: 91, column: 2 }, end: { line: 93, column: 3 } }], line: 91 }, '27': { loc: { start: { line: 94, column: 2 }, end: { line: 97, column: 3 } }, type: 'if', locations: [{ start: { line: 94, column: 2 }, end: { line: 97, column: 3 } }, { start: { line: 94, column: 2 }, end: { line: 97, column: 3 } }], line: 94 }, '28': { loc: { start: { line: 98, column: 2 }, end: { line: 101, column: 3 } }, type: 'if', locations: [{ start: { line: 98, column: 2 }, end: { line: 101, column: 3 } }, { start: { line: 98, column: 2 }, end: { line: 101, column: 3 } }], line: 98 }, '29': { loc: { start: { line: 102, column: 2 }, end: { line: 104, column: 3 } }, type: 'if', locations: [{ start: { line: 102, column: 2 }, end: { line: 104, column: 3 } }, { start: { line: 102, column: 2 }, end: { line: 104, column: 3 } }], line: 102 }, '30': { loc: { start: { line: 102, column: 6 }, end: { line: 102, column: 58 } }, type: 'binary-expr', locations: [{ start: { line: 102, column: 6 }, end: { line: 102, column: 32 } }, { start: { line: 102, column: 36 }, end: { line: 102, column: 58 } }], line: 102 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0], '20': [0, 0], '21': [0, 0], '22': [0, 0], '23': [0, 0], '24': [0, 0], '25': [0, 0], '26': [0, 0], '27': [0, 0], '28': [0, 0], '29': [0, 0], '30': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2611 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2612 return coverage[path];
2613 }coverageData.hash = hash;return coverage[path] = coverageData;
2614}();var isArray$1 = (cov_1c74kci15l.s[0]++, typeof Array.isArray === 'function' ? (cov_1c74kci15l.b[0][0]++, Array.isArray) : (cov_1c74kci15l.b[0][1]++, function (a) {
2615 cov_1c74kci15l.f[0]++;cov_1c74kci15l.s[1]++;return a instanceof Array;
2616}));cov_1c74kci15l.s[2]++;var diffFilter = function trivialMatchesDiffFilter(context) {
2617 cov_1c74kci15l.f[1]++;cov_1c74kci15l.s[3]++;if (context.left === context.right) {
2618 cov_1c74kci15l.b[1][0]++;cov_1c74kci15l.s[4]++;context.setResult(undefined).exit();cov_1c74kci15l.s[5]++;return;
2619 } else {
2620 cov_1c74kci15l.b[1][1]++;
2621 }cov_1c74kci15l.s[6]++;if (typeof context.left === 'undefined') {
2622 cov_1c74kci15l.b[2][0]++;cov_1c74kci15l.s[7]++;if (typeof context.right === 'function') {
2623 cov_1c74kci15l.b[3][0]++;cov_1c74kci15l.s[8]++;throw new Error('functions are not supported');
2624 } else {
2625 cov_1c74kci15l.b[3][1]++;
2626 }cov_1c74kci15l.s[9]++;context.setResult([context.right]).exit();cov_1c74kci15l.s[10]++;return;
2627 } else {
2628 cov_1c74kci15l.b[2][1]++;
2629 }cov_1c74kci15l.s[11]++;if (typeof context.right === 'undefined') {
2630 cov_1c74kci15l.b[4][0]++;cov_1c74kci15l.s[12]++;context.setResult([context.left, 0, 0]).exit();cov_1c74kci15l.s[13]++;return;
2631 } else {
2632 cov_1c74kci15l.b[4][1]++;
2633 }cov_1c74kci15l.s[14]++;if ((cov_1c74kci15l.b[6][0]++, typeof context.left === 'function') || (cov_1c74kci15l.b[6][1]++, typeof context.right === 'function')) {
2634 cov_1c74kci15l.b[5][0]++;cov_1c74kci15l.s[15]++;throw new Error('functions are not supported');
2635 } else {
2636 cov_1c74kci15l.b[5][1]++;
2637 }cov_1c74kci15l.s[16]++;context.leftType = context.left === null ? (cov_1c74kci15l.b[7][0]++, 'null') : (cov_1c74kci15l.b[7][1]++, _typeof$1(context.left));cov_1c74kci15l.s[17]++;context.rightType = context.right === null ? (cov_1c74kci15l.b[8][0]++, 'null') : (cov_1c74kci15l.b[8][1]++, _typeof$1(context.right));cov_1c74kci15l.s[18]++;if (context.leftType !== context.rightType) {
2638 cov_1c74kci15l.b[9][0]++;cov_1c74kci15l.s[19]++;context.setResult([context.left, context.right]).exit();cov_1c74kci15l.s[20]++;return;
2639 } else {
2640 cov_1c74kci15l.b[9][1]++;
2641 }cov_1c74kci15l.s[21]++;if ((cov_1c74kci15l.b[11][0]++, context.leftType === 'boolean') || (cov_1c74kci15l.b[11][1]++, context.leftType === 'number')) {
2642 cov_1c74kci15l.b[10][0]++;cov_1c74kci15l.s[22]++;context.setResult([context.left, context.right]).exit();cov_1c74kci15l.s[23]++;return;
2643 } else {
2644 cov_1c74kci15l.b[10][1]++;
2645 }cov_1c74kci15l.s[24]++;if (context.leftType === 'object') {
2646 cov_1c74kci15l.b[12][0]++;cov_1c74kci15l.s[25]++;context.leftIsArray = isArray$1(context.left);
2647 } else {
2648 cov_1c74kci15l.b[12][1]++;
2649 }cov_1c74kci15l.s[26]++;if (context.rightType === 'object') {
2650 cov_1c74kci15l.b[13][0]++;cov_1c74kci15l.s[27]++;context.rightIsArray = isArray$1(context.right);
2651 } else {
2652 cov_1c74kci15l.b[13][1]++;
2653 }cov_1c74kci15l.s[28]++;if (context.leftIsArray !== context.rightIsArray) {
2654 cov_1c74kci15l.b[14][0]++;cov_1c74kci15l.s[29]++;context.setResult([context.left, context.right]).exit();cov_1c74kci15l.s[30]++;return;
2655 } else {
2656 cov_1c74kci15l.b[14][1]++;
2657 }cov_1c74kci15l.s[31]++;if (context.left instanceof RegExp) {
2658 cov_1c74kci15l.b[15][0]++;cov_1c74kci15l.s[32]++;if (context.right instanceof RegExp) {
2659 cov_1c74kci15l.b[16][0]++;cov_1c74kci15l.s[33]++;context.setResult([context.left.toString(), context.right.toString()]).exit();
2660 } else {
2661 cov_1c74kci15l.b[16][1]++;cov_1c74kci15l.s[34]++;context.setResult([context.left, context.right]).exit();
2662 }
2663 } else {
2664 cov_1c74kci15l.b[15][1]++;
2665 }
2666};cov_1c74kci15l.s[35]++;diffFilter.filterName = 'trivial';cov_1c74kci15l.s[36]++;var patchFilter = function trivialMatchesPatchFilter(context) {
2667 cov_1c74kci15l.f[2]++;cov_1c74kci15l.s[37]++;if (typeof context.delta === 'undefined') {
2668 cov_1c74kci15l.b[17][0]++;cov_1c74kci15l.s[38]++;context.setResult(context.left).exit();cov_1c74kci15l.s[39]++;return;
2669 } else {
2670 cov_1c74kci15l.b[17][1]++;
2671 }cov_1c74kci15l.s[40]++;context.nested = !isArray$1(context.delta);cov_1c74kci15l.s[41]++;if (context.nested) {
2672 cov_1c74kci15l.b[18][0]++;cov_1c74kci15l.s[42]++;return;
2673 } else {
2674 cov_1c74kci15l.b[18][1]++;
2675 }cov_1c74kci15l.s[43]++;if (context.delta.length === 1) {
2676 cov_1c74kci15l.b[19][0]++;cov_1c74kci15l.s[44]++;context.setResult(context.delta[0]).exit();cov_1c74kci15l.s[45]++;return;
2677 } else {
2678 cov_1c74kci15l.b[19][1]++;
2679 }cov_1c74kci15l.s[46]++;if (context.delta.length === 2) {
2680 cov_1c74kci15l.b[20][0]++;cov_1c74kci15l.s[47]++;if (context.left instanceof RegExp) {
2681 cov_1c74kci15l.b[21][0]++;var regexArgs = (cov_1c74kci15l.s[48]++, /^\/(.*)\/([gimyu]+)$/.exec(context.delta[1]));cov_1c74kci15l.s[49]++;if (regexArgs) {
2682 cov_1c74kci15l.b[22][0]++;cov_1c74kci15l.s[50]++;context.setResult(new RegExp(regexArgs[1], regexArgs[2])).exit();cov_1c74kci15l.s[51]++;return;
2683 } else {
2684 cov_1c74kci15l.b[22][1]++;
2685 }
2686 } else {
2687 cov_1c74kci15l.b[21][1]++;
2688 }cov_1c74kci15l.s[52]++;context.setResult(context.delta[1]).exit();cov_1c74kci15l.s[53]++;return;
2689 } else {
2690 cov_1c74kci15l.b[20][1]++;
2691 }cov_1c74kci15l.s[54]++;if ((cov_1c74kci15l.b[24][0]++, context.delta.length === 3) && (cov_1c74kci15l.b[24][1]++, context.delta[2] === 0)) {
2692 cov_1c74kci15l.b[23][0]++;cov_1c74kci15l.s[55]++;context.setResult(undefined).exit();
2693 } else {
2694 cov_1c74kci15l.b[23][1]++;
2695 }
2696};cov_1c74kci15l.s[56]++;patchFilter.filterName = 'trivial';cov_1c74kci15l.s[57]++;var reverseFilter = function trivialReferseFilter(context) {
2697 cov_1c74kci15l.f[3]++;cov_1c74kci15l.s[58]++;if (typeof context.delta === 'undefined') {
2698 cov_1c74kci15l.b[25][0]++;cov_1c74kci15l.s[59]++;context.setResult(context.delta).exit();cov_1c74kci15l.s[60]++;return;
2699 } else {
2700 cov_1c74kci15l.b[25][1]++;
2701 }cov_1c74kci15l.s[61]++;context.nested = !isArray$1(context.delta);cov_1c74kci15l.s[62]++;if (context.nested) {
2702 cov_1c74kci15l.b[26][0]++;cov_1c74kci15l.s[63]++;return;
2703 } else {
2704 cov_1c74kci15l.b[26][1]++;
2705 }cov_1c74kci15l.s[64]++;if (context.delta.length === 1) {
2706 cov_1c74kci15l.b[27][0]++;cov_1c74kci15l.s[65]++;context.setResult([context.delta[0], 0, 0]).exit();cov_1c74kci15l.s[66]++;return;
2707 } else {
2708 cov_1c74kci15l.b[27][1]++;
2709 }cov_1c74kci15l.s[67]++;if (context.delta.length === 2) {
2710 cov_1c74kci15l.b[28][0]++;cov_1c74kci15l.s[68]++;context.setResult([context.delta[1], context.delta[0]]).exit();cov_1c74kci15l.s[69]++;return;
2711 } else {
2712 cov_1c74kci15l.b[28][1]++;
2713 }cov_1c74kci15l.s[70]++;if ((cov_1c74kci15l.b[30][0]++, context.delta.length === 3) && (cov_1c74kci15l.b[30][1]++, context.delta[2] === 0)) {
2714 cov_1c74kci15l.b[29][0]++;cov_1c74kci15l.s[71]++;context.setResult([context.delta[0]]).exit();
2715 } else {
2716 cov_1c74kci15l.b[29][1]++;
2717 }
2718};cov_1c74kci15l.s[72]++;reverseFilter.filterName = 'trivial';
2719
2720var cov_14lky13xfg = function () {
2721 var path = '/Users/benja/proj/jsondiffpatch/src/filters/nested.js',
2722 hash = 'eb2d12068ad3836a566899c7905a81f33404efa3',
2723 global = new Function('return this')(),
2724 gcv = '__coverage__',
2725 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/filters/nested.js', statementMap: { '0': { start: { line: 6, column: 2 }, end: { line: 8, column: 3 } }, '1': { start: { line: 7, column: 4 }, end: { line: 7, column: 11 } }, '2': { start: { line: 9, column: 15 }, end: { line: 9, column: 38 } }, '3': { start: { line: 10, column: 14 }, end: { line: 10, column: 20 } }, '4': { start: { line: 11, column: 15 }, end: { line: 11, column: 29 } }, '5': { start: { line: 12, column: 2 }, end: { line: 19, column: 3 } }, '6': { start: { line: 13, column: 4 }, end: { line: 13, column: 36 } }, '7': { start: { line: 14, column: 4 }, end: { line: 16, column: 5 } }, '8': { start: { line: 15, column: 6 }, end: { line: 15, column: 15 } }, '9': { start: { line: 17, column: 4 }, end: { line: 17, column: 26 } }, '10': { start: { line: 18, column: 4 }, end: { line: 18, column: 43 } }, '11': { start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }, '12': { start: { line: 21, column: 4 }, end: { line: 21, column: 20 } }, '13': { start: { line: 23, column: 2 }, end: { line: 23, column: 35 } }, '14': { start: { line: 25, column: 0 }, end: { line: 25, column: 57 } }, '15': { start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }, '16': { start: { line: 29, column: 4 }, end: { line: 29, column: 11 } }, '17': { start: { line: 32, column: 13 }, end: { line: 32, column: 19 } }, '18': { start: { line: 33, column: 14 }, end: { line: 33, column: 20 } }, '19': { start: { line: 34, column: 23 }, end: { line: 34, column: 53 } }, '20': { start: { line: 35, column: 2 }, end: { line: 44, column: 3 } }, '21': { start: { line: 36, column: 4 }, end: { line: 38, column: 5 } }, '22': { start: { line: 37, column: 6 }, end: { line: 37, column: 15 } }, '23': { start: { line: 39, column: 4 }, end: { line: 41, column: 5 } }, '24': { start: { line: 40, column: 6 }, end: { line: 40, column: 15 } }, '25': { start: { line: 42, column: 4 }, end: { line: 42, column: 69 } }, '26': { start: { line: 43, column: 4 }, end: { line: 43, column: 30 } }, '27': { start: { line: 45, column: 2 }, end: { line: 56, column: 3 } }, '28': { start: { line: 46, column: 4 }, end: { line: 48, column: 5 } }, '29': { start: { line: 47, column: 6 }, end: { line: 47, column: 15 } }, '30': { start: { line: 49, column: 4 }, end: { line: 51, column: 5 } }, '31': { start: { line: 50, column: 6 }, end: { line: 50, column: 15 } }, '32': { start: { line: 52, column: 4 }, end: { line: 55, column: 5 } }, '33': { start: { line: 53, column: 6 }, end: { line: 53, column: 62 } }, '34': { start: { line: 54, column: 6 }, end: { line: 54, column: 32 } }, '35': { start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }, '36': { start: { line: 59, column: 4 }, end: { line: 59, column: 40 } }, '37': { start: { line: 60, column: 4 }, end: { line: 60, column: 11 } }, '38': { start: { line: 62, column: 2 }, end: { line: 62, column: 17 } }, '39': { start: { line: 64, column: 0 }, end: { line: 64, column: 41 } }, '40': { start: { line: 66, column: 25 }, end: { line: 80, column: 1 } }, '41': { start: { line: 67, column: 2 }, end: { line: 69, column: 3 } }, '42': { start: { line: 68, column: 4 }, end: { line: 68, column: 11 } }, '43': { start: { line: 70, column: 2 }, end: { line: 72, column: 3 } }, '44': { start: { line: 71, column: 4 }, end: { line: 71, column: 11 } }, '45': { start: { line: 73, column: 13 }, end: { line: 73, column: 19 } }, '46': { start: { line: 74, column: 14 }, end: { line: 74, column: 20 } }, '47': { start: { line: 75, column: 2 }, end: { line: 78, column: 3 } }, '48': { start: { line: 76, column: 4 }, end: { line: 76, column: 70 } }, '49': { start: { line: 77, column: 4 }, end: { line: 77, column: 30 } }, '50': { start: { line: 79, column: 2 }, end: { line: 79, column: 17 } }, '51': { start: { line: 81, column: 0 }, end: { line: 81, column: 35 } }, '52': { start: { line: 83, column: 40 }, end: { line: 101, column: 1 } }, '53': { start: { line: 84, column: 2 }, end: { line: 86, column: 3 } }, '54': { start: { line: 85, column: 4 }, end: { line: 85, column: 11 } }, '55': { start: { line: 87, column: 2 }, end: { line: 89, column: 3 } }, '56': { start: { line: 88, column: 4 }, end: { line: 88, column: 11 } }, '57': { start: { line: 90, column: 15 }, end: { line: 90, column: 38 } }, '58': { start: { line: 91, column: 14 }, end: { line: 91, column: 20 } }, '59': { start: { line: 92, column: 2 }, end: { line: 99, column: 3 } }, '60': { start: { line: 93, column: 4 }, end: { line: 93, column: 36 } }, '61': { start: { line: 94, column: 4 }, end: { line: 98, column: 5 } }, '62': { start: { line: 95, column: 6 }, end: { line: 95, column: 43 } }, '63': { start: { line: 96, column: 11 }, end: { line: 98, column: 5 } }, '64': { start: { line: 97, column: 6 }, end: { line: 97, column: 51 } }, '65': { start: { line: 100, column: 2 }, end: { line: 100, column: 41 } }, '66': { start: { line: 102, column: 0 }, end: { line: 102, column: 58 } }, '67': { start: { line: 104, column: 27 }, end: { line: 118, column: 1 } }, '68': { start: { line: 105, column: 2 }, end: { line: 107, column: 3 } }, '69': { start: { line: 106, column: 4 }, end: { line: 106, column: 11 } }, '70': { start: { line: 108, column: 2 }, end: { line: 110, column: 3 } }, '71': { start: { line: 109, column: 4 }, end: { line: 109, column: 11 } }, '72': { start: { line: 111, column: 13 }, end: { line: 111, column: 19 } }, '73': { start: { line: 112, column: 14 }, end: { line: 112, column: 20 } }, '74': { start: { line: 113, column: 2 }, end: { line: 116, column: 3 } }, '75': { start: { line: 114, column: 4 }, end: { line: 114, column: 52 } }, '76': { start: { line: 115, column: 4 }, end: { line: 115, column: 30 } }, '77': { start: { line: 117, column: 2 }, end: { line: 117, column: 17 } }, '78': { start: { line: 119, column: 0 }, end: { line: 119, column: 37 } }, '79': { start: { line: 122, column: 2 }, end: { line: 124, column: 3 } }, '80': { start: { line: 123, column: 4 }, end: { line: 123, column: 11 } }, '81': { start: { line: 125, column: 2 }, end: { line: 127, column: 3 } }, '82': { start: { line: 126, column: 4 }, end: { line: 126, column: 11 } }, '83': { start: { line: 128, column: 15 }, end: { line: 128, column: 38 } }, '84': { start: { line: 129, column: 14 }, end: { line: 129, column: 20 } }, '85': { start: { line: 130, column: 14 }, end: { line: 130, column: 16 } }, '86': { start: { line: 131, column: 2 }, end: { line: 136, column: 3 } }, '87': { start: { line: 132, column: 4 }, end: { line: 132, column: 36 } }, '88': { start: { line: 133, column: 4 }, end: { line: 135, column: 5 } }, '89': { start: { line: 134, column: 6 }, end: { line: 134, column: 44 } }, '90': { start: { line: 137, column: 2 }, end: { line: 137, column: 34 } }, '91': { start: { line: 139, column: 0 }, end: { line: 139, column: 60 } } }, fnMap: { '0': { name: 'collectChildrenDiffFilter', decl: { start: { line: 5, column: 16 }, end: { line: 5, column: 41 } }, loc: { start: { line: 5, column: 51 }, end: { line: 24, column: 1 } }, line: 5 }, '1': { name: 'objectsDiffFilter', decl: { start: { line: 27, column: 16 }, end: { line: 27, column: 33 } }, loc: { start: { line: 27, column: 43 }, end: { line: 63, column: 1 } }, line: 27 }, '2': { name: 'nestedPatchFilter', decl: { start: { line: 66, column: 34 }, end: { line: 66, column: 51 } }, loc: { start: { line: 66, column: 61 }, end: { line: 80, column: 1 } }, line: 66 }, '3': { name: 'collectChildrenPatchFilter', decl: { start: { line: 83, column: 49 }, end: { line: 83, column: 75 } }, loc: { start: { line: 83, column: 85 }, end: { line: 101, column: 1 } }, line: 83 }, '4': { name: 'nestedReverseFilter', decl: { start: { line: 104, column: 36 }, end: { line: 104, column: 55 } }, loc: { start: { line: 104, column: 65 }, end: { line: 118, column: 1 } }, line: 104 }, '5': { name: 'collectChildrenReverseFilter', decl: { start: { line: 121, column: 16 }, end: { line: 121, column: 44 } }, loc: { start: { line: 121, column: 54 }, end: { line: 138, column: 1 } }, line: 121 } }, branchMap: { '0': { loc: { start: { line: 6, column: 2 }, end: { line: 8, column: 3 } }, type: 'if', locations: [{ start: { line: 6, column: 2 }, end: { line: 8, column: 3 } }, { start: { line: 6, column: 2 }, end: { line: 8, column: 3 } }], line: 6 }, '1': { loc: { start: { line: 6, column: 6 }, end: { line: 6, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 6, column: 6 }, end: { line: 6, column: 14 } }, { start: { line: 6, column: 18 }, end: { line: 6, column: 35 } }], line: 6 }, '2': { loc: { start: { line: 14, column: 4 }, end: { line: 16, column: 5 } }, type: 'if', locations: [{ start: { line: 14, column: 4 }, end: { line: 16, column: 5 } }, { start: { line: 14, column: 4 }, end: { line: 16, column: 5 } }], line: 14 }, '3': { loc: { start: { line: 17, column: 13 }, end: { line: 17, column: 25 } }, type: 'binary-expr', locations: [{ start: { line: 17, column: 13 }, end: { line: 17, column: 19 } }, { start: { line: 17, column: 23 }, end: { line: 17, column: 25 } }], line: 17 }, '4': { loc: { start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }, type: 'if', locations: [{ start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }, { start: { line: 20, column: 2 }, end: { line: 22, column: 3 } }], line: 20 }, '5': { loc: { start: { line: 20, column: 6 }, end: { line: 20, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 20, column: 6 }, end: { line: 20, column: 12 } }, { start: { line: 20, column: 16 }, end: { line: 20, column: 35 } }], line: 20 }, '6': { loc: { start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }, type: 'if', locations: [{ start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }, { start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }], line: 28 }, '7': { loc: { start: { line: 28, column: 6 }, end: { line: 28, column: 58 } }, type: 'binary-expr', locations: [{ start: { line: 28, column: 6 }, end: { line: 28, column: 25 } }, { start: { line: 28, column: 29 }, end: { line: 28, column: 58 } }], line: 28 }, '8': { loc: { start: { line: 36, column: 4 }, end: { line: 38, column: 5 } }, type: 'if', locations: [{ start: { line: 36, column: 4 }, end: { line: 38, column: 5 } }, { start: { line: 36, column: 4 }, end: { line: 38, column: 5 } }], line: 36 }, '9': { loc: { start: { line: 39, column: 4 }, end: { line: 41, column: 5 } }, type: 'if', locations: [{ start: { line: 39, column: 4 }, end: { line: 41, column: 5 } }, { start: { line: 39, column: 4 }, end: { line: 41, column: 5 } }], line: 39 }, '10': { loc: { start: { line: 39, column: 8 }, end: { line: 39, column: 56 } }, type: 'binary-expr', locations: [{ start: { line: 39, column: 8 }, end: { line: 39, column: 22 } }, { start: { line: 39, column: 26 }, end: { line: 39, column: 56 } }], line: 39 }, '11': { loc: { start: { line: 46, column: 4 }, end: { line: 48, column: 5 } }, type: 'if', locations: [{ start: { line: 46, column: 4 }, end: { line: 48, column: 5 } }, { start: { line: 46, column: 4 }, end: { line: 48, column: 5 } }], line: 46 }, '12': { loc: { start: { line: 49, column: 4 }, end: { line: 51, column: 5 } }, type: 'if', locations: [{ start: { line: 49, column: 4 }, end: { line: 51, column: 5 } }, { start: { line: 49, column: 4 }, end: { line: 51, column: 5 } }], line: 49 }, '13': { loc: { start: { line: 49, column: 8 }, end: { line: 49, column: 56 } }, type: 'binary-expr', locations: [{ start: { line: 49, column: 8 }, end: { line: 49, column: 22 } }, { start: { line: 49, column: 26 }, end: { line: 49, column: 56 } }], line: 49 }, '14': { loc: { start: { line: 52, column: 4 }, end: { line: 55, column: 5 } }, type: 'if', locations: [{ start: { line: 52, column: 4 }, end: { line: 55, column: 5 } }, { start: { line: 52, column: 4 }, end: { line: 55, column: 5 } }], line: 52 }, '15': { loc: { start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }, type: 'if', locations: [{ start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }, { start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }], line: 58 }, '16': { loc: { start: { line: 58, column: 6 }, end: { line: 58, column: 56 } }, type: 'binary-expr', locations: [{ start: { line: 58, column: 6 }, end: { line: 58, column: 23 } }, { start: { line: 58, column: 27 }, end: { line: 58, column: 56 } }], line: 58 }, '17': { loc: { start: { line: 67, column: 2 }, end: { line: 69, column: 3 } }, type: 'if', locations: [{ start: { line: 67, column: 2 }, end: { line: 69, column: 3 } }, { start: { line: 67, column: 2 }, end: { line: 69, column: 3 } }], line: 67 }, '18': { loc: { start: { line: 70, column: 2 }, end: { line: 72, column: 3 } }, type: 'if', locations: [{ start: { line: 70, column: 2 }, end: { line: 72, column: 3 } }, { start: { line: 70, column: 2 }, end: { line: 72, column: 3 } }], line: 70 }, '19': { loc: { start: { line: 84, column: 2 }, end: { line: 86, column: 3 } }, type: 'if', locations: [{ start: { line: 84, column: 2 }, end: { line: 86, column: 3 } }, { start: { line: 84, column: 2 }, end: { line: 86, column: 3 } }], line: 84 }, '20': { loc: { start: { line: 84, column: 6 }, end: { line: 84, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 84, column: 6 }, end: { line: 84, column: 14 } }, { start: { line: 84, column: 18 }, end: { line: 84, column: 35 } }], line: 84 }, '21': { loc: { start: { line: 87, column: 2 }, end: { line: 89, column: 3 } }, type: 'if', locations: [{ start: { line: 87, column: 2 }, end: { line: 89, column: 3 } }, { start: { line: 87, column: 2 }, end: { line: 89, column: 3 } }], line: 87 }, '22': { loc: { start: { line: 94, column: 4 }, end: { line: 98, column: 5 } }, type: 'if', locations: [{ start: { line: 94, column: 4 }, end: { line: 98, column: 5 } }, { start: { line: 94, column: 4 }, end: { line: 98, column: 5 } }], line: 94 }, '23': { loc: { start: { line: 94, column: 8 }, end: { line: 94, column: 105 } }, type: 'binary-expr', locations: [{ start: { line: 94, column: 8 }, end: { line: 94, column: 75 } }, { start: { line: 94, column: 79 }, end: { line: 94, column: 105 } }], line: 94 }, '24': { loc: { start: { line: 96, column: 11 }, end: { line: 98, column: 5 } }, type: 'if', locations: [{ start: { line: 96, column: 11 }, end: { line: 98, column: 5 } }, { start: { line: 96, column: 11 }, end: { line: 98, column: 5 } }], line: 96 }, '25': { loc: { start: { line: 105, column: 2 }, end: { line: 107, column: 3 } }, type: 'if', locations: [{ start: { line: 105, column: 2 }, end: { line: 107, column: 3 } }, { start: { line: 105, column: 2 }, end: { line: 107, column: 3 } }], line: 105 }, '26': { loc: { start: { line: 108, column: 2 }, end: { line: 110, column: 3 } }, type: 'if', locations: [{ start: { line: 108, column: 2 }, end: { line: 110, column: 3 } }, { start: { line: 108, column: 2 }, end: { line: 110, column: 3 } }], line: 108 }, '27': { loc: { start: { line: 122, column: 2 }, end: { line: 124, column: 3 } }, type: 'if', locations: [{ start: { line: 122, column: 2 }, end: { line: 124, column: 3 } }, { start: { line: 122, column: 2 }, end: { line: 124, column: 3 } }], line: 122 }, '28': { loc: { start: { line: 122, column: 6 }, end: { line: 122, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 122, column: 6 }, end: { line: 122, column: 14 } }, { start: { line: 122, column: 18 }, end: { line: 122, column: 35 } }], line: 122 }, '29': { loc: { start: { line: 125, column: 2 }, end: { line: 127, column: 3 } }, type: 'if', locations: [{ start: { line: 125, column: 2 }, end: { line: 127, column: 3 } }, { start: { line: 125, column: 2 }, end: { line: 127, column: 3 } }], line: 125 }, '30': { loc: { start: { line: 133, column: 4 }, end: { line: 135, column: 5 } }, type: 'if', locations: [{ start: { line: 133, column: 4 }, end: { line: 135, column: 5 } }, { start: { line: 133, column: 4 }, end: { line: 135, column: 5 } }], line: 133 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0, '86': 0, '87': 0, '88': 0, '89': 0, '90': 0, '91': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0], '20': [0, 0], '21': [0, 0], '22': [0, 0], '23': [0, 0], '24': [0, 0], '25': [0, 0], '26': [0, 0], '27': [0, 0], '28': [0, 0], '29': [0, 0], '30': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2726 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2727 return coverage[path];
2728 }coverageData.hash = hash;return coverage[path] = coverageData;
2729}();function collectChildrenDiffFilter(context) {
2730 cov_14lky13xfg.f[0]++;cov_14lky13xfg.s[0]++;if ((cov_14lky13xfg.b[1][0]++, !context) || (cov_14lky13xfg.b[1][1]++, !context.children)) {
2731 cov_14lky13xfg.b[0][0]++;cov_14lky13xfg.s[1]++;return;
2732 } else {
2733 cov_14lky13xfg.b[0][1]++;
2734 }var length = (cov_14lky13xfg.s[2]++, context.children.length);var child = (cov_14lky13xfg.s[3]++, void 0);var result = (cov_14lky13xfg.s[4]++, context.result);cov_14lky13xfg.s[5]++;for (var index = 0; index < length; index++) {
2735 cov_14lky13xfg.s[6]++;child = context.children[index];cov_14lky13xfg.s[7]++;if (typeof child.result === 'undefined') {
2736 cov_14lky13xfg.b[2][0]++;cov_14lky13xfg.s[8]++;continue;
2737 } else {
2738 cov_14lky13xfg.b[2][1]++;
2739 }cov_14lky13xfg.s[9]++;result = (cov_14lky13xfg.b[3][0]++, result) || (cov_14lky13xfg.b[3][1]++, {});cov_14lky13xfg.s[10]++;result[child.childName] = child.result;
2740 }cov_14lky13xfg.s[11]++;if ((cov_14lky13xfg.b[5][0]++, result) && (cov_14lky13xfg.b[5][1]++, context.leftIsArray)) {
2741 cov_14lky13xfg.b[4][0]++;cov_14lky13xfg.s[12]++;result._t = 'a';
2742 } else {
2743 cov_14lky13xfg.b[4][1]++;
2744 }cov_14lky13xfg.s[13]++;context.setResult(result).exit();
2745}cov_14lky13xfg.s[14]++;collectChildrenDiffFilter.filterName = 'collectChildren';function objectsDiffFilter(context) {
2746 cov_14lky13xfg.f[1]++;cov_14lky13xfg.s[15]++;if ((cov_14lky13xfg.b[7][0]++, context.leftIsArray) || (cov_14lky13xfg.b[7][1]++, context.leftType !== 'object')) {
2747 cov_14lky13xfg.b[6][0]++;cov_14lky13xfg.s[16]++;return;
2748 } else {
2749 cov_14lky13xfg.b[6][1]++;
2750 }var name = (cov_14lky13xfg.s[17]++, void 0);var child = (cov_14lky13xfg.s[18]++, void 0);var propertyFilter = (cov_14lky13xfg.s[19]++, context.options.propertyFilter);cov_14lky13xfg.s[20]++;for (name in context.left) {
2751 cov_14lky13xfg.s[21]++;if (!Object.prototype.hasOwnProperty.call(context.left, name)) {
2752 cov_14lky13xfg.b[8][0]++;cov_14lky13xfg.s[22]++;continue;
2753 } else {
2754 cov_14lky13xfg.b[8][1]++;
2755 }cov_14lky13xfg.s[23]++;if ((cov_14lky13xfg.b[10][0]++, propertyFilter) && (cov_14lky13xfg.b[10][1]++, !propertyFilter(name, context))) {
2756 cov_14lky13xfg.b[9][0]++;cov_14lky13xfg.s[24]++;continue;
2757 } else {
2758 cov_14lky13xfg.b[9][1]++;
2759 }cov_14lky13xfg.s[25]++;child = new DiffContext(context.left[name], context.right[name]);cov_14lky13xfg.s[26]++;context.push(child, name);
2760 }cov_14lky13xfg.s[27]++;for (name in context.right) {
2761 cov_14lky13xfg.s[28]++;if (!Object.prototype.hasOwnProperty.call(context.right, name)) {
2762 cov_14lky13xfg.b[11][0]++;cov_14lky13xfg.s[29]++;continue;
2763 } else {
2764 cov_14lky13xfg.b[11][1]++;
2765 }cov_14lky13xfg.s[30]++;if ((cov_14lky13xfg.b[13][0]++, propertyFilter) && (cov_14lky13xfg.b[13][1]++, !propertyFilter(name, context))) {
2766 cov_14lky13xfg.b[12][0]++;cov_14lky13xfg.s[31]++;continue;
2767 } else {
2768 cov_14lky13xfg.b[12][1]++;
2769 }cov_14lky13xfg.s[32]++;if (typeof context.left[name] === 'undefined') {
2770 cov_14lky13xfg.b[14][0]++;cov_14lky13xfg.s[33]++;child = new DiffContext(undefined, context.right[name]);cov_14lky13xfg.s[34]++;context.push(child, name);
2771 } else {
2772 cov_14lky13xfg.b[14][1]++;
2773 }
2774 }cov_14lky13xfg.s[35]++;if ((cov_14lky13xfg.b[16][0]++, !context.children) || (cov_14lky13xfg.b[16][1]++, context.children.length === 0)) {
2775 cov_14lky13xfg.b[15][0]++;cov_14lky13xfg.s[36]++;context.setResult(undefined).exit();cov_14lky13xfg.s[37]++;return;
2776 } else {
2777 cov_14lky13xfg.b[15][1]++;
2778 }cov_14lky13xfg.s[38]++;context.exit();
2779}cov_14lky13xfg.s[39]++;objectsDiffFilter.filterName = 'objects';cov_14lky13xfg.s[40]++;var patchFilter$1 = function nestedPatchFilter(context) {
2780 cov_14lky13xfg.f[2]++;cov_14lky13xfg.s[41]++;if (!context.nested) {
2781 cov_14lky13xfg.b[17][0]++;cov_14lky13xfg.s[42]++;return;
2782 } else {
2783 cov_14lky13xfg.b[17][1]++;
2784 }cov_14lky13xfg.s[43]++;if (context.delta._t) {
2785 cov_14lky13xfg.b[18][0]++;cov_14lky13xfg.s[44]++;return;
2786 } else {
2787 cov_14lky13xfg.b[18][1]++;
2788 }var name = (cov_14lky13xfg.s[45]++, void 0);var child = (cov_14lky13xfg.s[46]++, void 0);cov_14lky13xfg.s[47]++;for (name in context.delta) {
2789 cov_14lky13xfg.s[48]++;child = new PatchContext(context.left[name], context.delta[name]);cov_14lky13xfg.s[49]++;context.push(child, name);
2790 }cov_14lky13xfg.s[50]++;context.exit();
2791};cov_14lky13xfg.s[51]++;patchFilter$1.filterName = 'objects';cov_14lky13xfg.s[52]++;var collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {
2792 cov_14lky13xfg.f[3]++;cov_14lky13xfg.s[53]++;if ((cov_14lky13xfg.b[20][0]++, !context) || (cov_14lky13xfg.b[20][1]++, !context.children)) {
2793 cov_14lky13xfg.b[19][0]++;cov_14lky13xfg.s[54]++;return;
2794 } else {
2795 cov_14lky13xfg.b[19][1]++;
2796 }cov_14lky13xfg.s[55]++;if (context.delta._t) {
2797 cov_14lky13xfg.b[21][0]++;cov_14lky13xfg.s[56]++;return;
2798 } else {
2799 cov_14lky13xfg.b[21][1]++;
2800 }var length = (cov_14lky13xfg.s[57]++, context.children.length);var child = (cov_14lky13xfg.s[58]++, void 0);cov_14lky13xfg.s[59]++;for (var index = 0; index < length; index++) {
2801 cov_14lky13xfg.s[60]++;child = context.children[index];cov_14lky13xfg.s[61]++;if ((cov_14lky13xfg.b[23][0]++, Object.prototype.hasOwnProperty.call(context.left, child.childName)) && (cov_14lky13xfg.b[23][1]++, child.result === undefined)) {
2802 cov_14lky13xfg.b[22][0]++;cov_14lky13xfg.s[62]++;delete context.left[child.childName];
2803 } else {
2804 cov_14lky13xfg.b[22][1]++;cov_14lky13xfg.s[63]++;if (context.left[child.childName] !== child.result) {
2805 cov_14lky13xfg.b[24][0]++;cov_14lky13xfg.s[64]++;context.left[child.childName] = child.result;
2806 } else {
2807 cov_14lky13xfg.b[24][1]++;
2808 }
2809 }
2810 }cov_14lky13xfg.s[65]++;context.setResult(context.left).exit();
2811};cov_14lky13xfg.s[66]++;collectChildrenPatchFilter.filterName = 'collectChildren';cov_14lky13xfg.s[67]++;var reverseFilter$1 = function nestedReverseFilter(context) {
2812 cov_14lky13xfg.f[4]++;cov_14lky13xfg.s[68]++;if (!context.nested) {
2813 cov_14lky13xfg.b[25][0]++;cov_14lky13xfg.s[69]++;return;
2814 } else {
2815 cov_14lky13xfg.b[25][1]++;
2816 }cov_14lky13xfg.s[70]++;if (context.delta._t) {
2817 cov_14lky13xfg.b[26][0]++;cov_14lky13xfg.s[71]++;return;
2818 } else {
2819 cov_14lky13xfg.b[26][1]++;
2820 }var name = (cov_14lky13xfg.s[72]++, void 0);var child = (cov_14lky13xfg.s[73]++, void 0);cov_14lky13xfg.s[74]++;for (name in context.delta) {
2821 cov_14lky13xfg.s[75]++;child = new ReverseContext(context.delta[name]);cov_14lky13xfg.s[76]++;context.push(child, name);
2822 }cov_14lky13xfg.s[77]++;context.exit();
2823};cov_14lky13xfg.s[78]++;reverseFilter$1.filterName = 'objects';function collectChildrenReverseFilter(context) {
2824 cov_14lky13xfg.f[5]++;cov_14lky13xfg.s[79]++;if ((cov_14lky13xfg.b[28][0]++, !context) || (cov_14lky13xfg.b[28][1]++, !context.children)) {
2825 cov_14lky13xfg.b[27][0]++;cov_14lky13xfg.s[80]++;return;
2826 } else {
2827 cov_14lky13xfg.b[27][1]++;
2828 }cov_14lky13xfg.s[81]++;if (context.delta._t) {
2829 cov_14lky13xfg.b[29][0]++;cov_14lky13xfg.s[82]++;return;
2830 } else {
2831 cov_14lky13xfg.b[29][1]++;
2832 }var length = (cov_14lky13xfg.s[83]++, context.children.length);var child = (cov_14lky13xfg.s[84]++, void 0);var delta = (cov_14lky13xfg.s[85]++, {});cov_14lky13xfg.s[86]++;for (var index = 0; index < length; index++) {
2833 cov_14lky13xfg.s[87]++;child = context.children[index];cov_14lky13xfg.s[88]++;if (delta[child.childName] !== child.result) {
2834 cov_14lky13xfg.b[30][0]++;cov_14lky13xfg.s[89]++;delta[child.childName] = child.result;
2835 } else {
2836 cov_14lky13xfg.b[30][1]++;
2837 }
2838 }cov_14lky13xfg.s[90]++;context.setResult(delta).exit();
2839}cov_14lky13xfg.s[91]++;collectChildrenReverseFilter.filterName = 'collectChildren';
2840
2841var cov_i0rcratvd = function () {
2842 var path = '/Users/benja/proj/jsondiffpatch/src/filters/lcs.js',
2843 hash = '0a025babc40e5e4f97d1b86f1987ef7201496109',
2844 global = new Function('return this')(),
2845 gcv = '__coverage__',
2846 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/filters/lcs.js', statementMap: { '0': { start: { line: 9, column: 19 }, end: { line: 11, column: 1 } }, '1': { start: { line: 10, column: 2 }, end: { line: 10, column: 43 } }, '2': { start: { line: 13, column: 19 }, end: { line: 39, column: 1 } }, '3': { start: { line: 14, column: 13 }, end: { line: 14, column: 26 } }, '4': { start: { line: 15, column: 13 }, end: { line: 15, column: 26 } }, '5': { start: { line: 16, column: 10 }, end: { line: 16, column: 16 } }, '6': { start: { line: 17, column: 10 }, end: { line: 17, column: 16 } }, '7': { start: { line: 20, column: 15 }, end: { line: 20, column: 25 } }, '8': { start: { line: 21, column: 2 }, end: { line: 26, column: 3 } }, '9': { start: { line: 22, column: 4 }, end: { line: 22, column: 27 } }, '10': { start: { line: 23, column: 4 }, end: { line: 25, column: 5 } }, '11': { start: { line: 24, column: 6 }, end: { line: 24, column: 23 } }, '12': { start: { line: 27, column: 2 }, end: { line: 27, column: 23 } }, '13': { start: { line: 29, column: 2 }, end: { line: 37, column: 3 } }, '14': { start: { line: 30, column: 4 }, end: { line: 36, column: 5 } }, '15': { start: { line: 31, column: 6 }, end: { line: 35, column: 7 } }, '16': { start: { line: 32, column: 8 }, end: { line: 32, column: 48 } }, '17': { start: { line: 34, column: 8 }, end: { line: 34, column: 68 } }, '18': { start: { line: 38, column: 2 }, end: { line: 38, column: 16 } }, '19': { start: { line: 41, column: 16 }, end: { line: 63, column: 1 } }, '20': { start: { line: 42, column: 2 }, end: { line: 48, column: 3 } }, '21': { start: { line: 43, column: 4 }, end: { line: 47, column: 6 } }, '22': { start: { line: 50, column: 2 }, end: { line: 56, column: 3 } }, '23': { start: { line: 51, column: 22 }, end: { line: 51, column: 88 } }, '24': { start: { line: 52, column: 4 }, end: { line: 52, column: 50 } }, '25': { start: { line: 53, column: 4 }, end: { line: 53, column: 42 } }, '26': { start: { line: 54, column: 4 }, end: { line: 54, column: 42 } }, '27': { start: { line: 55, column: 4 }, end: { line: 55, column: 23 } }, '28': { start: { line: 58, column: 2 }, end: { line: 62, column: 3 } }, '29': { start: { line: 59, column: 4 }, end: { line: 59, column: 74 } }, '30': { start: { line: 61, column: 4 }, end: { line: 61, column: 74 } }, '31': { start: { line: 65, column: 10 }, end: { line: 73, column: 1 } }, '32': { start: { line: 66, column: 21 }, end: { line: 66, column: 34 } }, '33': { start: { line: 67, column: 15 }, end: { line: 67, column: 80 } }, '34': { start: { line: 68, column: 15 }, end: { line: 68, column: 92 } }, '35': { start: { line: 69, column: 2 }, end: { line: 71, column: 3 } }, '36': { start: { line: 70, column: 4 }, end: { line: 70, column: 47 } }, '37': { start: { line: 72, column: 2 }, end: { line: 72, column: 16 } } }, fnMap: { '0': { name: 'defaultMatch', decl: { start: { line: 9, column: 28 }, end: { line: 9, column: 40 } }, loc: { start: { line: 9, column: 73 }, end: { line: 11, column: 1 } }, line: 9 }, '1': { name: 'lengthMatrix', decl: { start: { line: 13, column: 28 }, end: { line: 13, column: 40 } }, loc: { start: { line: 13, column: 73 }, end: { line: 39, column: 1 } }, line: 13 }, '2': { name: 'backtrack', decl: { start: { line: 41, column: 25 }, end: { line: 41, column: 34 } }, loc: { start: { line: 41, column: 84 }, end: { line: 63, column: 1 } }, line: 41 }, '3': { name: 'get', decl: { start: { line: 65, column: 19 }, end: { line: 65, column: 22 } }, loc: { start: { line: 65, column: 55 }, end: { line: 73, column: 1 } }, line: 65 } }, branchMap: { '0': { loc: { start: { line: 31, column: 6 }, end: { line: 35, column: 7 } }, type: 'if', locations: [{ start: { line: 31, column: 6 }, end: { line: 35, column: 7 } }, { start: { line: 31, column: 6 }, end: { line: 35, column: 7 } }], line: 31 }, '1': { loc: { start: { line: 42, column: 2 }, end: { line: 48, column: 3 } }, type: 'if', locations: [{ start: { line: 42, column: 2 }, end: { line: 48, column: 3 } }, { start: { line: 42, column: 2 }, end: { line: 48, column: 3 } }], line: 42 }, '2': { loc: { start: { line: 42, column: 6 }, end: { line: 42, column: 34 } }, type: 'binary-expr', locations: [{ start: { line: 42, column: 6 }, end: { line: 42, column: 18 } }, { start: { line: 42, column: 22 }, end: { line: 42, column: 34 } }], line: 42 }, '3': { loc: { start: { line: 50, column: 2 }, end: { line: 56, column: 3 } }, type: 'if', locations: [{ start: { line: 50, column: 2 }, end: { line: 56, column: 3 } }, { start: { line: 50, column: 2 }, end: { line: 56, column: 3 } }], line: 50 }, '4': { loc: { start: { line: 58, column: 2 }, end: { line: 62, column: 3 } }, type: 'if', locations: [{ start: { line: 58, column: 2 }, end: { line: 62, column: 3 } }, { start: { line: 58, column: 2 }, end: { line: 62, column: 3 } }], line: 58 }, '5': { loc: { start: { line: 66, column: 21 }, end: { line: 66, column: 34 } }, type: 'binary-expr', locations: [{ start: { line: 66, column: 21 }, end: { line: 66, column: 28 } }, { start: { line: 66, column: 32 }, end: { line: 66, column: 34 } }], line: 66 }, '6': { loc: { start: { line: 67, column: 44 }, end: { line: 67, column: 65 } }, type: 'binary-expr', locations: [{ start: { line: 67, column: 44 }, end: { line: 67, column: 49 } }, { start: { line: 67, column: 53 }, end: { line: 67, column: 65 } }], line: 67 }, '7': { loc: { start: { line: 69, column: 2 }, end: { line: 71, column: 3 } }, type: 'if', locations: [{ start: { line: 69, column: 2 }, end: { line: 71, column: 3 } }, { start: { line: 69, column: 2 }, end: { line: 71, column: 3 } }], line: 69 }, '8': { loc: { start: { line: 69, column: 6 }, end: { line: 69, column: 62 } }, type: 'binary-expr', locations: [{ start: { line: 69, column: 6 }, end: { line: 69, column: 32 } }, { start: { line: 69, column: 36 }, end: { line: 69, column: 62 } }], line: 69 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2847 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2848 return coverage[path];
2849 }coverageData.hash = hash;return coverage[path] = coverageData;
2850}();cov_i0rcratvd.s[0]++; /*
2851 LCS implementation that supports arrays or strings
2852 reference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
2853 */var defaultMatch = function defaultMatch(array1, array2, index1, index2) {
2854 cov_i0rcratvd.f[0]++;cov_i0rcratvd.s[1]++;return array1[index1] === array2[index2];
2855};cov_i0rcratvd.s[2]++;var lengthMatrix = function lengthMatrix(array1, array2, match, context) {
2856 cov_i0rcratvd.f[1]++;var len1 = (cov_i0rcratvd.s[3]++, array1.length);var len2 = (cov_i0rcratvd.s[4]++, array2.length);var x = (cov_i0rcratvd.s[5]++, void 0),
2857 y = (cov_i0rcratvd.s[6]++, void 0); // initialize empty matrix of len1+1 x len2+1
2858 var matrix = (cov_i0rcratvd.s[7]++, [len1 + 1]);cov_i0rcratvd.s[8]++;for (x = 0; x < len1 + 1; x++) {
2859 cov_i0rcratvd.s[9]++;matrix[x] = [len2 + 1];cov_i0rcratvd.s[10]++;for (y = 0; y < len2 + 1; y++) {
2860 cov_i0rcratvd.s[11]++;matrix[x][y] = 0;
2861 }
2862 }cov_i0rcratvd.s[12]++;matrix.match = match; // save sequence lengths for each coordinate
2863 cov_i0rcratvd.s[13]++;for (x = 1; x < len1 + 1; x++) {
2864 cov_i0rcratvd.s[14]++;for (y = 1; y < len2 + 1; y++) {
2865 cov_i0rcratvd.s[15]++;if (match(array1, array2, x - 1, y - 1, context)) {
2866 cov_i0rcratvd.b[0][0]++;cov_i0rcratvd.s[16]++;matrix[x][y] = matrix[x - 1][y - 1] + 1;
2867 } else {
2868 cov_i0rcratvd.b[0][1]++;cov_i0rcratvd.s[17]++;matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);
2869 }
2870 }
2871 }cov_i0rcratvd.s[18]++;return matrix;
2872};cov_i0rcratvd.s[19]++;var backtrack = function backtrack(matrix, array1, array2, index1, index2, context) {
2873 cov_i0rcratvd.f[2]++;cov_i0rcratvd.s[20]++;if ((cov_i0rcratvd.b[2][0]++, index1 === 0) || (cov_i0rcratvd.b[2][1]++, index2 === 0)) {
2874 cov_i0rcratvd.b[1][0]++;cov_i0rcratvd.s[21]++;return { sequence: [], indices1: [], indices2: [] };
2875 } else {
2876 cov_i0rcratvd.b[1][1]++;
2877 }cov_i0rcratvd.s[22]++;if (matrix.match(array1, array2, index1 - 1, index2 - 1, context)) {
2878 cov_i0rcratvd.b[3][0]++;var subsequence = (cov_i0rcratvd.s[23]++, backtrack(matrix, array1, array2, index1 - 1, index2 - 1, context));cov_i0rcratvd.s[24]++;subsequence.sequence.push(array1[index1 - 1]);cov_i0rcratvd.s[25]++;subsequence.indices1.push(index1 - 1);cov_i0rcratvd.s[26]++;subsequence.indices2.push(index2 - 1);cov_i0rcratvd.s[27]++;return subsequence;
2879 } else {
2880 cov_i0rcratvd.b[3][1]++;
2881 }cov_i0rcratvd.s[28]++;if (matrix[index1][index2 - 1] > matrix[index1 - 1][index2]) {
2882 cov_i0rcratvd.b[4][0]++;cov_i0rcratvd.s[29]++;return backtrack(matrix, array1, array2, index1, index2 - 1, context);
2883 } else {
2884 cov_i0rcratvd.b[4][1]++;cov_i0rcratvd.s[30]++;return backtrack(matrix, array1, array2, index1 - 1, index2, context);
2885 }
2886};cov_i0rcratvd.s[31]++;var get$1$1 = function get$$1(array1, array2, match, context) {
2887 cov_i0rcratvd.f[3]++;var innerContext = (cov_i0rcratvd.s[32]++, (cov_i0rcratvd.b[5][0]++, context) || (cov_i0rcratvd.b[5][1]++, {}));var matrix = (cov_i0rcratvd.s[33]++, lengthMatrix(array1, array2, (cov_i0rcratvd.b[6][0]++, match) || (cov_i0rcratvd.b[6][1]++, defaultMatch), innerContext));var result = (cov_i0rcratvd.s[34]++, backtrack(matrix, array1, array2, array1.length, array2.length, innerContext));cov_i0rcratvd.s[35]++;if ((cov_i0rcratvd.b[8][0]++, typeof array1 === 'string') && (cov_i0rcratvd.b[8][1]++, typeof array2 === 'string')) {
2888 cov_i0rcratvd.b[7][0]++;cov_i0rcratvd.s[36]++;result.sequence = result.sequence.join('');
2889 } else {
2890 cov_i0rcratvd.b[7][1]++;
2891 }cov_i0rcratvd.s[37]++;return result;
2892};var lcs = { get: get$1$1 };
2893
2894var cov_g15fjodrd = function () {
2895 var path = '/Users/benja/proj/jsondiffpatch/src/filters/arrays.js',
2896 hash = 'a4fb2848fb44c24307acdebe417f136230c14c6f',
2897 global = new Function('return this')(),
2898 gcv = '__coverage__',
2899 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/filters/arrays.js', statementMap: { '0': { start: { line: 7, column: 17 }, end: { line: 7, column: 18 } }, '1': { start: { line: 9, column: 14 }, end: { line: 11, column: 1 } }, '2': { start: { line: 10, column: 2 }, end: { line: 10, column: 28 } }, '3': { start: { line: 13, column: 19 }, end: { line: 23, column: 1 } }, '4': { start: { line: 14, column: 2 }, end: { line: 14, column: 29 } }, '5': { start: { line: 16, column: 15 }, end: { line: 16, column: 27 } }, '6': { start: { line: 17, column: 2 }, end: { line: 21, column: 3 } }, '7': { start: { line: 18, column: 4 }, end: { line: 20, column: 5 } }, '8': { start: { line: 19, column: 6 }, end: { line: 19, column: 15 } }, '9': { start: { line: 22, column: 2 }, end: { line: 22, column: 12 } }, '10': { start: { line: 26, column: 2 }, end: { line: 34, column: 3 } }, '11': { start: { line: 27, column: 15 }, end: { line: 27, column: 29 } }, '12': { start: { line: 28, column: 4 }, end: { line: 33, column: 5 } }, '13': { start: { line: 29, column: 17 }, end: { line: 29, column: 31 } }, '14': { start: { line: 30, column: 6 }, end: { line: 32, column: 7 } }, '15': { start: { line: 31, column: 8 }, end: { line: 31, column: 20 } }, '16': { start: { line: 38, column: 15 }, end: { line: 38, column: 29 } }, '17': { start: { line: 39, column: 15 }, end: { line: 39, column: 29 } }, '18': { start: { line: 40, column: 2 }, end: { line: 42, column: 3 } }, '19': { start: { line: 41, column: 4 }, end: { line: 41, column: 16 } }, '20': { start: { line: 43, column: 2 }, end: { line: 45, column: 3 } }, '21': { start: { line: 44, column: 4 }, end: { line: 44, column: 17 } }, '22': { start: { line: 46, column: 19 }, end: { line: 46, column: 37 } }, '23': { start: { line: 47, column: 2 }, end: { line: 50, column: 3 } }, '24': { start: { line: 49, column: 4 }, end: { line: 49, column: 56 } }, '25': { start: { line: 51, column: 14 }, end: { line: 51, column: 20 } }, '26': { start: { line: 52, column: 14 }, end: { line: 52, column: 20 } }, '27': { start: { line: 53, column: 2 }, end: { line: 61, column: 3 } }, '28': { start: { line: 54, column: 4 }, end: { line: 54, column: 50 } }, '29': { start: { line: 55, column: 4 }, end: { line: 55, column: 39 } }, '30': { start: { line: 56, column: 4 }, end: { line: 58, column: 5 } }, '31': { start: { line: 57, column: 6 }, end: { line: 57, column: 70 } }, '32': { start: { line: 60, column: 4 }, end: { line: 60, column: 31 } }, '33': { start: { line: 62, column: 2 }, end: { line: 64, column: 3 } }, '34': { start: { line: 63, column: 4 }, end: { line: 63, column: 17 } }, '35': { start: { line: 65, column: 2 }, end: { line: 73, column: 3 } }, '36': { start: { line: 66, column: 4 }, end: { line: 66, column: 50 } }, '37': { start: { line: 67, column: 4 }, end: { line: 67, column: 39 } }, '38': { start: { line: 68, column: 4 }, end: { line: 70, column: 5 } }, '39': { start: { line: 69, column: 6 }, end: { line: 69, column: 70 } }, '40': { start: { line: 72, column: 4 }, end: { line: 72, column: 31 } }, '41': { start: { line: 74, column: 2 }, end: { line: 76, column: 3 } }, '42': { start: { line: 75, column: 4 }, end: { line: 75, column: 17 } }, '43': { start: { line: 77, column: 2 }, end: { line: 77, column: 25 } }, '44': { start: { line: 80, column: 24 }, end: { line: 217, column: 1 } }, '45': { start: { line: 81, column: 2 }, end: { line: 83, column: 3 } }, '46': { start: { line: 82, column: 4 }, end: { line: 82, column: 11 } }, '47': { start: { line: 85, column: 21 }, end: { line: 88, column: 3 } }, '48': { start: { line: 89, column: 19 }, end: { line: 89, column: 20 } }, '49': { start: { line: 90, column: 19 }, end: { line: 90, column: 20 } }, '50': { start: { line: 91, column: 14 }, end: { line: 91, column: 20 } }, '51': { start: { line: 92, column: 15 }, end: { line: 92, column: 21 } }, '52': { start: { line: 93, column: 15 }, end: { line: 93, column: 21 } }, '53': { start: { line: 94, column: 15 }, end: { line: 94, column: 27 } }, '54': { start: { line: 95, column: 15 }, end: { line: 95, column: 28 } }, '55': { start: { line: 96, column: 13 }, end: { line: 96, column: 26 } }, '56': { start: { line: 97, column: 13 }, end: { line: 97, column: 26 } }, '57': { start: { line: 99, column: 14 }, end: { line: 99, column: 20 } }, '58': { start: { line: 101, column: 2 }, end: { line: 103, column: 3 } }, '59': { start: { line: 102, column: 4 }, end: { line: 102, column: 85 } }, '60': { start: { line: 106, column: 2 }, end: { line: 111, column: 3 } }, '61': { start: { line: 107, column: 4 }, end: { line: 107, column: 23 } }, '62': { start: { line: 108, column: 4 }, end: { line: 108, column: 71 } }, '63': { start: { line: 109, column: 4 }, end: { line: 109, column: 31 } }, '64': { start: { line: 110, column: 4 }, end: { line: 110, column: 17 } }, '65': { start: { line: 113, column: 2 }, end: { line: 119, column: 3 } }, '66': { start: { line: 114, column: 4 }, end: { line: 114, column: 35 } }, '67': { start: { line: 115, column: 4 }, end: { line: 115, column: 35 } }, '68': { start: { line: 116, column: 4 }, end: { line: 116, column: 73 } }, '69': { start: { line: 117, column: 4 }, end: { line: 117, column: 32 } }, '70': { start: { line: 118, column: 4 }, end: { line: 118, column: 17 } }, '71': { start: { line: 120, column: 15 }, end: { line: 120, column: 21 } }, '72': { start: { line: 121, column: 2 }, end: { line: 136, column: 3 } }, '73': { start: { line: 122, column: 4 }, end: { line: 126, column: 5 } }, '74': { start: { line: 124, column: 6 }, end: { line: 124, column: 42 } }, '75': { start: { line: 125, column: 6 }, end: { line: 125, column: 13 } }, '76': { start: { line: 128, column: 4 }, end: { line: 130, column: 6 } }, '77': { start: { line: 131, column: 4 }, end: { line: 133, column: 5 } }, '78': { start: { line: 132, column: 6 }, end: { line: 132, column: 38 } }, '79': { start: { line: 134, column: 4 }, end: { line: 134, column: 37 } }, '80': { start: { line: 135, column: 4 }, end: { line: 135, column: 11 } }, '81': { start: { line: 137, column: 2 }, end: { line: 147, column: 3 } }, '82': { start: { line: 139, column: 4 }, end: { line: 141, column: 6 } }, '83': { start: { line: 142, column: 4 }, end: { line: 144, column: 5 } }, '84': { start: { line: 143, column: 6 }, end: { line: 143, column: 50 } }, '85': { start: { line: 145, column: 4 }, end: { line: 145, column: 37 } }, '86': { start: { line: 146, column: 4 }, end: { line: 146, column: 11 } }, '87': { start: { line: 149, column: 2 }, end: { line: 149, column: 33 } }, '88': { start: { line: 150, column: 2 }, end: { line: 150, column: 33 } }, '89': { start: { line: 153, column: 17 }, end: { line: 153, column: 60 } }, '90': { start: { line: 154, column: 17 }, end: { line: 154, column: 60 } }, '91': { start: { line: 155, column: 12 }, end: { line: 155, column: 65 } }, '92': { start: { line: 156, column: 21 }, end: { line: 156, column: 23 } }, '93': { start: { line: 157, column: 2 }, end: { line: 159, column: 4 } }, '94': { start: { line: 160, column: 2 }, end: { line: 166, column: 3 } }, '95': { start: { line: 161, column: 4 }, end: { line: 165, column: 5 } }, '96': { start: { line: 163, column: 6 }, end: { line: 163, column: 50 } }, '97': { start: { line: 164, column: 6 }, end: { line: 164, column: 31 } }, '98': { start: { line: 168, column: 19 }, end: { line: 168, column: 23 } }, '99': { start: { line: 169, column: 2 }, end: { line: 171, column: 3 } }, '100': { start: { line: 170, column: 4 }, end: { line: 170, column: 23 } }, '101': { start: { line: 172, column: 27 }, end: { line: 172, column: 32 } }, '102': { start: { line: 173, column: 2 }, end: { line: 175, column: 3 } }, '103': { start: { line: 174, column: 4 }, end: { line: 174, column: 30 } }, '104': { start: { line: 177, column: 27 }, end: { line: 177, column: 46 } }, '105': { start: { line: 178, column: 2 }, end: { line: 214, column: 3 } }, '106': { start: { line: 179, column: 24 }, end: { line: 179, column: 70 } }, '107': { start: { line: 180, column: 4 }, end: { line: 213, column: 5 } }, '108': { start: { line: 182, column: 19 }, end: { line: 182, column: 24 } }, '109': { start: { line: 183, column: 6 }, end: { line: 202, column: 7 } }, '110': { start: { line: 184, column: 8 }, end: { line: 201, column: 9 } }, '111': { start: { line: 185, column: 10 }, end: { line: 185, column: 50 } }, '112': { start: { line: 186, column: 10 }, end: { line: 200, column: 11 } }, '113': { start: { line: 188, column: 12 }, end: { line: 188, column: 65 } }, '114': { start: { line: 189, column: 12 }, end: { line: 192, column: 13 } }, '115': { start: { line: 191, column: 14 }, end: { line: 191, column: 43 } }, '116': { start: { line: 194, column: 12 }, end: { line: 194, column: 27 } }, '117': { start: { line: 195, column: 12 }, end: { line: 195, column: 81 } }, '118': { start: { line: 196, column: 12 }, end: { line: 196, column: 40 } }, '119': { start: { line: 197, column: 12 }, end: { line: 197, column: 53 } }, '120': { start: { line: 198, column: 12 }, end: { line: 198, column: 26 } }, '121': { start: { line: 199, column: 12 }, end: { line: 199, column: 18 } }, '122': { start: { line: 203, column: 6 }, end: { line: 206, column: 7 } }, '123': { start: { line: 205, column: 8 }, end: { line: 205, column: 40 } }, '124': { start: { line: 209, column: 6 }, end: { line: 209, column: 56 } }, '125': { start: { line: 210, column: 6 }, end: { line: 210, column: 56 } }, '126': { start: { line: 211, column: 6 }, end: { line: 211, column: 75 } }, '127': { start: { line: 212, column: 6 }, end: { line: 212, column: 34 } }, '128': { start: { line: 216, column: 2 }, end: { line: 216, column: 35 } }, '129': { start: { line: 218, column: 0 }, end: { line: 218, column: 33 } }, '130': { start: { line: 220, column: 14 }, end: { line: 229, column: 1 } }, '131': { start: { line: 222, column: 4 }, end: { line: 222, column: 17 } }, '132': { start: { line: 225, column: 4 }, end: { line: 227, column: 6 } }, '133': { start: { line: 226, column: 6 }, end: { line: 226, column: 31 } }, '134': { start: { line: 231, column: 25 }, end: { line: 314, column: 1 } }, '135': { start: { line: 232, column: 2 }, end: { line: 234, column: 3 } }, '136': { start: { line: 233, column: 4 }, end: { line: 233, column: 11 } }, '137': { start: { line: 235, column: 2 }, end: { line: 237, column: 3 } }, '138': { start: { line: 236, column: 4 }, end: { line: 236, column: 11 } }, '139': { start: { line: 238, column: 14 }, end: { line: 238, column: 20 } }, '140': { start: { line: 239, column: 15 }, end: { line: 239, column: 21 } }, '141': { start: { line: 241, column: 14 }, end: { line: 241, column: 27 } }, '142': { start: { line: 242, column: 14 }, end: { line: 242, column: 26 } }, '143': { start: { line: 245, column: 17 }, end: { line: 245, column: 19 } }, '144': { start: { line: 246, column: 17 }, end: { line: 246, column: 19 } }, '145': { start: { line: 247, column: 17 }, end: { line: 247, column: 19 } }, '146': { start: { line: 248, column: 2 }, end: { line: 273, column: 3 } }, '147': { start: { line: 249, column: 4 }, end: { line: 272, column: 5 } }, '148': { start: { line: 250, column: 6 }, end: { line: 271, column: 7 } }, '149': { start: { line: 252, column: 8 }, end: { line: 256, column: 9 } }, '150': { start: { line: 253, column: 10 }, end: { line: 253, column: 54 } }, '151': { start: { line: 255, column: 10 }, end: { line: 255, column: 137 } }, '152': { start: { line: 258, column: 8 }, end: { line: 270, column: 9 } }, '153': { start: { line: 260, column: 10 }, end: { line: 263, column: 13 } }, '154': { start: { line: 266, column: 10 }, end: { line: 269, column: 13 } }, '155': { start: { line: 276, column: 2 }, end: { line: 276, column: 48 } }, '156': { start: { line: 277, column: 2 }, end: { line: 288, column: 3 } }, '157': { start: { line: 278, column: 4 }, end: { line: 278, column: 29 } }, '158': { start: { line: 279, column: 20 }, end: { line: 279, column: 39 } }, '159': { start: { line: 280, column: 23 }, end: { line: 280, column: 49 } }, '160': { start: { line: 281, column: 4 }, end: { line: 287, column: 5 } }, '161': { start: { line: 283, column: 6 }, end: { line: 286, column: 9 } }, '162': { start: { line: 291, column: 2 }, end: { line: 291, column: 59 } }, '163': { start: { line: 292, column: 23 }, end: { line: 292, column: 38 } }, '164': { start: { line: 293, column: 2 }, end: { line: 296, column: 3 } }, '165': { start: { line: 294, column: 20 }, end: { line: 294, column: 35 } }, '166': { start: { line: 295, column: 4 }, end: { line: 295, column: 54 } }, '167': { start: { line: 299, column: 23 }, end: { line: 299, column: 38 } }, '168': { start: { line: 300, column: 14 }, end: { line: 300, column: 20 } }, '169': { start: { line: 301, column: 2 }, end: { line: 307, column: 3 } }, '170': { start: { line: 302, column: 4 }, end: { line: 306, column: 5 } }, '171': { start: { line: 303, column: 25 }, end: { line: 303, column: 40 } }, '172': { start: { line: 304, column: 6 }, end: { line: 304, column: 85 } }, '173': { start: { line: 305, column: 6 }, end: { line: 305, column: 46 } }, '174': { start: { line: 309, column: 2 }, end: { line: 312, column: 3 } }, '175': { start: { line: 310, column: 4 }, end: { line: 310, column: 43 } }, '176': { start: { line: 311, column: 4 }, end: { line: 311, column: 11 } }, '177': { start: { line: 313, column: 2 }, end: { line: 313, column: 17 } }, '178': { start: { line: 315, column: 0 }, end: { line: 315, column: 34 } }, '179': { start: { line: 317, column: 40 }, end: { line: 331, column: 1 } }, '180': { start: { line: 318, column: 2 }, end: { line: 320, column: 3 } }, '181': { start: { line: 319, column: 4 }, end: { line: 319, column: 11 } }, '182': { start: { line: 321, column: 2 }, end: { line: 323, column: 3 } }, '183': { start: { line: 322, column: 4 }, end: { line: 322, column: 11 } }, '184': { start: { line: 324, column: 15 }, end: { line: 324, column: 38 } }, '185': { start: { line: 325, column: 14 }, end: { line: 325, column: 20 } }, '186': { start: { line: 326, column: 2 }, end: { line: 329, column: 3 } }, '187': { start: { line: 327, column: 4 }, end: { line: 327, column: 36 } }, '188': { start: { line: 328, column: 4 }, end: { line: 328, column: 49 } }, '189': { start: { line: 330, column: 2 }, end: { line: 330, column: 41 } }, '190': { start: { line: 332, column: 0 }, end: { line: 332, column: 64 } }, '191': { start: { line: 334, column: 27 }, end: { line: 355, column: 1 } }, '192': { start: { line: 335, column: 2 }, end: { line: 341, column: 3 } }, '193': { start: { line: 336, column: 4 }, end: { line: 339, column: 5 } }, '194': { start: { line: 337, column: 6 }, end: { line: 337, column: 47 } }, '195': { start: { line: 338, column: 6 }, end: { line: 338, column: 106 } }, '196': { start: { line: 340, column: 4 }, end: { line: 340, column: 11 } }, '197': { start: { line: 342, column: 2 }, end: { line: 344, column: 3 } }, '198': { start: { line: 343, column: 4 }, end: { line: 343, column: 11 } }, '199': { start: { line: 345, column: 13 }, end: { line: 345, column: 19 } }, '200': { start: { line: 346, column: 14 }, end: { line: 346, column: 20 } }, '201': { start: { line: 347, column: 2 }, end: { line: 353, column: 3 } }, '202': { start: { line: 348, column: 4 }, end: { line: 350, column: 5 } }, '203': { start: { line: 349, column: 6 }, end: { line: 349, column: 15 } }, '204': { start: { line: 351, column: 4 }, end: { line: 351, column: 52 } }, '205': { start: { line: 352, column: 4 }, end: { line: 352, column: 30 } }, '206': { start: { line: 354, column: 2 }, end: { line: 354, column: 17 } }, '207': { start: { line: 356, column: 0 }, end: { line: 356, column: 36 } }, '208': { start: { line: 358, column: 29 }, end: { line: 392, column: 1 } }, '209': { start: { line: 359, column: 2 }, end: { line: 363, column: 3 } }, '210': { start: { line: 360, column: 4 }, end: { line: 360, column: 41 } }, '211': { start: { line: 361, column: 9 }, end: { line: 363, column: 3 } }, '212': { start: { line: 362, column: 4 }, end: { line: 362, column: 23 } }, '213': { start: { line: 365, column: 21 }, end: { line: 365, column: 27 } }, '214': { start: { line: 366, column: 2 }, end: { line: 389, column: 3 } }, '215': { start: { line: 367, column: 20 }, end: { line: 367, column: 37 } }, '216': { start: { line: 368, column: 4 }, end: { line: 388, column: 5 } }, '217': { start: { line: 369, column: 6 }, end: { line: 387, column: 7 } }, '218': { start: { line: 370, column: 28 }, end: { line: 370, column: 62 } }, '219': { start: { line: 371, column: 26 }, end: { line: 371, column: 38 } }, '220': { start: { line: 372, column: 8 }, end: { line: 374, column: 9 } }, '221': { start: { line: 373, column: 10 }, end: { line: 373, column: 31 } }, '222': { start: { line: 375, column: 8 }, end: { line: 379, column: 9 } }, '223': { start: { line: 376, column: 10 }, end: { line: 376, column: 25 } }, '224': { start: { line: 377, column: 15 }, end: { line: 379, column: 9 } }, '225': { start: { line: 378, column: 10 }, end: { line: 378, column: 25 } }, '226': { start: { line: 380, column: 13 }, end: { line: 387, column: 7 } }, '227': { start: { line: 381, column: 26 }, end: { line: 381, column: 60 } }, '228': { start: { line: 382, column: 8 }, end: { line: 384, column: 9 } }, '229': { start: { line: 383, column: 10 }, end: { line: 383, column: 25 } }, '230': { start: { line: 385, column: 13 }, end: { line: 387, column: 7 } }, '231': { start: { line: 386, column: 8 }, end: { line: 386, column: 23 } }, '232': { start: { line: 391, column: 2 }, end: { line: 391, column: 22 } }, '233': { start: { line: 395, column: 2 }, end: { line: 397, column: 3 } }, '234': { start: { line: 396, column: 4 }, end: { line: 396, column: 11 } }, '235': { start: { line: 398, column: 2 }, end: { line: 400, column: 3 } }, '236': { start: { line: 399, column: 4 }, end: { line: 399, column: 11 } }, '237': { start: { line: 401, column: 15 }, end: { line: 401, column: 38 } }, '238': { start: { line: 402, column: 14 }, end: { line: 402, column: 20 } }, '239': { start: { line: 403, column: 14 }, end: { line: 405, column: 3 } }, '240': { start: { line: 407, column: 2 }, end: { line: 416, column: 3 } }, '241': { start: { line: 408, column: 4 }, end: { line: 408, column: 36 } }, '242': { start: { line: 409, column: 15 }, end: { line: 409, column: 28 } }, '243': { start: { line: 410, column: 4 }, end: { line: 412, column: 5 } }, '244': { start: { line: 411, column: 6 }, end: { line: 411, column: 82 } }, '245': { start: { line: 413, column: 4 }, end: { line: 415, column: 5 } }, '246': { start: { line: 414, column: 6 }, end: { line: 414, column: 33 } }, '247': { start: { line: 417, column: 2 }, end: { line: 417, column: 34 } }, '248': { start: { line: 419, column: 0 }, end: { line: 419, column: 66 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 9, column: 68 }, end: { line: 9, column: 69 } }, loc: { start: { line: 9, column: 81 }, end: { line: 11, column: 1 } }, line: 9 }, '1': { name: '(anonymous_1)', decl: { start: { line: 13, column: 67 }, end: { line: 13, column: 68 } }, loc: { start: { line: 13, column: 90 }, end: { line: 15, column: 1 } }, line: 13 }, '2': { name: '(anonymous_2)', decl: { start: { line: 15, column: 4 }, end: { line: 15, column: 5 } }, loc: { start: { line: 15, column: 27 }, end: { line: 23, column: 1 } }, line: 15 }, '3': { name: 'arraysHaveMatchByRef', decl: { start: { line: 25, column: 9 }, end: { line: 25, column: 29 } }, loc: { start: { line: 25, column: 58 }, end: { line: 35, column: 1 } }, line: 25 }, '4': { name: 'matchItems', decl: { start: { line: 37, column: 9 }, end: { line: 37, column: 19 } }, loc: { start: { line: 37, column: 61 }, end: { line: 78, column: 1 } }, line: 37 }, '5': { name: 'arraysDiffFilter', decl: { start: { line: 80, column: 33 }, end: { line: 80, column: 49 } }, loc: { start: { line: 80, column: 59 }, end: { line: 217, column: 1 } }, line: 80 }, '6': { name: 'numerically', decl: { start: { line: 221, column: 24 }, end: { line: 221, column: 35 } }, loc: { start: { line: 221, column: 42 }, end: { line: 223, column: 3 } }, line: 221 }, '7': { name: 'numericallyBy', decl: { start: { line: 224, column: 26 }, end: { line: 224, column: 39 } }, loc: { start: { line: 224, column: 46 }, end: { line: 228, column: 3 } }, line: 224 }, '8': { name: '(anonymous_8)', decl: { start: { line: 225, column: 11 }, end: { line: 225, column: 12 } }, loc: { start: { line: 225, column: 27 }, end: { line: 227, column: 5 } }, line: 225 }, '9': { name: 'nestedPatchFilter', decl: { start: { line: 231, column: 34 }, end: { line: 231, column: 51 } }, loc: { start: { line: 231, column: 61 }, end: { line: 314, column: 1 } }, line: 231 }, '10': { name: 'collectChildrenPatchFilter', decl: { start: { line: 317, column: 49 }, end: { line: 317, column: 75 } }, loc: { start: { line: 317, column: 85 }, end: { line: 331, column: 1 } }, line: 317 }, '11': { name: 'arraysReverseFilter', decl: { start: { line: 334, column: 36 }, end: { line: 334, column: 55 } }, loc: { start: { line: 334, column: 65 }, end: { line: 355, column: 1 } }, line: 334 }, '12': { name: 'reverseArrayDeltaIndex', decl: { start: { line: 358, column: 38 }, end: { line: 358, column: 60 } }, loc: { start: { line: 358, column: 86 }, end: { line: 392, column: 1 } }, line: 358 }, '13': { name: 'collectChildrenReverseFilter', decl: { start: { line: 394, column: 16 }, end: { line: 394, column: 44 } }, loc: { start: { line: 394, column: 54 }, end: { line: 418, column: 1 } }, line: 394 } }, branchMap: { '0': { loc: { start: { line: 9, column: 14 }, end: { line: 11, column: 1 } }, type: 'cond-expr', locations: [{ start: { line: 9, column: 52 }, end: { line: 9, column: 65 } }, { start: { line: 9, column: 68 }, end: { line: 11, column: 1 } }], line: 9 }, '1': { loc: { start: { line: 13, column: 19 }, end: { line: 23, column: 1 } }, type: 'cond-expr', locations: [{ start: { line: 13, column: 67 }, end: { line: 15, column: 1 } }, { start: { line: 15, column: 4 }, end: { line: 23, column: 1 } }], line: 13 }, '2': { loc: { start: { line: 18, column: 4 }, end: { line: 20, column: 5 } }, type: 'if', locations: [{ start: { line: 18, column: 4 }, end: { line: 20, column: 5 } }, { start: { line: 18, column: 4 }, end: { line: 20, column: 5 } }], line: 18 }, '3': { loc: { start: { line: 30, column: 6 }, end: { line: 32, column: 7 } }, type: 'if', locations: [{ start: { line: 30, column: 6 }, end: { line: 32, column: 7 } }, { start: { line: 30, column: 6 }, end: { line: 32, column: 7 } }], line: 30 }, '4': { loc: { start: { line: 30, column: 10 }, end: { line: 30, column: 44 } }, type: 'binary-expr', locations: [{ start: { line: 30, column: 10 }, end: { line: 30, column: 27 } }, { start: { line: 30, column: 31 }, end: { line: 30, column: 44 } }], line: 30 }, '5': { loc: { start: { line: 40, column: 2 }, end: { line: 42, column: 3 } }, type: 'if', locations: [{ start: { line: 40, column: 2 }, end: { line: 42, column: 3 } }, { start: { line: 40, column: 2 }, end: { line: 42, column: 3 } }], line: 40 }, '6': { loc: { start: { line: 43, column: 2 }, end: { line: 45, column: 3 } }, type: 'if', locations: [{ start: { line: 43, column: 2 }, end: { line: 45, column: 3 } }, { start: { line: 43, column: 2 }, end: { line: 45, column: 3 } }], line: 43 }, '7': { loc: { start: { line: 43, column: 6 }, end: { line: 43, column: 186 } }, type: 'binary-expr', locations: [{ start: { line: 43, column: 6 }, end: { line: 43, column: 94 } }, { start: { line: 43, column: 98 }, end: { line: 43, column: 186 } }], line: 43 }, '8': { loc: { start: { line: 43, column: 7 }, end: { line: 43, column: 80 } }, type: 'cond-expr', locations: [{ start: { line: 43, column: 39 }, end: { line: 43, column: 50 } }, { start: { line: 43, column: 53 }, end: { line: 43, column: 80 } }], line: 43 }, '9': { loc: { start: { line: 43, column: 99 }, end: { line: 43, column: 172 } }, type: 'cond-expr', locations: [{ start: { line: 43, column: 131 }, end: { line: 43, column: 142 } }, { start: { line: 43, column: 145 }, end: { line: 43, column: 172 } }], line: 43 }, '10': { loc: { start: { line: 47, column: 2 }, end: { line: 50, column: 3 } }, type: 'if', locations: [{ start: { line: 47, column: 2 }, end: { line: 50, column: 3 } }, { start: { line: 47, column: 2 }, end: { line: 50, column: 3 } }], line: 47 }, '11': { loc: { start: { line: 49, column: 11 }, end: { line: 49, column: 55 } }, type: 'binary-expr', locations: [{ start: { line: 49, column: 11 }, end: { line: 49, column: 34 } }, { start: { line: 49, column: 38 }, end: { line: 49, column: 55 } }], line: 49 }, '12': { loc: { start: { line: 53, column: 2 }, end: { line: 61, column: 3 } }, type: 'if', locations: [{ start: { line: 53, column: 2 }, end: { line: 61, column: 3 } }, { start: { line: 53, column: 2 }, end: { line: 61, column: 3 } }], line: 53 }, '13': { loc: { start: { line: 54, column: 25 }, end: { line: 54, column: 49 } }, type: 'binary-expr', locations: [{ start: { line: 54, column: 25 }, end: { line: 54, column: 43 } }, { start: { line: 54, column: 47 }, end: { line: 54, column: 49 } }], line: 54 }, '14': { loc: { start: { line: 56, column: 4 }, end: { line: 58, column: 5 } }, type: 'if', locations: [{ start: { line: 56, column: 4 }, end: { line: 58, column: 5 } }, { start: { line: 56, column: 4 }, end: { line: 58, column: 5 } }], line: 56 }, '15': { loc: { start: { line: 62, column: 2 }, end: { line: 64, column: 3 } }, type: 'if', locations: [{ start: { line: 62, column: 2 }, end: { line: 64, column: 3 } }, { start: { line: 62, column: 2 }, end: { line: 64, column: 3 } }], line: 62 }, '16': { loc: { start: { line: 65, column: 2 }, end: { line: 73, column: 3 } }, type: 'if', locations: [{ start: { line: 65, column: 2 }, end: { line: 73, column: 3 } }, { start: { line: 65, column: 2 }, end: { line: 73, column: 3 } }], line: 65 }, '17': { loc: { start: { line: 66, column: 25 }, end: { line: 66, column: 49 } }, type: 'binary-expr', locations: [{ start: { line: 66, column: 25 }, end: { line: 66, column: 43 } }, { start: { line: 66, column: 47 }, end: { line: 66, column: 49 } }], line: 66 }, '18': { loc: { start: { line: 68, column: 4 }, end: { line: 70, column: 5 } }, type: 'if', locations: [{ start: { line: 68, column: 4 }, end: { line: 70, column: 5 } }, { start: { line: 68, column: 4 }, end: { line: 70, column: 5 } }], line: 68 }, '19': { loc: { start: { line: 74, column: 2 }, end: { line: 76, column: 3 } }, type: 'if', locations: [{ start: { line: 74, column: 2 }, end: { line: 76, column: 3 } }, { start: { line: 74, column: 2 }, end: { line: 76, column: 3 } }], line: 74 }, '20': { loc: { start: { line: 81, column: 2 }, end: { line: 83, column: 3 } }, type: 'if', locations: [{ start: { line: 81, column: 2 }, end: { line: 83, column: 3 } }, { start: { line: 81, column: 2 }, end: { line: 83, column: 3 } }], line: 81 }, '21': { loc: { start: { line: 86, column: 16 }, end: { line: 86, column: 61 } }, type: 'binary-expr', locations: [{ start: { line: 86, column: 16 }, end: { line: 86, column: 31 } }, { start: { line: 86, column: 35 }, end: { line: 86, column: 61 } }], line: 86 }, '22': { loc: { start: { line: 87, column: 21 }, end: { line: 87, column: 71 } }, type: 'binary-expr', locations: [{ start: { line: 87, column: 21 }, end: { line: 87, column: 36 } }, { start: { line: 87, column: 40 }, end: { line: 87, column: 71 } }], line: 87 }, '23': { loc: { start: { line: 101, column: 2 }, end: { line: 103, column: 3 } }, type: 'if', locations: [{ start: { line: 101, column: 2 }, end: { line: 103, column: 3 } }, { start: { line: 101, column: 2 }, end: { line: 103, column: 3 } }], line: 101 }, '24': { loc: { start: { line: 101, column: 6 }, end: { line: 101, column: 107 } }, type: 'binary-expr', locations: [{ start: { line: 101, column: 6 }, end: { line: 101, column: 14 } }, { start: { line: 101, column: 18 }, end: { line: 101, column: 26 } }, { start: { line: 101, column: 30 }, end: { line: 101, column: 54 } }, { start: { line: 101, column: 58 }, end: { line: 101, column: 107 } }], line: 101 }, '25': { loc: { start: { line: 106, column: 9 }, end: { line: 106, column: 115 } }, type: 'binary-expr', locations: [{ start: { line: 106, column: 9 }, end: { line: 106, column: 26 } }, { start: { line: 106, column: 30 }, end: { line: 106, column: 47 } }, { start: { line: 106, column: 51 }, end: { line: 106, column: 115 } }], line: 106 }, '26': { loc: { start: { line: 113, column: 9 }, end: { line: 113, column: 163 } }, type: 'binary-expr', locations: [{ start: { line: 113, column: 9 }, end: { line: 113, column: 39 } }, { start: { line: 113, column: 43 }, end: { line: 113, column: 73 } }, { start: { line: 113, column: 77 }, end: { line: 113, column: 163 } }], line: 113 }, '27': { loc: { start: { line: 121, column: 2 }, end: { line: 136, column: 3 } }, type: 'if', locations: [{ start: { line: 121, column: 2 }, end: { line: 136, column: 3 } }, { start: { line: 121, column: 2 }, end: { line: 136, column: 3 } }], line: 121 }, '28': { loc: { start: { line: 122, column: 4 }, end: { line: 126, column: 5 } }, type: 'if', locations: [{ start: { line: 122, column: 4 }, end: { line: 126, column: 5 } }, { start: { line: 122, column: 4 }, end: { line: 126, column: 5 } }], line: 122 }, '29': { loc: { start: { line: 128, column: 13 }, end: { line: 130, column: 5 } }, type: 'binary-expr', locations: [{ start: { line: 128, column: 13 }, end: { line: 128, column: 19 } }, { start: { line: 128, column: 23 }, end: { line: 130, column: 5 } }], line: 128 }, '30': { loc: { start: { line: 137, column: 2 }, end: { line: 147, column: 3 } }, type: 'if', locations: [{ start: { line: 137, column: 2 }, end: { line: 147, column: 3 } }, { start: { line: 137, column: 2 }, end: { line: 147, column: 3 } }], line: 137 }, '31': { loc: { start: { line: 139, column: 13 }, end: { line: 141, column: 5 } }, type: 'binary-expr', locations: [{ start: { line: 139, column: 13 }, end: { line: 139, column: 19 } }, { start: { line: 139, column: 23 }, end: { line: 141, column: 5 } }], line: 139 }, '32': { loc: { start: { line: 157, column: 11 }, end: { line: 159, column: 3 } }, type: 'binary-expr', locations: [{ start: { line: 157, column: 11 }, end: { line: 157, column: 17 } }, { start: { line: 157, column: 21 }, end: { line: 159, column: 3 } }], line: 157 }, '33': { loc: { start: { line: 161, column: 4 }, end: { line: 165, column: 5 } }, type: 'if', locations: [{ start: { line: 161, column: 4 }, end: { line: 165, column: 5 } }, { start: { line: 161, column: 4 }, end: { line: 165, column: 5 } }], line: 161 }, '34': { loc: { start: { line: 169, column: 2 }, end: { line: 171, column: 3 } }, type: 'if', locations: [{ start: { line: 169, column: 2 }, end: { line: 171, column: 3 } }, { start: { line: 169, column: 2 }, end: { line: 171, column: 3 } }], line: 169 }, '35': { loc: { start: { line: 169, column: 6 }, end: { line: 169, column: 94 } }, type: 'binary-expr', locations: [{ start: { line: 169, column: 6 }, end: { line: 169, column: 21 } }, { start: { line: 169, column: 25 }, end: { line: 169, column: 47 } }, { start: { line: 169, column: 51 }, end: { line: 169, column: 94 } }], line: 169 }, '36': { loc: { start: { line: 173, column: 2 }, end: { line: 175, column: 3 } }, type: 'if', locations: [{ start: { line: 173, column: 2 }, end: { line: 175, column: 3 } }, { start: { line: 173, column: 2 }, end: { line: 175, column: 3 } }], line: 173 }, '37': { loc: { start: { line: 173, column: 6 }, end: { line: 173, column: 92 } }, type: 'binary-expr', locations: [{ start: { line: 173, column: 6 }, end: { line: 173, column: 21 } }, { start: { line: 173, column: 25 }, end: { line: 173, column: 47 } }, { start: { line: 173, column: 51 }, end: { line: 173, column: 92 } }], line: 173 }, '38': { loc: { start: { line: 180, column: 4 }, end: { line: 213, column: 5 } }, type: 'if', locations: [{ start: { line: 180, column: 4 }, end: { line: 213, column: 5 } }, { start: { line: 180, column: 4 }, end: { line: 213, column: 5 } }], line: 180 }, '39': { loc: { start: { line: 183, column: 6 }, end: { line: 202, column: 7 } }, type: 'if', locations: [{ start: { line: 183, column: 6 }, end: { line: 202, column: 7 } }, { start: { line: 183, column: 6 }, end: { line: 202, column: 7 } }], line: 183 }, '40': { loc: { start: { line: 183, column: 10 }, end: { line: 183, column: 46 } }, type: 'binary-expr', locations: [{ start: { line: 183, column: 10 }, end: { line: 183, column: 20 } }, { start: { line: 183, column: 24 }, end: { line: 183, column: 46 } }], line: 183 }, '41': { loc: { start: { line: 186, column: 10 }, end: { line: 200, column: 11 } }, type: 'if', locations: [{ start: { line: 186, column: 10 }, end: { line: 200, column: 11 } }, { start: { line: 186, column: 10 }, end: { line: 200, column: 11 } }], line: 186 }, '42': { loc: { start: { line: 189, column: 12 }, end: { line: 192, column: 13 } }, type: 'if', locations: [{ start: { line: 189, column: 12 }, end: { line: 192, column: 13 } }, { start: { line: 189, column: 12 }, end: { line: 192, column: 13 } }], line: 189 }, '43': { loc: { start: { line: 203, column: 6 }, end: { line: 206, column: 7 } }, type: 'if', locations: [{ start: { line: 203, column: 6 }, end: { line: 206, column: 7 } }, { start: { line: 203, column: 6 }, end: { line: 206, column: 7 } }], line: 203 }, '44': { loc: { start: { line: 232, column: 2 }, end: { line: 234, column: 3 } }, type: 'if', locations: [{ start: { line: 232, column: 2 }, end: { line: 234, column: 3 } }, { start: { line: 232, column: 2 }, end: { line: 234, column: 3 } }], line: 232 }, '45': { loc: { start: { line: 235, column: 2 }, end: { line: 237, column: 3 } }, type: 'if', locations: [{ start: { line: 235, column: 2 }, end: { line: 237, column: 3 } }, { start: { line: 235, column: 2 }, end: { line: 237, column: 3 } }], line: 235 }, '46': { loc: { start: { line: 249, column: 4 }, end: { line: 272, column: 5 } }, type: 'if', locations: [{ start: { line: 249, column: 4 }, end: { line: 272, column: 5 } }, { start: { line: 249, column: 4 }, end: { line: 272, column: 5 } }], line: 249 }, '47': { loc: { start: { line: 250, column: 6 }, end: { line: 271, column: 7 } }, type: 'if', locations: [{ start: { line: 250, column: 6 }, end: { line: 271, column: 7 } }, { start: { line: 250, column: 6 }, end: { line: 271, column: 7 } }], line: 250 }, '48': { loc: { start: { line: 252, column: 8 }, end: { line: 256, column: 9 } }, type: 'if', locations: [{ start: { line: 252, column: 8 }, end: { line: 256, column: 9 } }, { start: { line: 252, column: 8 }, end: { line: 256, column: 9 } }], line: 252 }, '49': { loc: { start: { line: 252, column: 12 }, end: { line: 252, column: 67 } }, type: 'binary-expr', locations: [{ start: { line: 252, column: 12 }, end: { line: 252, column: 33 } }, { start: { line: 252, column: 37 }, end: { line: 252, column: 67 } }], line: 252 }, '50': { loc: { start: { line: 258, column: 8 }, end: { line: 270, column: 9 } }, type: 'if', locations: [{ start: { line: 258, column: 8 }, end: { line: 270, column: 9 } }, { start: { line: 258, column: 8 }, end: { line: 270, column: 9 } }], line: 258 }, '51': { loc: { start: { line: 281, column: 4 }, end: { line: 287, column: 5 } }, type: 'if', locations: [{ start: { line: 281, column: 4 }, end: { line: 287, column: 5 } }, { start: { line: 281, column: 4 }, end: { line: 287, column: 5 } }], line: 281 }, '52': { loc: { start: { line: 301, column: 2 }, end: { line: 307, column: 3 } }, type: 'if', locations: [{ start: { line: 301, column: 2 }, end: { line: 307, column: 3 } }, { start: { line: 301, column: 2 }, end: { line: 307, column: 3 } }], line: 301 }, '53': { loc: { start: { line: 309, column: 2 }, end: { line: 312, column: 3 } }, type: 'if', locations: [{ start: { line: 309, column: 2 }, end: { line: 312, column: 3 } }, { start: { line: 309, column: 2 }, end: { line: 312, column: 3 } }], line: 309 }, '54': { loc: { start: { line: 318, column: 2 }, end: { line: 320, column: 3 } }, type: 'if', locations: [{ start: { line: 318, column: 2 }, end: { line: 320, column: 3 } }, { start: { line: 318, column: 2 }, end: { line: 320, column: 3 } }], line: 318 }, '55': { loc: { start: { line: 318, column: 6 }, end: { line: 318, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 318, column: 6 }, end: { line: 318, column: 14 } }, { start: { line: 318, column: 18 }, end: { line: 318, column: 35 } }], line: 318 }, '56': { loc: { start: { line: 321, column: 2 }, end: { line: 323, column: 3 } }, type: 'if', locations: [{ start: { line: 321, column: 2 }, end: { line: 323, column: 3 } }, { start: { line: 321, column: 2 }, end: { line: 323, column: 3 } }], line: 321 }, '57': { loc: { start: { line: 335, column: 2 }, end: { line: 341, column: 3 } }, type: 'if', locations: [{ start: { line: 335, column: 2 }, end: { line: 341, column: 3 } }, { start: { line: 335, column: 2 }, end: { line: 341, column: 3 } }], line: 335 }, '58': { loc: { start: { line: 336, column: 4 }, end: { line: 339, column: 5 } }, type: 'if', locations: [{ start: { line: 336, column: 4 }, end: { line: 339, column: 5 } }, { start: { line: 336, column: 4 }, end: { line: 339, column: 5 } }], line: 336 }, '59': { loc: { start: { line: 342, column: 2 }, end: { line: 344, column: 3 } }, type: 'if', locations: [{ start: { line: 342, column: 2 }, end: { line: 344, column: 3 } }, { start: { line: 342, column: 2 }, end: { line: 344, column: 3 } }], line: 342 }, '60': { loc: { start: { line: 348, column: 4 }, end: { line: 350, column: 5 } }, type: 'if', locations: [{ start: { line: 348, column: 4 }, end: { line: 350, column: 5 } }, { start: { line: 348, column: 4 }, end: { line: 350, column: 5 } }], line: 348 }, '61': { loc: { start: { line: 359, column: 2 }, end: { line: 363, column: 3 } }, type: 'if', locations: [{ start: { line: 359, column: 2 }, end: { line: 363, column: 3 } }, { start: { line: 359, column: 2 }, end: { line: 363, column: 3 } }], line: 359 }, '62': { loc: { start: { line: 359, column: 6 }, end: { line: 359, column: 51 } }, type: 'binary-expr', locations: [{ start: { line: 359, column: 6 }, end: { line: 359, column: 31 } }, { start: { line: 359, column: 35 }, end: { line: 359, column: 51 } }], line: 359 }, '63': { loc: { start: { line: 361, column: 9 }, end: { line: 363, column: 3 } }, type: 'if', locations: [{ start: { line: 361, column: 9 }, end: { line: 363, column: 3 } }, { start: { line: 361, column: 9 }, end: { line: 363, column: 3 } }], line: 361 }, '64': { loc: { start: { line: 361, column: 13 }, end: { line: 361, column: 53 } }, type: 'binary-expr', locations: [{ start: { line: 361, column: 13 }, end: { line: 361, column: 31 } }, { start: { line: 361, column: 35 }, end: { line: 361, column: 53 } }], line: 361 }, '65': { loc: { start: { line: 368, column: 4 }, end: { line: 388, column: 5 } }, type: 'if', locations: [{ start: { line: 368, column: 4 }, end: { line: 388, column: 5 } }, { start: { line: 368, column: 4 }, end: { line: 388, column: 5 } }], line: 368 }, '66': { loc: { start: { line: 369, column: 6 }, end: { line: 387, column: 7 } }, type: 'if', locations: [{ start: { line: 369, column: 6 }, end: { line: 387, column: 7 } }, { start: { line: 369, column: 6 }, end: { line: 387, column: 7 } }], line: 369 }, '67': { loc: { start: { line: 372, column: 8 }, end: { line: 374, column: 9 } }, type: 'if', locations: [{ start: { line: 372, column: 8 }, end: { line: 374, column: 9 } }, { start: { line: 372, column: 8 }, end: { line: 374, column: 9 } }], line: 372 }, '68': { loc: { start: { line: 375, column: 8 }, end: { line: 379, column: 9 } }, type: 'if', locations: [{ start: { line: 375, column: 8 }, end: { line: 379, column: 9 } }, { start: { line: 375, column: 8 }, end: { line: 379, column: 9 } }], line: 375 }, '69': { loc: { start: { line: 375, column: 12 }, end: { line: 375, column: 71 } }, type: 'binary-expr', locations: [{ start: { line: 375, column: 12 }, end: { line: 375, column: 41 } }, { start: { line: 375, column: 45 }, end: { line: 375, column: 71 } }], line: 375 }, '70': { loc: { start: { line: 377, column: 15 }, end: { line: 379, column: 9 } }, type: 'if', locations: [{ start: { line: 377, column: 15 }, end: { line: 379, column: 9 } }, { start: { line: 377, column: 15 }, end: { line: 379, column: 9 } }], line: 377 }, '71': { loc: { start: { line: 377, column: 19 }, end: { line: 377, column: 78 } }, type: 'binary-expr', locations: [{ start: { line: 377, column: 19 }, end: { line: 377, column: 48 } }, { start: { line: 377, column: 52 }, end: { line: 377, column: 78 } }], line: 377 }, '72': { loc: { start: { line: 380, column: 13 }, end: { line: 387, column: 7 } }, type: 'if', locations: [{ start: { line: 380, column: 13 }, end: { line: 387, column: 7 } }, { start: { line: 380, column: 13 }, end: { line: 387, column: 7 } }], line: 380 }, '73': { loc: { start: { line: 382, column: 8 }, end: { line: 384, column: 9 } }, type: 'if', locations: [{ start: { line: 382, column: 8 }, end: { line: 384, column: 9 } }, { start: { line: 382, column: 8 }, end: { line: 384, column: 9 } }], line: 382 }, '74': { loc: { start: { line: 385, column: 13 }, end: { line: 387, column: 7 } }, type: 'if', locations: [{ start: { line: 385, column: 13 }, end: { line: 387, column: 7 } }, { start: { line: 385, column: 13 }, end: { line: 387, column: 7 } }], line: 385 }, '75': { loc: { start: { line: 385, column: 17 }, end: { line: 385, column: 69 } }, type: 'binary-expr', locations: [{ start: { line: 385, column: 17 }, end: { line: 385, column: 39 } }, { start: { line: 385, column: 43 }, end: { line: 385, column: 69 } }], line: 385 }, '76': { loc: { start: { line: 395, column: 2 }, end: { line: 397, column: 3 } }, type: 'if', locations: [{ start: { line: 395, column: 2 }, end: { line: 397, column: 3 } }, { start: { line: 395, column: 2 }, end: { line: 397, column: 3 } }], line: 395 }, '77': { loc: { start: { line: 395, column: 6 }, end: { line: 395, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 395, column: 6 }, end: { line: 395, column: 14 } }, { start: { line: 395, column: 18 }, end: { line: 395, column: 35 } }], line: 395 }, '78': { loc: { start: { line: 398, column: 2 }, end: { line: 400, column: 3 } }, type: 'if', locations: [{ start: { line: 398, column: 2 }, end: { line: 400, column: 3 } }, { start: { line: 398, column: 2 }, end: { line: 400, column: 3 } }], line: 398 }, '79': { loc: { start: { line: 410, column: 4 }, end: { line: 412, column: 5 } }, type: 'if', locations: [{ start: { line: 410, column: 4 }, end: { line: 412, column: 5 } }, { start: { line: 410, column: 4 }, end: { line: 412, column: 5 } }], line: 410 }, '80': { loc: { start: { line: 413, column: 4 }, end: { line: 415, column: 5 } }, type: 'if', locations: [{ start: { line: 413, column: 4 }, end: { line: 415, column: 5 } }, { start: { line: 413, column: 4 }, end: { line: 415, column: 5 } }], line: 413 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0, '86': 0, '87': 0, '88': 0, '89': 0, '90': 0, '91': 0, '92': 0, '93': 0, '94': 0, '95': 0, '96': 0, '97': 0, '98': 0, '99': 0, '100': 0, '101': 0, '102': 0, '103': 0, '104': 0, '105': 0, '106': 0, '107': 0, '108': 0, '109': 0, '110': 0, '111': 0, '112': 0, '113': 0, '114': 0, '115': 0, '116': 0, '117': 0, '118': 0, '119': 0, '120': 0, '121': 0, '122': 0, '123': 0, '124': 0, '125': 0, '126': 0, '127': 0, '128': 0, '129': 0, '130': 0, '131': 0, '132': 0, '133': 0, '134': 0, '135': 0, '136': 0, '137': 0, '138': 0, '139': 0, '140': 0, '141': 0, '142': 0, '143': 0, '144': 0, '145': 0, '146': 0, '147': 0, '148': 0, '149': 0, '150': 0, '151': 0, '152': 0, '153': 0, '154': 0, '155': 0, '156': 0, '157': 0, '158': 0, '159': 0, '160': 0, '161': 0, '162': 0, '163': 0, '164': 0, '165': 0, '166': 0, '167': 0, '168': 0, '169': 0, '170': 0, '171': 0, '172': 0, '173': 0, '174': 0, '175': 0, '176': 0, '177': 0, '178': 0, '179': 0, '180': 0, '181': 0, '182': 0, '183': 0, '184': 0, '185': 0, '186': 0, '187': 0, '188': 0, '189': 0, '190': 0, '191': 0, '192': 0, '193': 0, '194': 0, '195': 0, '196': 0, '197': 0, '198': 0, '199': 0, '200': 0, '201': 0, '202': 0, '203': 0, '204': 0, '205': 0, '206': 0, '207': 0, '208': 0, '209': 0, '210': 0, '211': 0, '212': 0, '213': 0, '214': 0, '215': 0, '216': 0, '217': 0, '218': 0, '219': 0, '220': 0, '221': 0, '222': 0, '223': 0, '224': 0, '225': 0, '226': 0, '227': 0, '228': 0, '229': 0, '230': 0, '231': 0, '232': 0, '233': 0, '234': 0, '235': 0, '236': 0, '237': 0, '238': 0, '239': 0, '240': 0, '241': 0, '242': 0, '243': 0, '244': 0, '245': 0, '246': 0, '247': 0, '248': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0], '20': [0, 0], '21': [0, 0], '22': [0, 0], '23': [0, 0], '24': [0, 0, 0, 0], '25': [0, 0, 0], '26': [0, 0, 0], '27': [0, 0], '28': [0, 0], '29': [0, 0], '30': [0, 0], '31': [0, 0], '32': [0, 0], '33': [0, 0], '34': [0, 0], '35': [0, 0, 0], '36': [0, 0], '37': [0, 0, 0], '38': [0, 0], '39': [0, 0], '40': [0, 0], '41': [0, 0], '42': [0, 0], '43': [0, 0], '44': [0, 0], '45': [0, 0], '46': [0, 0], '47': [0, 0], '48': [0, 0], '49': [0, 0], '50': [0, 0], '51': [0, 0], '52': [0, 0], '53': [0, 0], '54': [0, 0], '55': [0, 0], '56': [0, 0], '57': [0, 0], '58': [0, 0], '59': [0, 0], '60': [0, 0], '61': [0, 0], '62': [0, 0], '63': [0, 0], '64': [0, 0], '65': [0, 0], '66': [0, 0], '67': [0, 0], '68': [0, 0], '69': [0, 0], '70': [0, 0], '71': [0, 0], '72': [0, 0], '73': [0, 0], '74': [0, 0], '75': [0, 0], '76': [0, 0], '77': [0, 0], '78': [0, 0], '79': [0, 0], '80': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
2900 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
2901 return coverage[path];
2902 }coverageData.hash = hash;return coverage[path] = coverageData;
2903}();var ARRAY_MOVE = (cov_g15fjodrd.s[0]++, 3);var isArray$2 = (cov_g15fjodrd.s[1]++, typeof Array.isArray === 'function' ? (cov_g15fjodrd.b[0][0]++, Array.isArray) : (cov_g15fjodrd.b[0][1]++, function (a) {
2904 cov_g15fjodrd.f[0]++;cov_g15fjodrd.s[2]++;return a instanceof Array;
2905}));var arrayIndexOf = (cov_g15fjodrd.s[3]++, typeof Array.prototype.indexOf === 'function' ? (cov_g15fjodrd.b[1][0]++, function (array, item) {
2906 cov_g15fjodrd.f[1]++;cov_g15fjodrd.s[4]++;return array.indexOf(item);
2907}) : (cov_g15fjodrd.b[1][1]++, function (array, item) {
2908 cov_g15fjodrd.f[2]++;var length = (cov_g15fjodrd.s[5]++, array.length);cov_g15fjodrd.s[6]++;for (var i = 0; i < length; i++) {
2909 cov_g15fjodrd.s[7]++;if (array[i] === item) {
2910 cov_g15fjodrd.b[2][0]++;cov_g15fjodrd.s[8]++;return i;
2911 } else {
2912 cov_g15fjodrd.b[2][1]++;
2913 }
2914 }cov_g15fjodrd.s[9]++;return -1;
2915}));function arraysHaveMatchByRef(array1, array2, len1, len2) {
2916 cov_g15fjodrd.f[3]++;cov_g15fjodrd.s[10]++;for (var index1 = 0; index1 < len1; index1++) {
2917 var val1 = (cov_g15fjodrd.s[11]++, array1[index1]);cov_g15fjodrd.s[12]++;for (var index2 = 0; index2 < len2; index2++) {
2918 var val2 = (cov_g15fjodrd.s[13]++, array2[index2]);cov_g15fjodrd.s[14]++;if ((cov_g15fjodrd.b[4][0]++, index1 !== index2) && (cov_g15fjodrd.b[4][1]++, val1 === val2)) {
2919 cov_g15fjodrd.b[3][0]++;cov_g15fjodrd.s[15]++;return true;
2920 } else {
2921 cov_g15fjodrd.b[3][1]++;
2922 }
2923 }
2924 }
2925}function matchItems(array1, array2, index1, index2, context) {
2926 cov_g15fjodrd.f[4]++;var value1 = (cov_g15fjodrd.s[16]++, array1[index1]);var value2 = (cov_g15fjodrd.s[17]++, array2[index2]);cov_g15fjodrd.s[18]++;if (value1 === value2) {
2927 cov_g15fjodrd.b[5][0]++;cov_g15fjodrd.s[19]++;return true;
2928 } else {
2929 cov_g15fjodrd.b[5][1]++;
2930 }cov_g15fjodrd.s[20]++;if ((cov_g15fjodrd.b[7][0]++, (typeof value1 === 'undefined' ? (cov_g15fjodrd.b[8][0]++, 'undefined') : (cov_g15fjodrd.b[8][1]++, _typeof$1(value1))) !== 'object') || (cov_g15fjodrd.b[7][1]++, (typeof value2 === 'undefined' ? (cov_g15fjodrd.b[9][0]++, 'undefined') : (cov_g15fjodrd.b[9][1]++, _typeof$1(value2))) !== 'object')) {
2931 cov_g15fjodrd.b[6][0]++;cov_g15fjodrd.s[21]++;return false;
2932 } else {
2933 cov_g15fjodrd.b[6][1]++;
2934 }var objectHash = (cov_g15fjodrd.s[22]++, context.objectHash);cov_g15fjodrd.s[23]++;if (!objectHash) {
2935 cov_g15fjodrd.b[10][0]++;cov_g15fjodrd.s[24]++; // no way to match objects was provided, try match by position
2936 return (cov_g15fjodrd.b[11][0]++, context.matchByPosition) && (cov_g15fjodrd.b[11][1]++, index1 === index2);
2937 } else {
2938 cov_g15fjodrd.b[10][1]++;
2939 }var hash1 = (cov_g15fjodrd.s[25]++, void 0);var hash2 = (cov_g15fjodrd.s[26]++, void 0);cov_g15fjodrd.s[27]++;if (typeof index1 === 'number') {
2940 cov_g15fjodrd.b[12][0]++;cov_g15fjodrd.s[28]++;context.hashCache1 = (cov_g15fjodrd.b[13][0]++, context.hashCache1) || (cov_g15fjodrd.b[13][1]++, []);cov_g15fjodrd.s[29]++;hash1 = context.hashCache1[index1];cov_g15fjodrd.s[30]++;if (typeof hash1 === 'undefined') {
2941 cov_g15fjodrd.b[14][0]++;cov_g15fjodrd.s[31]++;context.hashCache1[index1] = hash1 = objectHash(value1, index1);
2942 } else {
2943 cov_g15fjodrd.b[14][1]++;
2944 }
2945 } else {
2946 cov_g15fjodrd.b[12][1]++;cov_g15fjodrd.s[32]++;hash1 = objectHash(value1);
2947 }cov_g15fjodrd.s[33]++;if (typeof hash1 === 'undefined') {
2948 cov_g15fjodrd.b[15][0]++;cov_g15fjodrd.s[34]++;return false;
2949 } else {
2950 cov_g15fjodrd.b[15][1]++;
2951 }cov_g15fjodrd.s[35]++;if (typeof index2 === 'number') {
2952 cov_g15fjodrd.b[16][0]++;cov_g15fjodrd.s[36]++;context.hashCache2 = (cov_g15fjodrd.b[17][0]++, context.hashCache2) || (cov_g15fjodrd.b[17][1]++, []);cov_g15fjodrd.s[37]++;hash2 = context.hashCache2[index2];cov_g15fjodrd.s[38]++;if (typeof hash2 === 'undefined') {
2953 cov_g15fjodrd.b[18][0]++;cov_g15fjodrd.s[39]++;context.hashCache2[index2] = hash2 = objectHash(value2, index2);
2954 } else {
2955 cov_g15fjodrd.b[18][1]++;
2956 }
2957 } else {
2958 cov_g15fjodrd.b[16][1]++;cov_g15fjodrd.s[40]++;hash2 = objectHash(value2);
2959 }cov_g15fjodrd.s[41]++;if (typeof hash2 === 'undefined') {
2960 cov_g15fjodrd.b[19][0]++;cov_g15fjodrd.s[42]++;return false;
2961 } else {
2962 cov_g15fjodrd.b[19][1]++;
2963 }cov_g15fjodrd.s[43]++;return hash1 === hash2;
2964}cov_g15fjodrd.s[44]++;var diffFilter$1 = function arraysDiffFilter(context) {
2965 cov_g15fjodrd.f[5]++;cov_g15fjodrd.s[45]++;if (!context.leftIsArray) {
2966 cov_g15fjodrd.b[20][0]++;cov_g15fjodrd.s[46]++;return;
2967 } else {
2968 cov_g15fjodrd.b[20][1]++;
2969 }var matchContext = (cov_g15fjodrd.s[47]++, { objectHash: (cov_g15fjodrd.b[21][0]++, context.options) && (cov_g15fjodrd.b[21][1]++, context.options.objectHash), matchByPosition: (cov_g15fjodrd.b[22][0]++, context.options) && (cov_g15fjodrd.b[22][1]++, context.options.matchByPosition) });var commonHead = (cov_g15fjodrd.s[48]++, 0);var commonTail = (cov_g15fjodrd.s[49]++, 0);var index = (cov_g15fjodrd.s[50]++, void 0);var index1 = (cov_g15fjodrd.s[51]++, void 0);var index2 = (cov_g15fjodrd.s[52]++, void 0);var array1 = (cov_g15fjodrd.s[53]++, context.left);var array2 = (cov_g15fjodrd.s[54]++, context.right);var len1 = (cov_g15fjodrd.s[55]++, array1.length);var len2 = (cov_g15fjodrd.s[56]++, array2.length);var child = (cov_g15fjodrd.s[57]++, void 0);cov_g15fjodrd.s[58]++;if ((cov_g15fjodrd.b[24][0]++, len1 > 0) && (cov_g15fjodrd.b[24][1]++, len2 > 0) && (cov_g15fjodrd.b[24][2]++, !matchContext.objectHash) && (cov_g15fjodrd.b[24][3]++, typeof matchContext.matchByPosition !== 'boolean')) {
2970 cov_g15fjodrd.b[23][0]++;cov_g15fjodrd.s[59]++;matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);
2971 } else {
2972 cov_g15fjodrd.b[23][1]++;
2973 } // separate common head
2974 cov_g15fjodrd.s[60]++;while ((cov_g15fjodrd.b[25][0]++, commonHead < len1) && (cov_g15fjodrd.b[25][1]++, commonHead < len2) && (cov_g15fjodrd.b[25][2]++, matchItems(array1, array2, commonHead, commonHead, matchContext))) {
2975 cov_g15fjodrd.s[61]++;index = commonHead;cov_g15fjodrd.s[62]++;child = new DiffContext(context.left[index], context.right[index]);cov_g15fjodrd.s[63]++;context.push(child, index);cov_g15fjodrd.s[64]++;commonHead++;
2976 } // separate common tail
2977 cov_g15fjodrd.s[65]++;while ((cov_g15fjodrd.b[26][0]++, commonTail + commonHead < len1) && (cov_g15fjodrd.b[26][1]++, commonTail + commonHead < len2) && (cov_g15fjodrd.b[26][2]++, matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext))) {
2978 cov_g15fjodrd.s[66]++;index1 = len1 - 1 - commonTail;cov_g15fjodrd.s[67]++;index2 = len2 - 1 - commonTail;cov_g15fjodrd.s[68]++;child = new DiffContext(context.left[index1], context.right[index2]);cov_g15fjodrd.s[69]++;context.push(child, index2);cov_g15fjodrd.s[70]++;commonTail++;
2979 }var result = (cov_g15fjodrd.s[71]++, void 0);cov_g15fjodrd.s[72]++;if (commonHead + commonTail === len1) {
2980 cov_g15fjodrd.b[27][0]++;cov_g15fjodrd.s[73]++;if (len1 === len2) {
2981 cov_g15fjodrd.b[28][0]++;cov_g15fjodrd.s[74]++; // arrays are identical
2982 context.setResult(undefined).exit();cov_g15fjodrd.s[75]++;return;
2983 } else {
2984 cov_g15fjodrd.b[28][1]++;
2985 } // trivial case, a block (1 or more consecutive items) was added
2986 cov_g15fjodrd.s[76]++;result = (cov_g15fjodrd.b[29][0]++, result) || (cov_g15fjodrd.b[29][1]++, { _t: 'a' });cov_g15fjodrd.s[77]++;for (index = commonHead; index < len2 - commonTail; index++) {
2987 cov_g15fjodrd.s[78]++;result[index] = [array2[index]];
2988 }cov_g15fjodrd.s[79]++;context.setResult(result).exit();cov_g15fjodrd.s[80]++;return;
2989 } else {
2990 cov_g15fjodrd.b[27][1]++;
2991 }cov_g15fjodrd.s[81]++;if (commonHead + commonTail === len2) {
2992 cov_g15fjodrd.b[30][0]++;cov_g15fjodrd.s[82]++; // trivial case, a block (1 or more consecutive items) was removed
2993 result = (cov_g15fjodrd.b[31][0]++, result) || (cov_g15fjodrd.b[31][1]++, { _t: 'a' });cov_g15fjodrd.s[83]++;for (index = commonHead; index < len1 - commonTail; index++) {
2994 cov_g15fjodrd.s[84]++;result['_' + index] = [array1[index], 0, 0];
2995 }cov_g15fjodrd.s[85]++;context.setResult(result).exit();cov_g15fjodrd.s[86]++;return;
2996 } else {
2997 cov_g15fjodrd.b[30][1]++;
2998 } // reset hash cache
2999 cov_g15fjodrd.s[87]++;delete matchContext.hashCache1;cov_g15fjodrd.s[88]++;delete matchContext.hashCache2; // diff is not trivial, find the LCS (Longest Common Subsequence)
3000 var trimmed1 = (cov_g15fjodrd.s[89]++, array1.slice(commonHead, len1 - commonTail));var trimmed2 = (cov_g15fjodrd.s[90]++, array2.slice(commonHead, len2 - commonTail));var seq = (cov_g15fjodrd.s[91]++, lcs.get(trimmed1, trimmed2, matchItems, matchContext));var removedItems = (cov_g15fjodrd.s[92]++, []);cov_g15fjodrd.s[93]++;result = (cov_g15fjodrd.b[32][0]++, result) || (cov_g15fjodrd.b[32][1]++, { _t: 'a' });cov_g15fjodrd.s[94]++;for (index = commonHead; index < len1 - commonTail; index++) {
3001 cov_g15fjodrd.s[95]++;if (arrayIndexOf(seq.indices1, index - commonHead) < 0) {
3002 cov_g15fjodrd.b[33][0]++;cov_g15fjodrd.s[96]++; // removed
3003 result['_' + index] = [array1[index], 0, 0];cov_g15fjodrd.s[97]++;removedItems.push(index);
3004 } else {
3005 cov_g15fjodrd.b[33][1]++;
3006 }
3007 }var detectMove = (cov_g15fjodrd.s[98]++, true);cov_g15fjodrd.s[99]++;if ((cov_g15fjodrd.b[35][0]++, context.options) && (cov_g15fjodrd.b[35][1]++, context.options.arrays) && (cov_g15fjodrd.b[35][2]++, context.options.arrays.detectMove === false)) {
3008 cov_g15fjodrd.b[34][0]++;cov_g15fjodrd.s[100]++;detectMove = false;
3009 } else {
3010 cov_g15fjodrd.b[34][1]++;
3011 }var includeValueOnMove = (cov_g15fjodrd.s[101]++, false);cov_g15fjodrd.s[102]++;if ((cov_g15fjodrd.b[37][0]++, context.options) && (cov_g15fjodrd.b[37][1]++, context.options.arrays) && (cov_g15fjodrd.b[37][2]++, context.options.arrays.includeValueOnMove)) {
3012 cov_g15fjodrd.b[36][0]++;cov_g15fjodrd.s[103]++;includeValueOnMove = true;
3013 } else {
3014 cov_g15fjodrd.b[36][1]++;
3015 }var removedItemsLength = (cov_g15fjodrd.s[104]++, removedItems.length);cov_g15fjodrd.s[105]++;for (index = commonHead; index < len2 - commonTail; index++) {
3016 var indexOnArray2 = (cov_g15fjodrd.s[106]++, arrayIndexOf(seq.indices2, index - commonHead));cov_g15fjodrd.s[107]++;if (indexOnArray2 < 0) {
3017 cov_g15fjodrd.b[38][0]++; // added, try to match with a removed item and register as position move
3018 var isMove = (cov_g15fjodrd.s[108]++, false);cov_g15fjodrd.s[109]++;if ((cov_g15fjodrd.b[40][0]++, detectMove) && (cov_g15fjodrd.b[40][1]++, removedItemsLength > 0)) {
3019 cov_g15fjodrd.b[39][0]++;cov_g15fjodrd.s[110]++;for (var removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {
3020 cov_g15fjodrd.s[111]++;index1 = removedItems[removeItemIndex1];cov_g15fjodrd.s[112]++;if (matchItems(trimmed1, trimmed2, index1 - commonHead, index - commonHead, matchContext)) {
3021 cov_g15fjodrd.b[41][0]++;cov_g15fjodrd.s[113]++; // store position move as: [originalValue, newPosition, ARRAY_MOVE]
3022 result['_' + index1].splice(1, 2, index, ARRAY_MOVE);cov_g15fjodrd.s[114]++;if (!includeValueOnMove) {
3023 cov_g15fjodrd.b[42][0]++;cov_g15fjodrd.s[115]++; // don't include moved value on diff, to save bytes
3024 result['_' + index1][0] = '';
3025 } else {
3026 cov_g15fjodrd.b[42][1]++;
3027 }cov_g15fjodrd.s[116]++;index2 = index;cov_g15fjodrd.s[117]++;child = new DiffContext(context.left[index1], context.right[index2]);cov_g15fjodrd.s[118]++;context.push(child, index2);cov_g15fjodrd.s[119]++;removedItems.splice(removeItemIndex1, 1);cov_g15fjodrd.s[120]++;isMove = true;cov_g15fjodrd.s[121]++;break;
3028 } else {
3029 cov_g15fjodrd.b[41][1]++;
3030 }
3031 }
3032 } else {
3033 cov_g15fjodrd.b[39][1]++;
3034 }cov_g15fjodrd.s[122]++;if (!isMove) {
3035 cov_g15fjodrd.b[43][0]++;cov_g15fjodrd.s[123]++; // added
3036 result[index] = [array2[index]];
3037 } else {
3038 cov_g15fjodrd.b[43][1]++;
3039 }
3040 } else {
3041 cov_g15fjodrd.b[38][1]++;cov_g15fjodrd.s[124]++; // match, do inner diff
3042 index1 = seq.indices1[indexOnArray2] + commonHead;cov_g15fjodrd.s[125]++;index2 = seq.indices2[indexOnArray2] + commonHead;cov_g15fjodrd.s[126]++;child = new DiffContext(context.left[index1], context.right[index2]);cov_g15fjodrd.s[127]++;context.push(child, index2);
3043 }
3044 }cov_g15fjodrd.s[128]++;context.setResult(result).exit();
3045};cov_g15fjodrd.s[129]++;diffFilter$1.filterName = 'arrays';var compare = (cov_g15fjodrd.s[130]++, { numerically: function numerically(a, b) {
3046 cov_g15fjodrd.f[6]++;cov_g15fjodrd.s[131]++;return a - b;
3047 }, numericallyBy: function numericallyBy(name) {
3048 cov_g15fjodrd.f[7]++;cov_g15fjodrd.s[132]++;return function (a, b) {
3049 cov_g15fjodrd.f[8]++;cov_g15fjodrd.s[133]++;return a[name] - b[name];
3050 };
3051 } });cov_g15fjodrd.s[134]++;var patchFilter$2 = function nestedPatchFilter(context) {
3052 cov_g15fjodrd.f[9]++;cov_g15fjodrd.s[135]++;if (!context.nested) {
3053 cov_g15fjodrd.b[44][0]++;cov_g15fjodrd.s[136]++;return;
3054 } else {
3055 cov_g15fjodrd.b[44][1]++;
3056 }cov_g15fjodrd.s[137]++;if (context.delta._t !== 'a') {
3057 cov_g15fjodrd.b[45][0]++;cov_g15fjodrd.s[138]++;return;
3058 } else {
3059 cov_g15fjodrd.b[45][1]++;
3060 }var index = (cov_g15fjodrd.s[139]++, void 0);var index1 = (cov_g15fjodrd.s[140]++, void 0);var delta = (cov_g15fjodrd.s[141]++, context.delta);var array = (cov_g15fjodrd.s[142]++, context.left); // first, separate removals, insertions and modifications
3061 var toRemove = (cov_g15fjodrd.s[143]++, []);var toInsert = (cov_g15fjodrd.s[144]++, []);var toModify = (cov_g15fjodrd.s[145]++, []);cov_g15fjodrd.s[146]++;for (index in delta) {
3062 cov_g15fjodrd.s[147]++;if (index !== '_t') {
3063 cov_g15fjodrd.b[46][0]++;cov_g15fjodrd.s[148]++;if (index[0] === '_') {
3064 cov_g15fjodrd.b[47][0]++;cov_g15fjodrd.s[149]++; // removed item from original array
3065 if ((cov_g15fjodrd.b[49][0]++, delta[index][2] === 0) || (cov_g15fjodrd.b[49][1]++, delta[index][2] === ARRAY_MOVE)) {
3066 cov_g15fjodrd.b[48][0]++;cov_g15fjodrd.s[150]++;toRemove.push(parseInt(index.slice(1), 10));
3067 } else {
3068 cov_g15fjodrd.b[48][1]++;cov_g15fjodrd.s[151]++;throw new Error('only removal or move can be applied at original array indices,' + (' invalid diff type: ' + delta[index][2]));
3069 }
3070 } else {
3071 cov_g15fjodrd.b[47][1]++;cov_g15fjodrd.s[152]++;if (delta[index].length === 1) {
3072 cov_g15fjodrd.b[50][0]++;cov_g15fjodrd.s[153]++; // added item at new array
3073 toInsert.push({ index: parseInt(index, 10), value: delta[index][0] });
3074 } else {
3075 cov_g15fjodrd.b[50][1]++;cov_g15fjodrd.s[154]++; // modified item at new array
3076 toModify.push({ index: parseInt(index, 10), delta: delta[index] });
3077 }
3078 }
3079 } else {
3080 cov_g15fjodrd.b[46][1]++;
3081 }
3082 } // remove items, in reverse order to avoid sawing our own floor
3083 cov_g15fjodrd.s[155]++;toRemove = toRemove.sort(compare.numerically);cov_g15fjodrd.s[156]++;for (index = toRemove.length - 1; index >= 0; index--) {
3084 cov_g15fjodrd.s[157]++;index1 = toRemove[index];var indexDiff = (cov_g15fjodrd.s[158]++, delta['_' + index1]);var removedValue = (cov_g15fjodrd.s[159]++, array.splice(index1, 1)[0]);cov_g15fjodrd.s[160]++;if (indexDiff[2] === ARRAY_MOVE) {
3085 cov_g15fjodrd.b[51][0]++;cov_g15fjodrd.s[161]++; // reinsert later
3086 toInsert.push({ index: indexDiff[1], value: removedValue });
3087 } else {
3088 cov_g15fjodrd.b[51][1]++;
3089 }
3090 } // insert items, in reverse order to avoid moving our own floor
3091 cov_g15fjodrd.s[162]++;toInsert = toInsert.sort(compare.numericallyBy('index'));var toInsertLength = (cov_g15fjodrd.s[163]++, toInsert.length);cov_g15fjodrd.s[164]++;for (index = 0; index < toInsertLength; index++) {
3092 var insertion = (cov_g15fjodrd.s[165]++, toInsert[index]);cov_g15fjodrd.s[166]++;array.splice(insertion.index, 0, insertion.value);
3093 } // apply modifications
3094 var toModifyLength = (cov_g15fjodrd.s[167]++, toModify.length);var child = (cov_g15fjodrd.s[168]++, void 0);cov_g15fjodrd.s[169]++;if (toModifyLength > 0) {
3095 cov_g15fjodrd.b[52][0]++;cov_g15fjodrd.s[170]++;for (index = 0; index < toModifyLength; index++) {
3096 var modification = (cov_g15fjodrd.s[171]++, toModify[index]);cov_g15fjodrd.s[172]++;child = new PatchContext(context.left[modification.index], modification.delta);cov_g15fjodrd.s[173]++;context.push(child, modification.index);
3097 }
3098 } else {
3099 cov_g15fjodrd.b[52][1]++;
3100 }cov_g15fjodrd.s[174]++;if (!context.children) {
3101 cov_g15fjodrd.b[53][0]++;cov_g15fjodrd.s[175]++;context.setResult(context.left).exit();cov_g15fjodrd.s[176]++;return;
3102 } else {
3103 cov_g15fjodrd.b[53][1]++;
3104 }cov_g15fjodrd.s[177]++;context.exit();
3105};cov_g15fjodrd.s[178]++;patchFilter$2.filterName = 'arrays';cov_g15fjodrd.s[179]++;var collectChildrenPatchFilter$1 = function collectChildrenPatchFilter(context) {
3106 cov_g15fjodrd.f[10]++;cov_g15fjodrd.s[180]++;if ((cov_g15fjodrd.b[55][0]++, !context) || (cov_g15fjodrd.b[55][1]++, !context.children)) {
3107 cov_g15fjodrd.b[54][0]++;cov_g15fjodrd.s[181]++;return;
3108 } else {
3109 cov_g15fjodrd.b[54][1]++;
3110 }cov_g15fjodrd.s[182]++;if (context.delta._t !== 'a') {
3111 cov_g15fjodrd.b[56][0]++;cov_g15fjodrd.s[183]++;return;
3112 } else {
3113 cov_g15fjodrd.b[56][1]++;
3114 }var length = (cov_g15fjodrd.s[184]++, context.children.length);var child = (cov_g15fjodrd.s[185]++, void 0);cov_g15fjodrd.s[186]++;for (var index = 0; index < length; index++) {
3115 cov_g15fjodrd.s[187]++;child = context.children[index];cov_g15fjodrd.s[188]++;context.left[child.childName] = child.result;
3116 }cov_g15fjodrd.s[189]++;context.setResult(context.left).exit();
3117};cov_g15fjodrd.s[190]++;collectChildrenPatchFilter$1.filterName = 'arraysCollectChildren';cov_g15fjodrd.s[191]++;var reverseFilter$2 = function arraysReverseFilter(context) {
3118 cov_g15fjodrd.f[11]++;cov_g15fjodrd.s[192]++;if (!context.nested) {
3119 cov_g15fjodrd.b[57][0]++;cov_g15fjodrd.s[193]++;if (context.delta[2] === ARRAY_MOVE) {
3120 cov_g15fjodrd.b[58][0]++;cov_g15fjodrd.s[194]++;context.newName = '_' + context.delta[1];cov_g15fjodrd.s[195]++;context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();
3121 } else {
3122 cov_g15fjodrd.b[58][1]++;
3123 }cov_g15fjodrd.s[196]++;return;
3124 } else {
3125 cov_g15fjodrd.b[57][1]++;
3126 }cov_g15fjodrd.s[197]++;if (context.delta._t !== 'a') {
3127 cov_g15fjodrd.b[59][0]++;cov_g15fjodrd.s[198]++;return;
3128 } else {
3129 cov_g15fjodrd.b[59][1]++;
3130 }var name = (cov_g15fjodrd.s[199]++, void 0);var child = (cov_g15fjodrd.s[200]++, void 0);cov_g15fjodrd.s[201]++;for (name in context.delta) {
3131 cov_g15fjodrd.s[202]++;if (name === '_t') {
3132 cov_g15fjodrd.b[60][0]++;cov_g15fjodrd.s[203]++;continue;
3133 } else {
3134 cov_g15fjodrd.b[60][1]++;
3135 }cov_g15fjodrd.s[204]++;child = new ReverseContext(context.delta[name]);cov_g15fjodrd.s[205]++;context.push(child, name);
3136 }cov_g15fjodrd.s[206]++;context.exit();
3137};cov_g15fjodrd.s[207]++;reverseFilter$2.filterName = 'arrays';cov_g15fjodrd.s[208]++;var reverseArrayDeltaIndex = function reverseArrayDeltaIndex(delta, index, itemDelta) {
3138 cov_g15fjodrd.f[12]++;cov_g15fjodrd.s[209]++;if ((cov_g15fjodrd.b[62][0]++, typeof index === 'string') && (cov_g15fjodrd.b[62][1]++, index[0] === '_')) {
3139 cov_g15fjodrd.b[61][0]++;cov_g15fjodrd.s[210]++;return parseInt(index.substr(1), 10);
3140 } else {
3141 cov_g15fjodrd.b[61][1]++;cov_g15fjodrd.s[211]++;if ((cov_g15fjodrd.b[64][0]++, isArray$2(itemDelta)) && (cov_g15fjodrd.b[64][1]++, itemDelta[2] === 0)) {
3142 cov_g15fjodrd.b[63][0]++;cov_g15fjodrd.s[212]++;return '_' + index;
3143 } else {
3144 cov_g15fjodrd.b[63][1]++;
3145 }
3146 }var reverseIndex = (cov_g15fjodrd.s[213]++, +index);cov_g15fjodrd.s[214]++;for (var deltaIndex in delta) {
3147 var deltaItem = (cov_g15fjodrd.s[215]++, delta[deltaIndex]);cov_g15fjodrd.s[216]++;if (isArray$2(deltaItem)) {
3148 cov_g15fjodrd.b[65][0]++;cov_g15fjodrd.s[217]++;if (deltaItem[2] === ARRAY_MOVE) {
3149 cov_g15fjodrd.b[66][0]++;var moveFromIndex = (cov_g15fjodrd.s[218]++, parseInt(deltaIndex.substr(1), 10));var moveToIndex = (cov_g15fjodrd.s[219]++, deltaItem[1]);cov_g15fjodrd.s[220]++;if (moveToIndex === +index) {
3150 cov_g15fjodrd.b[67][0]++;cov_g15fjodrd.s[221]++;return moveFromIndex;
3151 } else {
3152 cov_g15fjodrd.b[67][1]++;
3153 }cov_g15fjodrd.s[222]++;if ((cov_g15fjodrd.b[69][0]++, moveFromIndex <= reverseIndex) && (cov_g15fjodrd.b[69][1]++, moveToIndex > reverseIndex)) {
3154 cov_g15fjodrd.b[68][0]++;cov_g15fjodrd.s[223]++;reverseIndex++;
3155 } else {
3156 cov_g15fjodrd.b[68][1]++;cov_g15fjodrd.s[224]++;if ((cov_g15fjodrd.b[71][0]++, moveFromIndex >= reverseIndex) && (cov_g15fjodrd.b[71][1]++, moveToIndex < reverseIndex)) {
3157 cov_g15fjodrd.b[70][0]++;cov_g15fjodrd.s[225]++;reverseIndex--;
3158 } else {
3159 cov_g15fjodrd.b[70][1]++;
3160 }
3161 }
3162 } else {
3163 cov_g15fjodrd.b[66][1]++;cov_g15fjodrd.s[226]++;if (deltaItem[2] === 0) {
3164 cov_g15fjodrd.b[72][0]++;var deleteIndex = (cov_g15fjodrd.s[227]++, parseInt(deltaIndex.substr(1), 10));cov_g15fjodrd.s[228]++;if (deleteIndex <= reverseIndex) {
3165 cov_g15fjodrd.b[73][0]++;cov_g15fjodrd.s[229]++;reverseIndex++;
3166 } else {
3167 cov_g15fjodrd.b[73][1]++;
3168 }
3169 } else {
3170 cov_g15fjodrd.b[72][1]++;cov_g15fjodrd.s[230]++;if ((cov_g15fjodrd.b[75][0]++, deltaItem.length === 1) && (cov_g15fjodrd.b[75][1]++, deltaIndex <= reverseIndex)) {
3171 cov_g15fjodrd.b[74][0]++;cov_g15fjodrd.s[231]++;reverseIndex--;
3172 } else {
3173 cov_g15fjodrd.b[74][1]++;
3174 }
3175 }
3176 }
3177 } else {
3178 cov_g15fjodrd.b[65][1]++;
3179 }
3180 }cov_g15fjodrd.s[232]++;return reverseIndex;
3181};function collectChildrenReverseFilter$1(context) {
3182 cov_g15fjodrd.f[13]++;cov_g15fjodrd.s[233]++;if ((cov_g15fjodrd.b[77][0]++, !context) || (cov_g15fjodrd.b[77][1]++, !context.children)) {
3183 cov_g15fjodrd.b[76][0]++;cov_g15fjodrd.s[234]++;return;
3184 } else {
3185 cov_g15fjodrd.b[76][1]++;
3186 }cov_g15fjodrd.s[235]++;if (context.delta._t !== 'a') {
3187 cov_g15fjodrd.b[78][0]++;cov_g15fjodrd.s[236]++;return;
3188 } else {
3189 cov_g15fjodrd.b[78][1]++;
3190 }var length = (cov_g15fjodrd.s[237]++, context.children.length);var child = (cov_g15fjodrd.s[238]++, void 0);var delta = (cov_g15fjodrd.s[239]++, { _t: 'a' });cov_g15fjodrd.s[240]++;for (var index = 0; index < length; index++) {
3191 cov_g15fjodrd.s[241]++;child = context.children[index];var name = (cov_g15fjodrd.s[242]++, child.newName);cov_g15fjodrd.s[243]++;if (typeof name === 'undefined') {
3192 cov_g15fjodrd.b[79][0]++;cov_g15fjodrd.s[244]++;name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);
3193 } else {
3194 cov_g15fjodrd.b[79][1]++;
3195 }cov_g15fjodrd.s[245]++;if (delta[name] !== child.result) {
3196 cov_g15fjodrd.b[80][0]++;cov_g15fjodrd.s[246]++;delta[name] = child.result;
3197 } else {
3198 cov_g15fjodrd.b[80][1]++;
3199 }
3200 }cov_g15fjodrd.s[247]++;context.setResult(delta).exit();
3201}cov_g15fjodrd.s[248]++;collectChildrenReverseFilter$1.filterName = 'arraysCollectChildren';
3202
3203var cov_3rnqyacq6 = function () {
3204 var path = '/Users/benja/proj/jsondiffpatch/src/filters/dates.js',
3205 hash = 'bbdf9d46e1ad60b363a5eb94ba7cef1d35ba0b6d',
3206 global = new Function('return this')(),
3207 gcv = '__coverage__',
3208 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/filters/dates.js', statementMap: { '0': { start: { line: 1, column: 24 }, end: { line: 16, column: 1 } }, '1': { start: { line: 2, column: 2 }, end: { line: 15, column: 3 } }, '2': { start: { line: 3, column: 4 }, end: { line: 11, column: 5 } }, '3': { start: { line: 4, column: 6 }, end: { line: 8, column: 7 } }, '4': { start: { line: 5, column: 8 }, end: { line: 5, column: 57 } }, '5': { start: { line: 7, column: 8 }, end: { line: 7, column: 37 } }, '6': { start: { line: 10, column: 6 }, end: { line: 10, column: 55 } }, '7': { start: { line: 12, column: 4 }, end: { line: 12, column: 19 } }, '8': { start: { line: 13, column: 9 }, end: { line: 15, column: 3 } }, '9': { start: { line: 14, column: 4 }, end: { line: 14, column: 60 } }, '10': { start: { line: 17, column: 0 }, end: { line: 17, column: 32 } } }, fnMap: { '0': { name: 'datesDiffFilter', decl: { start: { line: 1, column: 33 }, end: { line: 1, column: 48 } }, loc: { start: { line: 1, column: 58 }, end: { line: 16, column: 1 } }, line: 1 } }, branchMap: { '0': { loc: { start: { line: 2, column: 2 }, end: { line: 15, column: 3 } }, type: 'if', locations: [{ start: { line: 2, column: 2 }, end: { line: 15, column: 3 } }, { start: { line: 2, column: 2 }, end: { line: 15, column: 3 } }], line: 2 }, '1': { loc: { start: { line: 3, column: 4 }, end: { line: 11, column: 5 } }, type: 'if', locations: [{ start: { line: 3, column: 4 }, end: { line: 11, column: 5 } }, { start: { line: 3, column: 4 }, end: { line: 11, column: 5 } }], line: 3 }, '2': { loc: { start: { line: 4, column: 6 }, end: { line: 8, column: 7 } }, type: 'if', locations: [{ start: { line: 4, column: 6 }, end: { line: 8, column: 7 } }, { start: { line: 4, column: 6 }, end: { line: 8, column: 7 } }], line: 4 }, '3': { loc: { start: { line: 13, column: 9 }, end: { line: 15, column: 3 } }, type: 'if', locations: [{ start: { line: 13, column: 9 }, end: { line: 15, column: 3 } }, { start: { line: 13, column: 9 }, end: { line: 15, column: 3 } }], line: 13 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0 }, f: { '0': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3209 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3210 return coverage[path];
3211 }coverageData.hash = hash;return coverage[path] = coverageData;
3212}();cov_3rnqyacq6.s[0]++;var diffFilter$2 = function datesDiffFilter(context) {
3213 cov_3rnqyacq6.f[0]++;cov_3rnqyacq6.s[1]++;if (context.left instanceof Date) {
3214 cov_3rnqyacq6.b[0][0]++;cov_3rnqyacq6.s[2]++;if (context.right instanceof Date) {
3215 cov_3rnqyacq6.b[1][0]++;cov_3rnqyacq6.s[3]++;if (context.left.getTime() !== context.right.getTime()) {
3216 cov_3rnqyacq6.b[2][0]++;cov_3rnqyacq6.s[4]++;context.setResult([context.left, context.right]);
3217 } else {
3218 cov_3rnqyacq6.b[2][1]++;cov_3rnqyacq6.s[5]++;context.setResult(undefined);
3219 }
3220 } else {
3221 cov_3rnqyacq6.b[1][1]++;cov_3rnqyacq6.s[6]++;context.setResult([context.left, context.right]);
3222 }cov_3rnqyacq6.s[7]++;context.exit();
3223 } else {
3224 cov_3rnqyacq6.b[0][1]++;cov_3rnqyacq6.s[8]++;if (context.right instanceof Date) {
3225 cov_3rnqyacq6.b[3][0]++;cov_3rnqyacq6.s[9]++;context.setResult([context.left, context.right]).exit();
3226 } else {
3227 cov_3rnqyacq6.b[3][1]++;
3228 }
3229 }
3230};cov_3rnqyacq6.s[10]++;diffFilter$2.filterName = 'dates';
3231
3232var cov_270vbx2d41 = function () {
3233 var path = '/Users/benja/proj/jsondiffpatch/src/filters/texts.js',
3234 hash = '59929f1555c4391f2e3d74f8d1151ee41dfa1702',
3235 global = new Function('return this')(),
3236 gcv = '__coverage__',
3237 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/filters/texts.js', statementMap: { '0': { start: { line: 4, column: 16 }, end: { line: 4, column: 17 } }, '1': { start: { line: 5, column: 25 }, end: { line: 5, column: 27 } }, '2': { start: { line: 6, column: 22 }, end: { line: 6, column: 26 } }, '3': { start: { line: 8, column: 24 }, end: { line: 51, column: 1 } }, '4': { start: { line: 11, column: 2 }, end: { line: 49, column: 3 } }, '5': { start: { line: 12, column: 19 }, end: { line: 12, column: 25 } }, '6': { start: { line: 14, column: 4 }, end: { line: 23, column: 5 } }, '7': { start: { line: 16, column: 6 }, end: { line: 16, column: 123 } }, '8': { start: { line: 17, column: 11 }, end: { line: 23, column: 5 } }, '9': { start: { line: 18, column: 6 }, end: { line: 22, column: 7 } }, '10': { start: { line: 19, column: 8 }, end: { line: 19, column: 36 } }, '11': { start: { line: 21, column: 8 }, end: { line: 21, column: 24 } }, '12': { start: { line: 25, column: 4 }, end: { line: 33, column: 5 } }, '13': { start: { line: 26, column: 6 }, end: { line: 28, column: 7 } }, '14': { start: { line: 27, column: 8 }, end: { line: 27, column: 20 } }, '15': { start: { line: 29, column: 18 }, end: { line: 29, column: 70 } }, '16': { start: { line: 31, column: 6 }, end: { line: 31, column: 46 } }, '17': { start: { line: 32, column: 6 }, end: { line: 32, column: 18 } }, '18': { start: { line: 34, column: 4 }, end: { line: 48, column: 6 } }, '19': { start: { line: 36, column: 8 }, end: { line: 36, column: 70 } }, '20': { start: { line: 39, column: 22 }, end: { line: 39, column: 81 } }, '21': { start: { line: 40, column: 8 }, end: { line: 45, column: 9 } }, '22': { start: { line: 41, column: 10 }, end: { line: 44, column: 11 } }, '23': { start: { line: 42, column: 25 }, end: { line: 42, column: 55 } }, '24': { start: { line: 43, column: 12 }, end: { line: 43, column: 42 } }, '25': { start: { line: 46, column: 8 }, end: { line: 46, column: 26 } }, '26': { start: { line: 50, column: 2 }, end: { line: 50, column: 25 } }, '27': { start: { line: 53, column: 24 }, end: { line: 72, column: 1 } }, '28': { start: { line: 54, column: 2 }, end: { line: 56, column: 3 } }, '29': { start: { line: 55, column: 4 }, end: { line: 55, column: 11 } }, '30': { start: { line: 57, column: 18 }, end: { line: 57, column: 121 } }, '31': { start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }, '32': { start: { line: 59, column: 4 }, end: { line: 59, column: 60 } }, '33': { start: { line: 60, column: 4 }, end: { line: 60, column: 11 } }, '34': { start: { line: 63, column: 23 }, end: { line: 63, column: 42 } }, '35': { start: { line: 64, column: 2 }, end: { line: 69, column: 3 } }, '36': { start: { line: 67, column: 4 }, end: { line: 67, column: 60 } }, '37': { start: { line: 68, column: 4 }, end: { line: 68, column: 11 } }, '38': { start: { line: 70, column: 13 }, end: { line: 70, column: 32 } }, '39': { start: { line: 71, column: 2 }, end: { line: 71, column: 78 } }, '40': { start: { line: 73, column: 0 }, end: { line: 73, column: 32 } }, '41': { start: { line: 75, column: 25 }, end: { line: 86, column: 1 } }, '42': { start: { line: 76, column: 2 }, end: { line: 78, column: 3 } }, '43': { start: { line: 77, column: 4 }, end: { line: 77, column: 11 } }, '44': { start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }, '45': { start: { line: 80, column: 4 }, end: { line: 80, column: 11 } }, '46': { start: { line: 84, column: 14 }, end: { line: 84, column: 43 } }, '47': { start: { line: 85, column: 2 }, end: { line: 85, column: 66 } }, '48': { start: { line: 87, column: 0 }, end: { line: 87, column: 33 } }, '49': { start: { line: 89, column: 23 }, end: { line: 121, column: 1 } }, '50': { start: { line: 90, column: 10 }, end: { line: 90, column: 16 } }, '51': { start: { line: 91, column: 10 }, end: { line: 91, column: 16 } }, '52': { start: { line: 92, column: 14 }, end: { line: 92, column: 20 } }, '53': { start: { line: 93, column: 13 }, end: { line: 93, column: 19 } }, '54': { start: { line: 94, column: 16 }, end: { line: 94, column: 22 } }, '55': { start: { line: 95, column: 15 }, end: { line: 95, column: 19 } }, '56': { start: { line: 96, column: 20 }, end: { line: 96, column: 59 } }, '57': { start: { line: 97, column: 19 }, end: { line: 97, column: 25 } }, '58': { start: { line: 98, column: 2 }, end: { line: 98, column: 28 } }, '59': { start: { line: 99, column: 2 }, end: { line: 119, column: 3 } }, '60': { start: { line: 100, column: 4 }, end: { line: 100, column: 20 } }, '61': { start: { line: 101, column: 20 }, end: { line: 101, column: 36 } }, '62': { start: { line: 102, column: 4 }, end: { line: 118, column: 5 } }, '63': { start: { line: 103, column: 6 }, end: { line: 103, column: 38 } }, '64': { start: { line: 104, column: 6 }, end: { line: 104, column: 21 } }, '65': { start: { line: 107, column: 6 }, end: { line: 107, column: 108 } }, '66': { start: { line: 108, column: 11 }, end: { line: 118, column: 5 } }, '67': { start: { line: 109, column: 6 }, end: { line: 109, column: 41 } }, '68': { start: { line: 110, column: 6 }, end: { line: 115, column: 7 } }, '69': { start: { line: 112, column: 8 }, end: { line: 112, column: 27 } }, '70': { start: { line: 113, column: 8 }, end: { line: 113, column: 32 } }, '71': { start: { line: 114, column: 8 }, end: { line: 114, column: 31 } }, '72': { start: { line: 116, column: 11 }, end: { line: 118, column: 5 } }, '73': { start: { line: 117, column: 6 }, end: { line: 117, column: 41 } }, '74': { start: { line: 120, column: 2 }, end: { line: 120, column: 26 } }, '75': { start: { line: 123, column: 27 }, end: { line: 133, column: 1 } }, '76': { start: { line: 124, column: 2 }, end: { line: 126, column: 3 } }, '77': { start: { line: 125, column: 4 }, end: { line: 125, column: 11 } }, '78': { start: { line: 127, column: 2 }, end: { line: 129, column: 3 } }, '79': { start: { line: 128, column: 4 }, end: { line: 128, column: 11 } }, '80': { start: { line: 132, column: 2 }, end: { line: 132, column: 79 } }, '81': { start: { line: 134, column: 0 }, end: { line: 134, column: 35 } } }, fnMap: { '0': { name: 'getDiffMatchPatch', decl: { start: { line: 8, column: 33 }, end: { line: 8, column: 50 } }, loc: { start: { line: 8, column: 61 }, end: { line: 51, column: 1 } }, line: 8 }, '1': { name: 'diff', decl: { start: { line: 35, column: 21 }, end: { line: 35, column: 25 } }, loc: { start: { line: 35, column: 38 }, end: { line: 37, column: 7 } }, line: 35 }, '2': { name: 'patch', decl: { start: { line: 38, column: 22 }, end: { line: 38, column: 27 } }, loc: { start: { line: 38, column: 42 }, end: { line: 47, column: 7 } }, line: 38 }, '3': { name: 'textsDiffFilter', decl: { start: { line: 53, column: 33 }, end: { line: 53, column: 48 } }, loc: { start: { line: 53, column: 58 }, end: { line: 72, column: 1 } }, line: 53 }, '4': { name: 'textsPatchFilter', decl: { start: { line: 75, column: 34 }, end: { line: 75, column: 50 } }, loc: { start: { line: 75, column: 60 }, end: { line: 86, column: 1 } }, line: 75 }, '5': { name: 'textDeltaReverse', decl: { start: { line: 89, column: 32 }, end: { line: 89, column: 48 } }, loc: { start: { line: 89, column: 56 }, end: { line: 121, column: 1 } }, line: 89 }, '6': { name: 'textsReverseFilter', decl: { start: { line: 123, column: 36 }, end: { line: 123, column: 54 } }, loc: { start: { line: 123, column: 64 }, end: { line: 133, column: 1 } }, line: 123 } }, branchMap: { '0': { loc: { start: { line: 11, column: 2 }, end: { line: 49, column: 3 } }, type: 'if', locations: [{ start: { line: 11, column: 2 }, end: { line: 49, column: 3 } }, { start: { line: 11, column: 2 }, end: { line: 49, column: 3 } }], line: 11 }, '1': { loc: { start: { line: 14, column: 4 }, end: { line: 23, column: 5 } }, type: 'if', locations: [{ start: { line: 14, column: 4 }, end: { line: 23, column: 5 } }, { start: { line: 14, column: 4 }, end: { line: 23, column: 5 } }], line: 14 }, '2': { loc: { start: { line: 16, column: 17 }, end: { line: 16, column: 122 } }, type: 'cond-expr', locations: [{ start: { line: 16, column: 58 }, end: { line: 16, column: 80 } }, { start: { line: 16, column: 83 }, end: { line: 16, column: 122 } }], line: 16 }, '3': { loc: { start: { line: 17, column: 11 }, end: { line: 23, column: 5 } }, type: 'if', locations: [{ start: { line: 17, column: 11 }, end: { line: 23, column: 5 } }, { start: { line: 17, column: 11 }, end: { line: 23, column: 5 } }], line: 17 }, '4': { loc: { start: { line: 19, column: 19 }, end: { line: 19, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 19, column: 19 }, end: { line: 19, column: 22 } }, { start: { line: 19, column: 26 }, end: { line: 19, column: 35 } }], line: 19 }, '5': { loc: { start: { line: 25, column: 4 }, end: { line: 33, column: 5 } }, type: 'if', locations: [{ start: { line: 25, column: 4 }, end: { line: 33, column: 5 } }, { start: { line: 25, column: 4 }, end: { line: 33, column: 5 } }], line: 25 }, '6': { loc: { start: { line: 26, column: 6 }, end: { line: 28, column: 7 } }, type: 'if', locations: [{ start: { line: 26, column: 6 }, end: { line: 28, column: 7 } }, { start: { line: 26, column: 6 }, end: { line: 28, column: 7 } }], line: 26 }, '7': { loc: { start: { line: 41, column: 10 }, end: { line: 44, column: 11 } }, type: 'if', locations: [{ start: { line: 41, column: 10 }, end: { line: 44, column: 11 } }, { start: { line: 41, column: 10 }, end: { line: 44, column: 11 } }], line: 41 }, '8': { loc: { start: { line: 54, column: 2 }, end: { line: 56, column: 3 } }, type: 'if', locations: [{ start: { line: 54, column: 2 }, end: { line: 56, column: 3 } }, { start: { line: 54, column: 2 }, end: { line: 56, column: 3 } }], line: 54 }, '9': { loc: { start: { line: 57, column: 18 }, end: { line: 57, column: 121 } }, type: 'binary-expr', locations: [{ start: { line: 57, column: 18 }, end: { line: 57, column: 33 } }, { start: { line: 57, column: 37 }, end: { line: 57, column: 61 } }, { start: { line: 57, column: 65 }, end: { line: 57, column: 99 } }, { start: { line: 57, column: 103 }, end: { line: 57, column: 121 } }], line: 57 }, '10': { loc: { start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }, type: 'if', locations: [{ start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }, { start: { line: 58, column: 2 }, end: { line: 61, column: 3 } }], line: 58 }, '11': { loc: { start: { line: 58, column: 6 }, end: { line: 58, column: 73 } }, type: 'binary-expr', locations: [{ start: { line: 58, column: 6 }, end: { line: 58, column: 37 } }, { start: { line: 58, column: 41 }, end: { line: 58, column: 73 } }], line: 58 }, '12': { loc: { start: { line: 64, column: 2 }, end: { line: 69, column: 3 } }, type: 'if', locations: [{ start: { line: 64, column: 2 }, end: { line: 69, column: 3 } }, { start: { line: 64, column: 2 }, end: { line: 69, column: 3 } }], line: 64 }, '13': { loc: { start: { line: 76, column: 2 }, end: { line: 78, column: 3 } }, type: 'if', locations: [{ start: { line: 76, column: 2 }, end: { line: 78, column: 3 } }, { start: { line: 76, column: 2 }, end: { line: 78, column: 3 } }], line: 76 }, '14': { loc: { start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }, type: 'if', locations: [{ start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }, { start: { line: 79, column: 2 }, end: { line: 81, column: 3 } }], line: 79 }, '15': { loc: { start: { line: 102, column: 4 }, end: { line: 118, column: 5 } }, type: 'if', locations: [{ start: { line: 102, column: 4 }, end: { line: 118, column: 5 } }, { start: { line: 102, column: 4 }, end: { line: 118, column: 5 } }], line: 102 }, '16': { loc: { start: { line: 108, column: 11 }, end: { line: 118, column: 5 } }, type: 'if', locations: [{ start: { line: 108, column: 11 }, end: { line: 118, column: 5 } }, { start: { line: 108, column: 11 }, end: { line: 118, column: 5 } }], line: 108 }, '17': { loc: { start: { line: 110, column: 6 }, end: { line: 115, column: 7 } }, type: 'if', locations: [{ start: { line: 110, column: 6 }, end: { line: 115, column: 7 } }, { start: { line: 110, column: 6 }, end: { line: 115, column: 7 } }], line: 110 }, '18': { loc: { start: { line: 116, column: 11 }, end: { line: 118, column: 5 } }, type: 'if', locations: [{ start: { line: 116, column: 11 }, end: { line: 118, column: 5 } }, { start: { line: 116, column: 11 }, end: { line: 118, column: 5 } }], line: 116 }, '19': { loc: { start: { line: 124, column: 2 }, end: { line: 126, column: 3 } }, type: 'if', locations: [{ start: { line: 124, column: 2 }, end: { line: 126, column: 3 } }, { start: { line: 124, column: 2 }, end: { line: 126, column: 3 } }], line: 124 }, '20': { loc: { start: { line: 127, column: 2 }, end: { line: 129, column: 3 } }, type: 'if', locations: [{ start: { line: 127, column: 2 }, end: { line: 129, column: 3 } }, { start: { line: 127, column: 2 }, end: { line: 129, column: 3 } }], line: 127 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0, 0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0], '20': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3238 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3239 return coverage[path];
3240 }coverageData.hash = hash;return coverage[path] = coverageData;
3241}(); /* global diff_match_patch */var TEXT_DIFF = (cov_270vbx2d41.s[0]++, 2);var DEFAULT_MIN_LENGTH = (cov_270vbx2d41.s[1]++, 60);var cachedDiffPatch = (cov_270vbx2d41.s[2]++, null);cov_270vbx2d41.s[3]++;var getDiffMatchPatch = function getDiffMatchPatch(required) {
3242 cov_270vbx2d41.f[0]++;cov_270vbx2d41.s[4]++; /* jshint camelcase: false */if (!cachedDiffPatch) {
3243 cov_270vbx2d41.b[0][0]++;var instance = (cov_270vbx2d41.s[5]++, void 0); /* eslint-disable camelcase, new-cap */cov_270vbx2d41.s[6]++;if (typeof diff_match_patch !== 'undefined') {
3244 cov_270vbx2d41.b[1][0]++;cov_270vbx2d41.s[7]++; // already loaded, probably a browser
3245 instance = typeof diff_match_patch === 'function' ? (cov_270vbx2d41.b[2][0]++, new diff_match_patch()) : (cov_270vbx2d41.b[2][1]++, new diff_match_patch.diff_match_patch());
3246 } else {
3247 cov_270vbx2d41.b[1][1]++;cov_270vbx2d41.s[8]++;if (diffMatchPatch) {
3248 cov_270vbx2d41.b[3][0]++;cov_270vbx2d41.s[9]++;try {
3249 cov_270vbx2d41.s[10]++;instance = (cov_270vbx2d41.b[4][0]++, diffMatchPatch) && (cov_270vbx2d41.b[4][1]++, new diffMatchPatch());
3250 } catch (err) {
3251 cov_270vbx2d41.s[11]++;instance = null;
3252 }
3253 } else {
3254 cov_270vbx2d41.b[3][1]++;
3255 }
3256 } /* eslint-enable camelcase, new-cap */cov_270vbx2d41.s[12]++;if (!instance) {
3257 cov_270vbx2d41.b[5][0]++;cov_270vbx2d41.s[13]++;if (!required) {
3258 cov_270vbx2d41.b[6][0]++;cov_270vbx2d41.s[14]++;return null;
3259 } else {
3260 cov_270vbx2d41.b[6][1]++;
3261 }var error = (cov_270vbx2d41.s[15]++, new Error('text diff_match_patch library not found')); // eslint-disable-next-line camelcase
3262 cov_270vbx2d41.s[16]++;error.diff_match_patch_not_found = true;cov_270vbx2d41.s[17]++;throw error;
3263 } else {
3264 cov_270vbx2d41.b[5][1]++;
3265 }cov_270vbx2d41.s[18]++;cachedDiffPatch = { diff: function diff(txt1, txt2) {
3266 cov_270vbx2d41.f[1]++;cov_270vbx2d41.s[19]++;return instance.patch_toText(instance.patch_make(txt1, txt2));
3267 }, patch: function patch(txt1, _patch) {
3268 cov_270vbx2d41.f[2]++;var results = (cov_270vbx2d41.s[20]++, instance.patch_apply(instance.patch_fromText(_patch), txt1));cov_270vbx2d41.s[21]++;for (var i = 0; i < results[1].length; i++) {
3269 cov_270vbx2d41.s[22]++;if (!results[1][i]) {
3270 cov_270vbx2d41.b[7][0]++;var _error = (cov_270vbx2d41.s[23]++, new Error('text patch failed'));cov_270vbx2d41.s[24]++;_error.textPatchFailed = true;
3271 } else {
3272 cov_270vbx2d41.b[7][1]++;
3273 }
3274 }cov_270vbx2d41.s[25]++;return results[0];
3275 } };
3276 } else {
3277 cov_270vbx2d41.b[0][1]++;
3278 }cov_270vbx2d41.s[26]++;return cachedDiffPatch;
3279};cov_270vbx2d41.s[27]++;var diffFilter$3 = function textsDiffFilter(context) {
3280 cov_270vbx2d41.f[3]++;cov_270vbx2d41.s[28]++;if (context.leftType !== 'string') {
3281 cov_270vbx2d41.b[8][0]++;cov_270vbx2d41.s[29]++;return;
3282 } else {
3283 cov_270vbx2d41.b[8][1]++;
3284 }var minLength = (cov_270vbx2d41.s[30]++, (cov_270vbx2d41.b[9][0]++, context.options) && (cov_270vbx2d41.b[9][1]++, context.options.textDiff) && (cov_270vbx2d41.b[9][2]++, context.options.textDiff.minLength) || (cov_270vbx2d41.b[9][3]++, DEFAULT_MIN_LENGTH));cov_270vbx2d41.s[31]++;if ((cov_270vbx2d41.b[11][0]++, context.left.length < minLength) || (cov_270vbx2d41.b[11][1]++, context.right.length < minLength)) {
3285 cov_270vbx2d41.b[10][0]++;cov_270vbx2d41.s[32]++;context.setResult([context.left, context.right]).exit();cov_270vbx2d41.s[33]++;return;
3286 } else {
3287 cov_270vbx2d41.b[10][1]++;
3288 } // large text, try to use a text-diff algorithm
3289 var diffMatchPatch$$1 = (cov_270vbx2d41.s[34]++, getDiffMatchPatch());cov_270vbx2d41.s[35]++;if (!diffMatchPatch$$1) {
3290 cov_270vbx2d41.b[12][0]++;cov_270vbx2d41.s[36]++; // diff-match-patch library not available,
3291 // fallback to regular string replace
3292 context.setResult([context.left, context.right]).exit();cov_270vbx2d41.s[37]++;return;
3293 } else {
3294 cov_270vbx2d41.b[12][1]++;
3295 }var diff = (cov_270vbx2d41.s[38]++, diffMatchPatch$$1.diff);cov_270vbx2d41.s[39]++;context.setResult([diff(context.left, context.right), 0, TEXT_DIFF]).exit();
3296};cov_270vbx2d41.s[40]++;diffFilter$3.filterName = 'texts';cov_270vbx2d41.s[41]++;var patchFilter$3 = function textsPatchFilter(context) {
3297 cov_270vbx2d41.f[4]++;cov_270vbx2d41.s[42]++;if (context.nested) {
3298 cov_270vbx2d41.b[13][0]++;cov_270vbx2d41.s[43]++;return;
3299 } else {
3300 cov_270vbx2d41.b[13][1]++;
3301 }cov_270vbx2d41.s[44]++;if (context.delta[2] !== TEXT_DIFF) {
3302 cov_270vbx2d41.b[14][0]++;cov_270vbx2d41.s[45]++;return;
3303 } else {
3304 cov_270vbx2d41.b[14][1]++;
3305 } // text-diff, use a text-patch algorithm
3306 var patch = (cov_270vbx2d41.s[46]++, getDiffMatchPatch(true).patch);cov_270vbx2d41.s[47]++;context.setResult(patch(context.left, context.delta[0])).exit();
3307};cov_270vbx2d41.s[48]++;patchFilter$3.filterName = 'texts';cov_270vbx2d41.s[49]++;var textDeltaReverse = function textDeltaReverse(delta) {
3308 cov_270vbx2d41.f[5]++;var i = (cov_270vbx2d41.s[50]++, void 0);var l = (cov_270vbx2d41.s[51]++, void 0);var lines = (cov_270vbx2d41.s[52]++, void 0);var line = (cov_270vbx2d41.s[53]++, void 0);var lineTmp = (cov_270vbx2d41.s[54]++, void 0);var header = (cov_270vbx2d41.s[55]++, null);var headerRegex = (cov_270vbx2d41.s[56]++, /^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/);var lineHeader = (cov_270vbx2d41.s[57]++, void 0);cov_270vbx2d41.s[58]++;lines = delta.split('\n');cov_270vbx2d41.s[59]++;for (i = 0, l = lines.length; i < l; i++) {
3309 cov_270vbx2d41.s[60]++;line = lines[i];var lineStart = (cov_270vbx2d41.s[61]++, line.slice(0, 1));cov_270vbx2d41.s[62]++;if (lineStart === '@') {
3310 cov_270vbx2d41.b[15][0]++;cov_270vbx2d41.s[63]++;header = headerRegex.exec(line);cov_270vbx2d41.s[64]++;lineHeader = i; // fix header
3311 cov_270vbx2d41.s[65]++;lines[lineHeader] = '@@ -' + header[3] + ',' + header[4] + ' +' + header[1] + ',' + header[2] + ' @@';
3312 } else {
3313 cov_270vbx2d41.b[15][1]++;cov_270vbx2d41.s[66]++;if (lineStart === '+') {
3314 cov_270vbx2d41.b[16][0]++;cov_270vbx2d41.s[67]++;lines[i] = '-' + lines[i].slice(1);cov_270vbx2d41.s[68]++;if (lines[i - 1].slice(0, 1) === '+') {
3315 cov_270vbx2d41.b[17][0]++;cov_270vbx2d41.s[69]++; // swap lines to keep default order (-+)
3316 lineTmp = lines[i];cov_270vbx2d41.s[70]++;lines[i] = lines[i - 1];cov_270vbx2d41.s[71]++;lines[i - 1] = lineTmp;
3317 } else {
3318 cov_270vbx2d41.b[17][1]++;
3319 }
3320 } else {
3321 cov_270vbx2d41.b[16][1]++;cov_270vbx2d41.s[72]++;if (lineStart === '-') {
3322 cov_270vbx2d41.b[18][0]++;cov_270vbx2d41.s[73]++;lines[i] = '+' + lines[i].slice(1);
3323 } else {
3324 cov_270vbx2d41.b[18][1]++;
3325 }
3326 }
3327 }
3328 }cov_270vbx2d41.s[74]++;return lines.join('\n');
3329};cov_270vbx2d41.s[75]++;var reverseFilter$3 = function textsReverseFilter(context) {
3330 cov_270vbx2d41.f[6]++;cov_270vbx2d41.s[76]++;if (context.nested) {
3331 cov_270vbx2d41.b[19][0]++;cov_270vbx2d41.s[77]++;return;
3332 } else {
3333 cov_270vbx2d41.b[19][1]++;
3334 }cov_270vbx2d41.s[78]++;if (context.delta[2] !== TEXT_DIFF) {
3335 cov_270vbx2d41.b[20][0]++;cov_270vbx2d41.s[79]++;return;
3336 } else {
3337 cov_270vbx2d41.b[20][1]++;
3338 } // text-diff, use a text-diff algorithm
3339 cov_270vbx2d41.s[80]++;context.setResult([textDeltaReverse(context.delta[0]), 0, TEXT_DIFF]).exit();
3340};cov_270vbx2d41.s[81]++;reverseFilter$3.filterName = 'texts';
3341
3342var cov_1oxpk51fyz = function () {
3343 var path = '/Users/benja/proj/jsondiffpatch/src/diffpatcher.js',
3344 hash = 'afb73d8bb84427cf6d05cac032da70bc57baca2b',
3345 global = new Function('return this')(),
3346 gcv = '__coverage__',
3347 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/diffpatcher.js', statementMap: { '0': { start: { line: 14, column: 18 }, end: { line: 58, column: 3 } }, '1': { start: { line: 16, column: 4 }, end: { line: 16, column: 51 } }, '2': { start: { line: 18, column: 4 }, end: { line: 18, column: 44 } }, '3': { start: { line: 19, column: 4 }, end: { line: 19, column: 203 } }, '4': { start: { line: 20, column: 4 }, end: { line: 20, column: 219 } }, '5': { start: { line: 21, column: 4 }, end: { line: 21, column: 233 } }, '6': { start: { line: 24, column: 2 }, end: { line: 56, column: 6 } }, '7': { start: { line: 29, column: 6 }, end: { line: 29, column: 80 } }, '8': { start: { line: 34, column: 6 }, end: { line: 34, column: 66 } }, '9': { start: { line: 39, column: 6 }, end: { line: 39, column: 67 } }, '10': { start: { line: 44, column: 6 }, end: { line: 44, column: 63 } }, '11': { start: { line: 49, column: 6 }, end: { line: 49, column: 52 } }, '12': { start: { line: 54, column: 6 }, end: { line: 54, column: 27 } }, '13': { start: { line: 57, column: 2 }, end: { line: 57, column: 21 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 14, column: 18 }, end: { line: 14, column: 19 } }, loc: { start: { line: 14, column: 30 }, end: { line: 58, column: 1 } }, line: 14 }, '1': { name: 'DiffPatcher', decl: { start: { line: 15, column: 11 }, end: { line: 15, column: 22 } }, loc: { start: { line: 15, column: 32 }, end: { line: 22, column: 3 } }, line: 15 }, '2': { name: 'options', decl: { start: { line: 26, column: 20 }, end: { line: 26, column: 27 } }, loc: { start: { line: 26, column: 30 }, end: { line: 30, column: 5 } }, line: 26 }, '3': { name: 'diff', decl: { start: { line: 33, column: 20 }, end: { line: 33, column: 24 } }, loc: { start: { line: 33, column: 38 }, end: { line: 35, column: 5 } }, line: 33 }, '4': { name: 'patch', decl: { start: { line: 38, column: 20 }, end: { line: 38, column: 25 } }, loc: { start: { line: 38, column: 39 }, end: { line: 40, column: 5 } }, line: 38 }, '5': { name: 'reverse', decl: { start: { line: 43, column: 20 }, end: { line: 43, column: 27 } }, loc: { start: { line: 43, column: 35 }, end: { line: 45, column: 5 } }, line: 43 }, '6': { name: 'unpatch', decl: { start: { line: 48, column: 20 }, end: { line: 48, column: 27 } }, loc: { start: { line: 48, column: 42 }, end: { line: 50, column: 5 } }, line: 48 }, '7': { name: 'clone', decl: { start: { line: 53, column: 20 }, end: { line: 53, column: 25 } }, loc: { start: { line: 53, column: 33 }, end: { line: 55, column: 5 } }, line: 53 } }, branchMap: {}, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0 }, b: {}, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3348 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3349 return coverage[path];
3350 }coverageData.hash = hash;return coverage[path] = coverageData;
3351}();var DiffPatcher = (cov_1oxpk51fyz.s[0]++, function () {
3352 cov_1oxpk51fyz.f[0]++;function DiffPatcher(options) {
3353 cov_1oxpk51fyz.f[1]++;cov_1oxpk51fyz.s[1]++;classCallCheck$1(this, DiffPatcher);cov_1oxpk51fyz.s[2]++;this.processor = new Processor(options);cov_1oxpk51fyz.s[3]++;this.processor.pipe(new Pipe('diff').append(collectChildrenDiffFilter, diffFilter, diffFilter$2, diffFilter$3, objectsDiffFilter, diffFilter$1).shouldHaveResult());cov_1oxpk51fyz.s[4]++;this.processor.pipe(new Pipe('patch').append(collectChildrenPatchFilter, collectChildrenPatchFilter$1, patchFilter, patchFilter$3, patchFilter$1, patchFilter$2).shouldHaveResult());cov_1oxpk51fyz.s[5]++;this.processor.pipe(new Pipe('reverse').append(collectChildrenReverseFilter, collectChildrenReverseFilter$1, reverseFilter, reverseFilter$3, reverseFilter$1, reverseFilter$2).shouldHaveResult());
3354 }cov_1oxpk51fyz.s[6]++;createClass$1(DiffPatcher, [{ key: 'options', value: function options() {
3355 cov_1oxpk51fyz.f[2]++;var _processor;cov_1oxpk51fyz.s[7]++;return (_processor = this.processor).options.apply(_processor, arguments);
3356 } }, { key: 'diff', value: function diff(left, right) {
3357 cov_1oxpk51fyz.f[3]++;cov_1oxpk51fyz.s[8]++;return this.processor.process(new DiffContext(left, right));
3358 } }, { key: 'patch', value: function patch(left, delta) {
3359 cov_1oxpk51fyz.f[4]++;cov_1oxpk51fyz.s[9]++;return this.processor.process(new PatchContext(left, delta));
3360 } }, { key: 'reverse', value: function reverse(delta) {
3361 cov_1oxpk51fyz.f[5]++;cov_1oxpk51fyz.s[10]++;return this.processor.process(new ReverseContext(delta));
3362 } }, { key: 'unpatch', value: function unpatch(right, delta) {
3363 cov_1oxpk51fyz.f[6]++;cov_1oxpk51fyz.s[11]++;return this.patch(right, this.reverse(delta));
3364 } }, { key: 'clone', value: function clone$$1(value) {
3365 cov_1oxpk51fyz.f[7]++;cov_1oxpk51fyz.s[12]++;return clone(value);
3366 } }]);cov_1oxpk51fyz.s[13]++;return DiffPatcher;
3367}());
3368
3369var cov_1ac9yxw2a1 = function () {
3370 var path = '/Users/benja/proj/jsondiffpatch/src/formatters/base.js',
3371 hash = '9122c1b3145bac8ced2066a881aa40d08fca69c2',
3372 global = new Function('return this')(),
3373 gcv = '__coverage__',
3374 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/formatters/base.js', statementMap: { '0': { start: { line: 1, column: 14 }, end: { line: 3, column: 1 } }, '1': { start: { line: 2, column: 2 }, end: { line: 2, column: 28 } }, '2': { start: { line: 5, column: 20 }, end: { line: 15, column: 1 } }, '3': { start: { line: 6, column: 2 }, end: { line: 6, column: 26 } }, '4': { start: { line: 8, column: 14 }, end: { line: 8, column: 16 } }, '5': { start: { line: 9, column: 2 }, end: { line: 13, column: 3 } }, '6': { start: { line: 10, column: 4 }, end: { line: 12, column: 5 } }, '7': { start: { line: 11, column: 6 }, end: { line: 11, column: 27 } }, '8': { start: { line: 14, column: 2 }, end: { line: 14, column: 15 } }, '9': { start: { line: 17, column: 21 }, end: { line: 22, column: 1 } }, '10': { start: { line: 18, column: 2 }, end: { line: 20, column: 3 } }, '11': { start: { line: 19, column: 4 }, end: { line: 19, column: 24 } }, '12': { start: { line: 21, column: 2 }, end: { line: 21, column: 13 } }, '13': { start: { line: 24, column: 27 }, end: { line: 34, column: 1 } }, '14': { start: { line: 25, column: 2 }, end: { line: 33, column: 3 } }, '15': { start: { line: 26, column: 4 }, end: { line: 26, column: 14 } }, '16': { start: { line: 28, column: 4 }, end: { line: 32, column: 5 } }, '17': { start: { line: 29, column: 6 }, end: { line: 29, column: 40 } }, '18': { start: { line: 31, column: 6 }, end: { line: 31, column: 37 } }, '19': { start: { line: 36, column: 23 }, end: { line: 38, column: 1 } }, '20': { start: { line: 37, column: 2 }, end: { line: 37, column: 65 } }, '21': { start: { line: 40, column: 20 }, end: { line: 242, column: 3 } }, '22': { start: { line: 42, column: 4 }, end: { line: 42, column: 53 } }, '23': { start: { line: 45, column: 2 }, end: { line: 240, column: 6 } }, '24': { start: { line: 48, column: 20 }, end: { line: 48, column: 22 } }, '25': { start: { line: 49, column: 6 }, end: { line: 49, column: 35 } }, '26': { start: { line: 50, column: 6 }, end: { line: 50, column: 41 } }, '27': { start: { line: 51, column: 6 }, end: { line: 51, column: 36 } }, '28': { start: { line: 56, column: 6 }, end: { line: 56, column: 26 } }, '29': { start: { line: 57, column: 6 }, end: { line: 61, column: 8 } }, '30': { start: { line: 60, column: 8 }, end: { line: 60, column: 63 } }, '31': { start: { line: 66, column: 6 }, end: { line: 66, column: 64 } }, '32': { start: { line: 71, column: 6 }, end: { line: 71, column: 28 } }, '33': { start: { line: 76, column: 19 }, end: { line: 76, column: 30 } }, '34': { start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }, '35': { start: { line: 79, column: 8 }, end: { line: 79, column: 31 } }, '36': { start: { line: 85, column: 30 }, end: { line: 85, column: 48 } }, '37': { start: { line: 86, column: 22 }, end: { line: 86, column: 64 } }, '38': { start: { line: 88, column: 6 }, end: { line: 90, column: 7 } }, '39': { start: { line: 89, column: 8 }, end: { line: 89, column: 25 } }, '40': { start: { line: 92, column: 17 }, end: { line: 92, column: 52 } }, '41': { start: { line: 93, column: 21 }, end: { line: 93, column: 81 } }, '42': { start: { line: 95, column: 6 }, end: { line: 99, column: 7 } }, '43': { start: { line: 96, column: 8 }, end: { line: 96, column: 70 } }, '44': { start: { line: 98, column: 8 }, end: { line: 98, column: 48 } }, '45': { start: { line: 101, column: 27 }, end: { line: 101, column: 33 } }, '46': { start: { line: 102, column: 6 }, end: { line: 110, column: 7 } }, '47': { start: { line: 103, column: 8 }, end: { line: 103, column: 94 } }, '48': { start: { line: 104, column: 8 }, end: { line: 104, column: 86 } }, '49': { start: { line: 106, column: 8 }, end: { line: 106, column: 99 } }, '50': { start: { line: 107, column: 8 }, end: { line: 109, column: 9 } }, '51': { start: { line: 108, column: 10 }, end: { line: 108, column: 35 } }, '52': { start: { line: 112, column: 6 }, end: { line: 116, column: 7 } }, '53': { start: { line: 113, column: 8 }, end: { line: 113, column: 68 } }, '54': { start: { line: 115, column: 8 }, end: { line: 115, column: 46 } }, '55': { start: { line: 121, column: 17 }, end: { line: 121, column: 21 } }, '56': { start: { line: 122, column: 6 }, end: { line: 124, column: 9 } }, '57': { start: { line: 123, column: 8 }, end: { line: 123, column: 109 } }, '58': { start: { line: 129, column: 17 }, end: { line: 129, column: 37 } }, '59': { start: { line: 130, column: 22 }, end: { line: 130, column: 38 } }, '60': { start: { line: 131, column: 29 }, end: { line: 131, column: 31 } }, '61': { start: { line: 132, column: 17 }, end: { line: 132, column: 23 } }, '62': { start: { line: 133, column: 6 }, end: { line: 141, column: 7 } }, '63': { start: { line: 134, column: 8 }, end: { line: 140, column: 9 } }, '64': { start: { line: 135, column: 10 }, end: { line: 139, column: 11 } }, '65': { start: { line: 136, column: 12 }, end: { line: 138, column: 13 } }, '66': { start: { line: 137, column: 14 }, end: { line: 137, column: 30 } }, '67': { start: { line: 143, column: 6 }, end: { line: 158, column: 7 } }, '68': { start: { line: 144, column: 8 }, end: { line: 157, column: 9 } }, '69': { start: { line: 145, column: 22 }, end: { line: 145, column: 33 } }, '70': { start: { line: 146, column: 10 }, end: { line: 156, column: 11 } }, '71': { start: { line: 147, column: 12 }, end: { line: 150, column: 14 } }, '72': { start: { line: 151, column: 12 }, end: { line: 155, column: 13 } }, '73': { start: { line: 152, column: 14 }, end: { line: 154, column: 15 } }, '74': { start: { line: 153, column: 16 }, end: { line: 153, column: 47 } }, '75': { start: { line: 159, column: 6 }, end: { line: 163, column: 7 } }, '76': { start: { line: 160, column: 8 }, end: { line: 160, column: 36 } }, '77': { start: { line: 162, column: 8 }, end: { line: 162, column: 20 } }, '78': { start: { line: 164, column: 6 }, end: { line: 172, column: 7 } }, '79': { start: { line: 165, column: 18 }, end: { line: 165, column: 29 } }, '80': { start: { line: 166, column: 8 }, end: { line: 168, column: 9 } }, '81': { start: { line: 167, column: 10 }, end: { line: 167, column: 19 } }, '82': { start: { line: 169, column: 22 }, end: { line: 169, column: 105 } }, '83': { start: { line: 170, column: 21 }, end: { line: 170, column: 41 } }, '84': { start: { line: 171, column: 8 }, end: { line: 171, column: 60 } }, '85': { start: { line: 177, column: 6 }, end: { line: 182, column: 7 } }, '86': { start: { line: 178, column: 8 }, end: { line: 180, column: 9 } }, '87': { start: { line: 179, column: 10 }, end: { line: 179, column: 35 } }, '88': { start: { line: 181, column: 8 }, end: { line: 181, column: 27 } }, '89': { start: { line: 183, column: 6 }, end: { line: 201, column: 7 } }, '90': { start: { line: 184, column: 8 }, end: { line: 186, column: 9 } }, '91': { start: { line: 185, column: 10 }, end: { line: 185, column: 25 } }, '92': { start: { line: 187, column: 8 }, end: { line: 189, column: 9 } }, '93': { start: { line: 188, column: 10 }, end: { line: 188, column: 28 } }, '94': { start: { line: 190, column: 8 }, end: { line: 192, column: 9 } }, '95': { start: { line: 191, column: 10 }, end: { line: 191, column: 27 } }, '96': { start: { line: 193, column: 8 }, end: { line: 195, column: 9 } }, '97': { start: { line: 194, column: 10 }, end: { line: 194, column: 28 } }, '98': { start: { line: 196, column: 8 }, end: { line: 198, column: 9 } }, '99': { start: { line: 197, column: 10 }, end: { line: 197, column: 25 } }, '100': { start: { line: 199, column: 13 }, end: { line: 201, column: 7 } }, '101': { start: { line: 200, column: 8 }, end: { line: 200, column: 22 } }, '102': { start: { line: 202, column: 6 }, end: { line: 202, column: 23 } }, '103': { start: { line: 207, column: 19 }, end: { line: 207, column: 21 } }, '104': { start: { line: 208, column: 18 }, end: { line: 208, column: 38 } }, '105': { start: { line: 209, column: 6 }, end: { line: 237, column: 7 } }, '106': { start: { line: 210, column: 19 }, end: { line: 210, column: 27 } }, '107': { start: { line: 211, column: 25 }, end: { line: 213, column: 9 } }, '108': { start: { line: 214, column: 23 }, end: { line: 214, column: 70 } }, '109': { start: { line: 215, column: 8 }, end: { line: 218, column: 10 } }, '110': { start: { line: 219, column: 21 }, end: { line: 219, column: 46 } }, '111': { start: { line: 220, column: 8 }, end: { line: 235, column: 9 } }, '112': { start: { line: 221, column: 22 }, end: { line: 221, column: 40 } }, '113': { start: { line: 222, column: 10 }, end: { line: 224, column: 11 } }, '114': { start: { line: 223, column: 12 }, end: { line: 223, column: 21 } }, '115': { start: { line: 225, column: 28 }, end: { line: 227, column: 11 } }, '116': { start: { line: 228, column: 10 }, end: { line: 232, column: 11 } }, '117': { start: { line: 229, column: 12 }, end: { line: 229, column: 39 } }, '118': { start: { line: 230, column: 17 }, end: { line: 232, column: 11 } }, '119': { start: { line: 231, column: 12 }, end: { line: 231, column: 41 } }, '120': { start: { line: 233, column: 10 }, end: { line: 233, column: 44 } }, '121': { start: { line: 234, column: 10 }, end: { line: 234, column: 46 } }, '122': { start: { line: 236, column: 8 }, end: { line: 236, column: 32 } }, '123': { start: { line: 238, column: 6 }, end: { line: 238, column: 20 } }, '124': { start: { line: 241, column: 2 }, end: { line: 241, column: 23 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 1, column: 68 }, end: { line: 1, column: 69 } }, loc: { start: { line: 1, column: 81 }, end: { line: 3, column: 1 } }, line: 1 }, '1': { name: '(anonymous_1)', decl: { start: { line: 5, column: 56 }, end: { line: 5, column: 57 } }, loc: { start: { line: 5, column: 71 }, end: { line: 7, column: 1 } }, line: 5 }, '2': { name: '(anonymous_2)', decl: { start: { line: 7, column: 4 }, end: { line: 7, column: 5 } }, loc: { start: { line: 7, column: 19 }, end: { line: 15, column: 1 } }, line: 7 }, '3': { name: 'trimUnderscore', decl: { start: { line: 17, column: 30 }, end: { line: 17, column: 44 } }, loc: { start: { line: 17, column: 50 }, end: { line: 22, column: 1 } }, line: 17 }, '4': { name: 'arrayKeyToSortNumber', decl: { start: { line: 24, column: 36 }, end: { line: 24, column: 56 } }, loc: { start: { line: 24, column: 62 }, end: { line: 34, column: 1 } }, line: 24 }, '5': { name: 'arrayKeyComparer', decl: { start: { line: 36, column: 32 }, end: { line: 36, column: 48 } }, loc: { start: { line: 36, column: 61 }, end: { line: 38, column: 1 } }, line: 36 }, '6': { name: '(anonymous_6)', decl: { start: { line: 40, column: 20 }, end: { line: 40, column: 21 } }, loc: { start: { line: 40, column: 32 }, end: { line: 242, column: 1 } }, line: 40 }, '7': { name: 'BaseFormatter', decl: { start: { line: 41, column: 11 }, end: { line: 41, column: 24 } }, loc: { start: { line: 41, column: 27 }, end: { line: 43, column: 3 } }, line: 41 }, '8': { name: 'format', decl: { start: { line: 47, column: 20 }, end: { line: 47, column: 26 } }, loc: { start: { line: 47, column: 40 }, end: { line: 52, column: 5 } }, line: 47 }, '9': { name: 'prepareContext', decl: { start: { line: 55, column: 20 }, end: { line: 55, column: 34 } }, loc: { start: { line: 55, column: 44 }, end: { line: 62, column: 5 } }, line: 55 }, '10': { name: '(anonymous_10)', decl: { start: { line: 57, column: 20 }, end: { line: 57, column: 21 } }, loc: { start: { line: 57, column: 32 }, end: { line: 61, column: 7 } }, line: 57 }, '11': { name: 'typeFormattterNotFound', decl: { start: { line: 65, column: 20 }, end: { line: 65, column: 42 } }, loc: { start: { line: 65, column: 63 }, end: { line: 67, column: 5 } }, line: 65 }, '12': { name: 'typeFormattterErrorFormatter', decl: { start: { line: 70, column: 20 }, end: { line: 70, column: 48 } }, loc: { start: { line: 70, column: 63 }, end: { line: 72, column: 5 } }, line: 70 }, '13': { name: 'finalize', decl: { start: { line: 75, column: 20 }, end: { line: 75, column: 28 } }, loc: { start: { line: 75, column: 35 }, end: { line: 81, column: 5 } }, line: 75 }, '14': { name: 'recurse', decl: { start: { line: 84, column: 20 }, end: { line: 84, column: 27 } }, loc: { start: { line: 84, column: 83 }, end: { line: 117, column: 5 } }, line: 84 }, '15': { name: 'formatDeltaChildren', decl: { start: { line: 120, column: 20 }, end: { line: 120, column: 39 } }, loc: { start: { line: 120, column: 62 }, end: { line: 125, column: 5 } }, line: 120 }, '16': { name: '(anonymous_16)', decl: { start: { line: 122, column: 40 }, end: { line: 122, column: 41 } }, loc: { start: { line: 122, column: 83 }, end: { line: 124, column: 7 } }, line: 122 }, '17': { name: 'forEachDeltaKey', decl: { start: { line: 128, column: 20 }, end: { line: 128, column: 35 } }, loc: { start: { line: 128, column: 53 }, end: { line: 173, column: 5 } }, line: 128 }, '18': { name: 'getDeltaType', decl: { start: { line: 176, column: 20 }, end: { line: 176, column: 32 } }, loc: { start: { line: 176, column: 51 }, end: { line: 203, column: 5 } }, line: 176 }, '19': { name: 'parseTextDiff', decl: { start: { line: 206, column: 20 }, end: { line: 206, column: 33 } }, loc: { start: { line: 206, column: 41 }, end: { line: 239, column: 5 } }, line: 206 } }, branchMap: { '0': { loc: { start: { line: 1, column: 14 }, end: { line: 3, column: 1 } }, type: 'cond-expr', locations: [{ start: { line: 1, column: 52 }, end: { line: 1, column: 65 } }, { start: { line: 1, column: 68 }, end: { line: 3, column: 1 } }], line: 1 }, '1': { loc: { start: { line: 5, column: 20 }, end: { line: 15, column: 1 } }, type: 'cond-expr', locations: [{ start: { line: 5, column: 56 }, end: { line: 7, column: 1 } }, { start: { line: 7, column: 4 }, end: { line: 15, column: 1 } }], line: 5 }, '2': { loc: { start: { line: 10, column: 4 }, end: { line: 12, column: 5 } }, type: 'if', locations: [{ start: { line: 10, column: 4 }, end: { line: 12, column: 5 } }, { start: { line: 10, column: 4 }, end: { line: 12, column: 5 } }], line: 10 }, '3': { loc: { start: { line: 18, column: 2 }, end: { line: 20, column: 3 } }, type: 'if', locations: [{ start: { line: 18, column: 2 }, end: { line: 20, column: 3 } }, { start: { line: 18, column: 2 }, end: { line: 20, column: 3 } }], line: 18 }, '4': { loc: { start: { line: 25, column: 2 }, end: { line: 33, column: 3 } }, type: 'if', locations: [{ start: { line: 25, column: 2 }, end: { line: 33, column: 3 } }, { start: { line: 25, column: 2 }, end: { line: 33, column: 3 } }], line: 25 }, '5': { loc: { start: { line: 28, column: 4 }, end: { line: 32, column: 5 } }, type: 'if', locations: [{ start: { line: 28, column: 4 }, end: { line: 32, column: 5 } }, { start: { line: 28, column: 4 }, end: { line: 32, column: 5 } }], line: 28 }, '6': { loc: { start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }, type: 'if', locations: [{ start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }, { start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }], line: 78 }, '7': { loc: { start: { line: 85, column: 30 }, end: { line: 85, column: 48 } }, type: 'binary-expr', locations: [{ start: { line: 85, column: 30 }, end: { line: 85, column: 35 } }, { start: { line: 85, column: 39 }, end: { line: 85, column: 48 } }], line: 85 }, '8': { loc: { start: { line: 86, column: 22 }, end: { line: 86, column: 64 } }, type: 'cond-expr', locations: [{ start: { line: 86, column: 42 }, end: { line: 86, column: 57 } }, { start: { line: 86, column: 60 }, end: { line: 86, column: 64 } }], line: 86 }, '9': { loc: { start: { line: 88, column: 6 }, end: { line: 90, column: 7 } }, type: 'if', locations: [{ start: { line: 88, column: 6 }, end: { line: 90, column: 7 } }, { start: { line: 88, column: 6 }, end: { line: 90, column: 7 } }], line: 88 }, '10': { loc: { start: { line: 88, column: 10 }, end: { line: 88, column: 68 } }, type: 'binary-expr', locations: [{ start: { line: 88, column: 10 }, end: { line: 88, column: 38 } }, { start: { line: 88, column: 42 }, end: { line: 88, column: 68 } }], line: 88 }, '11': { loc: { start: { line: 93, column: 21 }, end: { line: 93, column: 81 } }, type: 'cond-expr', locations: [{ start: { line: 93, column: 39 }, end: { line: 93, column: 76 } }, { start: { line: 93, column: 79 }, end: { line: 93, column: 81 } }], line: 93 }, '12': { loc: { start: { line: 93, column: 39 }, end: { line: 93, column: 76 } }, type: 'cond-expr', locations: [{ start: { line: 93, column: 58 }, end: { line: 93, column: 65 } }, { start: { line: 93, column: 68 }, end: { line: 93, column: 76 } }], line: 93 }, '13': { loc: { start: { line: 95, column: 6 }, end: { line: 99, column: 7 } }, type: 'if', locations: [{ start: { line: 95, column: 6 }, end: { line: 99, column: 7 } }, { start: { line: 95, column: 6 }, end: { line: 99, column: 7 } }], line: 95 }, '14': { loc: { start: { line: 103, column: 25 }, end: { line: 103, column: 93 } }, type: 'binary-expr', locations: [{ start: { line: 103, column: 25 }, end: { line: 103, column: 47 } }, { start: { line: 103, column: 51 }, end: { line: 103, column: 93 } }], line: 103 }, '15': { loc: { start: { line: 107, column: 8 }, end: { line: 109, column: 9 } }, type: 'if', locations: [{ start: { line: 107, column: 8 }, end: { line: 109, column: 9 } }, { start: { line: 107, column: 8 }, end: { line: 109, column: 9 } }], line: 107 }, '16': { loc: { start: { line: 107, column: 12 }, end: { line: 107, column: 59 } }, type: 'binary-expr', locations: [{ start: { line: 107, column: 12 }, end: { line: 107, column: 42 } }, { start: { line: 107, column: 46 }, end: { line: 107, column: 59 } }], line: 107 }, '17': { loc: { start: { line: 112, column: 6 }, end: { line: 116, column: 7 } }, type: 'if', locations: [{ start: { line: 112, column: 6 }, end: { line: 116, column: 7 } }, { start: { line: 112, column: 6 }, end: { line: 116, column: 7 } }], line: 112 }, '18': { loc: { start: { line: 123, column: 42 }, end: { line: 123, column: 74 } }, type: 'cond-expr', locations: [{ start: { line: 123, column: 49 }, end: { line: 123, column: 62 } }, { start: { line: 123, column: 65 }, end: { line: 123, column: 74 } }], line: 123 }, '19': { loc: { start: { line: 133, column: 6 }, end: { line: 141, column: 7 } }, type: 'if', locations: [{ start: { line: 133, column: 6 }, end: { line: 141, column: 7 } }, { start: { line: 133, column: 6 }, end: { line: 141, column: 7 } }], line: 133 }, '20': { loc: { start: { line: 135, column: 10 }, end: { line: 139, column: 11 } }, type: 'if', locations: [{ start: { line: 135, column: 10 }, end: { line: 139, column: 11 } }, { start: { line: 135, column: 10 }, end: { line: 139, column: 11 } }], line: 135 }, '21': { loc: { start: { line: 136, column: 12 }, end: { line: 138, column: 13 } }, type: 'if', locations: [{ start: { line: 136, column: 12 }, end: { line: 138, column: 13 } }, { start: { line: 136, column: 12 }, end: { line: 138, column: 13 } }], line: 136 }, '22': { loc: { start: { line: 136, column: 16 }, end: { line: 136, column: 110 } }, type: 'binary-expr', locations: [{ start: { line: 136, column: 16 }, end: { line: 136, column: 50 } }, { start: { line: 136, column: 55 }, end: { line: 136, column: 65 } }, { start: { line: 136, column: 69 }, end: { line: 136, column: 109 } }], line: 136 }, '23': { loc: { start: { line: 144, column: 8 }, end: { line: 157, column: 9 } }, type: 'if', locations: [{ start: { line: 144, column: 8 }, end: { line: 157, column: 9 } }, { start: { line: 144, column: 8 }, end: { line: 157, column: 9 } }], line: 144 }, '24': { loc: { start: { line: 146, column: 10 }, end: { line: 156, column: 11 } }, type: 'if', locations: [{ start: { line: 146, column: 10 }, end: { line: 156, column: 11 } }, { start: { line: 146, column: 10 }, end: { line: 156, column: 11 } }], line: 146 }, '25': { loc: { start: { line: 146, column: 14 }, end: { line: 146, column: 46 } }, type: 'binary-expr', locations: [{ start: { line: 146, column: 14 }, end: { line: 146, column: 28 } }, { start: { line: 146, column: 32 }, end: { line: 146, column: 46 } }], line: 146 }, '26': { loc: { start: { line: 149, column: 21 }, end: { line: 149, column: 59 } }, type: 'binary-expr', locations: [{ start: { line: 149, column: 21 }, end: { line: 149, column: 25 } }, { start: { line: 149, column: 29 }, end: { line: 149, column: 59 } }], line: 149 }, '27': { loc: { start: { line: 151, column: 12 }, end: { line: 155, column: 13 } }, type: 'if', locations: [{ start: { line: 151, column: 12 }, end: { line: 155, column: 13 } }, { start: { line: 151, column: 12 }, end: { line: 155, column: 13 } }], line: 151 }, '28': { loc: { start: { line: 152, column: 14 }, end: { line: 154, column: 15 } }, type: 'if', locations: [{ start: { line: 152, column: 14 }, end: { line: 154, column: 15 } }, { start: { line: 152, column: 14 }, end: { line: 154, column: 15 } }], line: 152 }, '29': { loc: { start: { line: 152, column: 18 }, end: { line: 152, column: 87 } }, type: 'binary-expr', locations: [{ start: { line: 152, column: 18 }, end: { line: 152, column: 45 } }, { start: { line: 152, column: 49 }, end: { line: 152, column: 87 } }], line: 152 }, '30': { loc: { start: { line: 159, column: 6 }, end: { line: 163, column: 7 } }, type: 'if', locations: [{ start: { line: 159, column: 6 }, end: { line: 163, column: 7 } }, { start: { line: 159, column: 6 }, end: { line: 163, column: 7 } }], line: 159 }, '31': { loc: { start: { line: 166, column: 8 }, end: { line: 168, column: 9 } }, type: 'if', locations: [{ start: { line: 166, column: 8 }, end: { line: 168, column: 9 } }, { start: { line: 166, column: 8 }, end: { line: 168, column: 9 } }], line: 166 }, '32': { loc: { start: { line: 166, column: 12 }, end: { line: 166, column: 37 } }, type: 'binary-expr', locations: [{ start: { line: 166, column: 12 }, end: { line: 166, column: 21 } }, { start: { line: 166, column: 25 }, end: { line: 166, column: 37 } }], line: 166 }, '33': { loc: { start: { line: 169, column: 22 }, end: { line: 169, column: 105 } }, type: 'cond-expr', locations: [{ start: { line: 169, column: 34 }, end: { line: 169, column: 99 } }, { start: { line: 169, column: 102 }, end: { line: 169, column: 105 } }], line: 169 }, '34': { loc: { start: { line: 169, column: 34 }, end: { line: 169, column: 99 } }, type: 'cond-expr', locations: [{ start: { line: 169, column: 60 }, end: { line: 169, column: 63 } }, { start: { line: 169, column: 66 }, end: { line: 169, column: 99 } }], line: 169 }, '35': { loc: { start: { line: 177, column: 6 }, end: { line: 182, column: 7 } }, type: 'if', locations: [{ start: { line: 177, column: 6 }, end: { line: 182, column: 7 } }, { start: { line: 177, column: 6 }, end: { line: 182, column: 7 } }], line: 177 }, '36': { loc: { start: { line: 178, column: 8 }, end: { line: 180, column: 9 } }, type: 'if', locations: [{ start: { line: 178, column: 8 }, end: { line: 180, column: 9 } }, { start: { line: 178, column: 8 }, end: { line: 180, column: 9 } }], line: 178 }, '37': { loc: { start: { line: 183, column: 6 }, end: { line: 201, column: 7 } }, type: 'if', locations: [{ start: { line: 183, column: 6 }, end: { line: 201, column: 7 } }, { start: { line: 183, column: 6 }, end: { line: 201, column: 7 } }], line: 183 }, '38': { loc: { start: { line: 184, column: 8 }, end: { line: 186, column: 9 } }, type: 'if', locations: [{ start: { line: 184, column: 8 }, end: { line: 186, column: 9 } }, { start: { line: 184, column: 8 }, end: { line: 186, column: 9 } }], line: 184 }, '39': { loc: { start: { line: 187, column: 8 }, end: { line: 189, column: 9 } }, type: 'if', locations: [{ start: { line: 187, column: 8 }, end: { line: 189, column: 9 } }, { start: { line: 187, column: 8 }, end: { line: 189, column: 9 } }], line: 187 }, '40': { loc: { start: { line: 190, column: 8 }, end: { line: 192, column: 9 } }, type: 'if', locations: [{ start: { line: 190, column: 8 }, end: { line: 192, column: 9 } }, { start: { line: 190, column: 8 }, end: { line: 192, column: 9 } }], line: 190 }, '41': { loc: { start: { line: 190, column: 12 }, end: { line: 190, column: 48 } }, type: 'binary-expr', locations: [{ start: { line: 190, column: 12 }, end: { line: 190, column: 30 } }, { start: { line: 190, column: 34 }, end: { line: 190, column: 48 } }], line: 190 }, '42': { loc: { start: { line: 193, column: 8 }, end: { line: 195, column: 9 } }, type: 'if', locations: [{ start: { line: 193, column: 8 }, end: { line: 195, column: 9 } }, { start: { line: 193, column: 8 }, end: { line: 195, column: 9 } }], line: 193 }, '43': { loc: { start: { line: 193, column: 12 }, end: { line: 193, column: 48 } }, type: 'binary-expr', locations: [{ start: { line: 193, column: 12 }, end: { line: 193, column: 30 } }, { start: { line: 193, column: 34 }, end: { line: 193, column: 48 } }], line: 193 }, '44': { loc: { start: { line: 196, column: 8 }, end: { line: 198, column: 9 } }, type: 'if', locations: [{ start: { line: 196, column: 8 }, end: { line: 198, column: 9 } }, { start: { line: 196, column: 8 }, end: { line: 198, column: 9 } }], line: 196 }, '45': { loc: { start: { line: 196, column: 12 }, end: { line: 196, column: 48 } }, type: 'binary-expr', locations: [{ start: { line: 196, column: 12 }, end: { line: 196, column: 30 } }, { start: { line: 196, column: 34 }, end: { line: 196, column: 48 } }], line: 196 }, '46': { loc: { start: { line: 199, column: 13 }, end: { line: 201, column: 7 } }, type: 'if', locations: [{ start: { line: 199, column: 13 }, end: { line: 201, column: 7 } }, { start: { line: 199, column: 13 }, end: { line: 201, column: 7 } }], line: 199 }, '47': { loc: { start: { line: 199, column: 18 }, end: { line: 199, column: 89 } }, type: 'cond-expr', locations: [{ start: { line: 199, column: 49 }, end: { line: 199, column: 60 } }, { start: { line: 199, column: 63 }, end: { line: 199, column: 89 } }], line: 199 }, '48': { loc: { start: { line: 222, column: 10 }, end: { line: 224, column: 11 } }, type: 'if', locations: [{ start: { line: 222, column: 10 }, end: { line: 224, column: 11 } }, { start: { line: 222, column: 10 }, end: { line: 224, column: 11 } }], line: 222 }, '49': { loc: { start: { line: 228, column: 10 }, end: { line: 232, column: 11 } }, type: 'if', locations: [{ start: { line: 228, column: 10 }, end: { line: 232, column: 11 } }, { start: { line: 228, column: 10 }, end: { line: 232, column: 11 } }], line: 228 }, '50': { loc: { start: { line: 230, column: 17 }, end: { line: 232, column: 11 } }, type: 'if', locations: [{ start: { line: 230, column: 17 }, end: { line: 232, column: 11 } }, { start: { line: 230, column: 17 }, end: { line: 232, column: 11 } }], line: 230 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0, '86': 0, '87': 0, '88': 0, '89': 0, '90': 0, '91': 0, '92': 0, '93': 0, '94': 0, '95': 0, '96': 0, '97': 0, '98': 0, '99': 0, '100': 0, '101': 0, '102': 0, '103': 0, '104': 0, '105': 0, '106': 0, '107': 0, '108': 0, '109': 0, '110': 0, '111': 0, '112': 0, '113': 0, '114': 0, '115': 0, '116': 0, '117': 0, '118': 0, '119': 0, '120': 0, '121': 0, '122': 0, '123': 0, '124': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0], '20': [0, 0], '21': [0, 0], '22': [0, 0, 0], '23': [0, 0], '24': [0, 0], '25': [0, 0], '26': [0, 0], '27': [0, 0], '28': [0, 0], '29': [0, 0], '30': [0, 0], '31': [0, 0], '32': [0, 0], '33': [0, 0], '34': [0, 0], '35': [0, 0], '36': [0, 0], '37': [0, 0], '38': [0, 0], '39': [0, 0], '40': [0, 0], '41': [0, 0], '42': [0, 0], '43': [0, 0], '44': [0, 0], '45': [0, 0], '46': [0, 0], '47': [0, 0], '48': [0, 0], '49': [0, 0], '50': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3375 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3376 return coverage[path];
3377 }coverageData.hash = hash;return coverage[path] = coverageData;
3378}();var isArray$3 = (cov_1ac9yxw2a1.s[0]++, typeof Array.isArray === 'function' ? (cov_1ac9yxw2a1.b[0][0]++, Array.isArray) : (cov_1ac9yxw2a1.b[0][1]++, function (a) {
3379 cov_1ac9yxw2a1.f[0]++;cov_1ac9yxw2a1.s[1]++;return a instanceof Array;
3380}));var getObjectKeys = (cov_1ac9yxw2a1.s[2]++, typeof Object.keys === 'function' ? (cov_1ac9yxw2a1.b[1][0]++, function (obj) {
3381 cov_1ac9yxw2a1.f[1]++;cov_1ac9yxw2a1.s[3]++;return Object.keys(obj);
3382}) : (cov_1ac9yxw2a1.b[1][1]++, function (obj) {
3383 cov_1ac9yxw2a1.f[2]++;var names = (cov_1ac9yxw2a1.s[4]++, []);cov_1ac9yxw2a1.s[5]++;for (var property in obj) {
3384 cov_1ac9yxw2a1.s[6]++;if (Object.prototype.hasOwnProperty.call(obj, property)) {
3385 cov_1ac9yxw2a1.b[2][0]++;cov_1ac9yxw2a1.s[7]++;names.push(property);
3386 } else {
3387 cov_1ac9yxw2a1.b[2][1]++;
3388 }
3389 }cov_1ac9yxw2a1.s[8]++;return names;
3390}));cov_1ac9yxw2a1.s[9]++;var trimUnderscore = function trimUnderscore(str) {
3391 cov_1ac9yxw2a1.f[3]++;cov_1ac9yxw2a1.s[10]++;if (str.substr(0, 1) === '_') {
3392 cov_1ac9yxw2a1.b[3][0]++;cov_1ac9yxw2a1.s[11]++;return str.slice(1);
3393 } else {
3394 cov_1ac9yxw2a1.b[3][1]++;
3395 }cov_1ac9yxw2a1.s[12]++;return str;
3396};cov_1ac9yxw2a1.s[13]++;var arrayKeyToSortNumber = function arrayKeyToSortNumber(key) {
3397 cov_1ac9yxw2a1.f[4]++;cov_1ac9yxw2a1.s[14]++;if (key === '_t') {
3398 cov_1ac9yxw2a1.b[4][0]++;cov_1ac9yxw2a1.s[15]++;return -1;
3399 } else {
3400 cov_1ac9yxw2a1.b[4][1]++;cov_1ac9yxw2a1.s[16]++;if (key.substr(0, 1) === '_') {
3401 cov_1ac9yxw2a1.b[5][0]++;cov_1ac9yxw2a1.s[17]++;return parseInt(key.slice(1), 10);
3402 } else {
3403 cov_1ac9yxw2a1.b[5][1]++;cov_1ac9yxw2a1.s[18]++;return parseInt(key, 10) + 0.1;
3404 }
3405 }
3406};cov_1ac9yxw2a1.s[19]++;var arrayKeyComparer = function arrayKeyComparer(key1, key2) {
3407 cov_1ac9yxw2a1.f[5]++;cov_1ac9yxw2a1.s[20]++;return arrayKeyToSortNumber(key1) - arrayKeyToSortNumber(key2);
3408};var BaseFormatter = (cov_1ac9yxw2a1.s[21]++, function () {
3409 cov_1ac9yxw2a1.f[6]++;function BaseFormatter() {
3410 cov_1ac9yxw2a1.f[7]++;cov_1ac9yxw2a1.s[22]++;classCallCheck$1(this, BaseFormatter);
3411 }cov_1ac9yxw2a1.s[23]++;createClass$1(BaseFormatter, [{ key: 'format', value: function format(delta, left) {
3412 cov_1ac9yxw2a1.f[8]++;var context = (cov_1ac9yxw2a1.s[24]++, {});cov_1ac9yxw2a1.s[25]++;this.prepareContext(context);cov_1ac9yxw2a1.s[26]++;this.recurse(context, delta, left);cov_1ac9yxw2a1.s[27]++;return this.finalize(context);
3413 } }, { key: 'prepareContext', value: function prepareContext(context) {
3414 cov_1ac9yxw2a1.f[9]++;cov_1ac9yxw2a1.s[28]++;context.buffer = [];cov_1ac9yxw2a1.s[29]++;context.out = function () {
3415 cov_1ac9yxw2a1.f[10]++;var _buffer;cov_1ac9yxw2a1.s[30]++;(_buffer = this.buffer).push.apply(_buffer, arguments);
3416 };
3417 } }, { key: 'typeFormattterNotFound', value: function typeFormattterNotFound(context, deltaType) {
3418 cov_1ac9yxw2a1.f[11]++;cov_1ac9yxw2a1.s[31]++;throw new Error('cannot format delta type: ' + deltaType);
3419 } }, { key: 'typeFormattterErrorFormatter', value: function typeFormattterErrorFormatter(context, err) {
3420 cov_1ac9yxw2a1.f[12]++;cov_1ac9yxw2a1.s[32]++;return err.toString();
3421 } }, { key: 'finalize', value: function finalize(_ref) {
3422 cov_1ac9yxw2a1.f[13]++;var buffer = (cov_1ac9yxw2a1.s[33]++, _ref.buffer);cov_1ac9yxw2a1.s[34]++;if (isArray$3(buffer)) {
3423 cov_1ac9yxw2a1.b[6][0]++;cov_1ac9yxw2a1.s[35]++;return buffer.join('');
3424 } else {
3425 cov_1ac9yxw2a1.b[6][1]++;
3426 }
3427 } }, { key: 'recurse', value: function recurse(context, delta, left, key, leftKey, movedFrom, isLast) {
3428 cov_1ac9yxw2a1.f[14]++;var useMoveOriginHere = (cov_1ac9yxw2a1.s[36]++, (cov_1ac9yxw2a1.b[7][0]++, delta) && (cov_1ac9yxw2a1.b[7][1]++, movedFrom));var leftValue = (cov_1ac9yxw2a1.s[37]++, useMoveOriginHere ? (cov_1ac9yxw2a1.b[8][0]++, movedFrom.value) : (cov_1ac9yxw2a1.b[8][1]++, left));cov_1ac9yxw2a1.s[38]++;if ((cov_1ac9yxw2a1.b[10][0]++, typeof delta === 'undefined') && (cov_1ac9yxw2a1.b[10][1]++, typeof key === 'undefined')) {
3429 cov_1ac9yxw2a1.b[9][0]++;cov_1ac9yxw2a1.s[39]++;return undefined;
3430 } else {
3431 cov_1ac9yxw2a1.b[9][1]++;
3432 }var type = (cov_1ac9yxw2a1.s[40]++, this.getDeltaType(delta, movedFrom));var nodeType = (cov_1ac9yxw2a1.s[41]++, type === 'node' ? (cov_1ac9yxw2a1.b[11][0]++, delta._t === 'a' ? (cov_1ac9yxw2a1.b[12][0]++, 'array') : (cov_1ac9yxw2a1.b[12][1]++, 'object')) : (cov_1ac9yxw2a1.b[11][1]++, ''));cov_1ac9yxw2a1.s[42]++;if (typeof key !== 'undefined') {
3433 cov_1ac9yxw2a1.b[13][0]++;cov_1ac9yxw2a1.s[43]++;this.nodeBegin(context, key, leftKey, type, nodeType, isLast);
3434 } else {
3435 cov_1ac9yxw2a1.b[13][1]++;cov_1ac9yxw2a1.s[44]++;this.rootBegin(context, type, nodeType);
3436 }var typeFormattter = (cov_1ac9yxw2a1.s[45]++, void 0);cov_1ac9yxw2a1.s[46]++;try {
3437 cov_1ac9yxw2a1.s[47]++;typeFormattter = (cov_1ac9yxw2a1.b[14][0]++, this['format_' + type]) || (cov_1ac9yxw2a1.b[14][1]++, this.typeFormattterNotFound(context, type));cov_1ac9yxw2a1.s[48]++;typeFormattter.call(this, context, delta, leftValue, key, leftKey, movedFrom);
3438 } catch (err) {
3439 cov_1ac9yxw2a1.s[49]++;this.typeFormattterErrorFormatter(context, err, delta, leftValue, key, leftKey, movedFrom);cov_1ac9yxw2a1.s[50]++;if ((cov_1ac9yxw2a1.b[16][0]++, typeof console !== 'undefined') && (cov_1ac9yxw2a1.b[16][1]++, console.error)) {
3440 cov_1ac9yxw2a1.b[15][0]++;cov_1ac9yxw2a1.s[51]++;console.error(err.stack);
3441 } else {
3442 cov_1ac9yxw2a1.b[15][1]++;
3443 }
3444 }cov_1ac9yxw2a1.s[52]++;if (typeof key !== 'undefined') {
3445 cov_1ac9yxw2a1.b[17][0]++;cov_1ac9yxw2a1.s[53]++;this.nodeEnd(context, key, leftKey, type, nodeType, isLast);
3446 } else {
3447 cov_1ac9yxw2a1.b[17][1]++;cov_1ac9yxw2a1.s[54]++;this.rootEnd(context, type, nodeType);
3448 }
3449 } }, { key: 'formatDeltaChildren', value: function formatDeltaChildren(context, delta, left) {
3450 cov_1ac9yxw2a1.f[15]++;var self = (cov_1ac9yxw2a1.s[55]++, this);cov_1ac9yxw2a1.s[56]++;this.forEachDeltaKey(delta, left, function (key, leftKey, movedFrom, isLast) {
3451 cov_1ac9yxw2a1.f[16]++;cov_1ac9yxw2a1.s[57]++;self.recurse(context, delta[key], left ? (cov_1ac9yxw2a1.b[18][0]++, left[leftKey]) : (cov_1ac9yxw2a1.b[18][1]++, undefined), key, leftKey, movedFrom, isLast);
3452 });
3453 } }, { key: 'forEachDeltaKey', value: function forEachDeltaKey(delta, left, fn) {
3454 cov_1ac9yxw2a1.f[17]++;var keys = (cov_1ac9yxw2a1.s[58]++, getObjectKeys(delta));var arrayKeys = (cov_1ac9yxw2a1.s[59]++, delta._t === 'a');var moveDestinations = (cov_1ac9yxw2a1.s[60]++, {});var name = (cov_1ac9yxw2a1.s[61]++, void 0);cov_1ac9yxw2a1.s[62]++;if (typeof left !== 'undefined') {
3455 cov_1ac9yxw2a1.b[19][0]++;cov_1ac9yxw2a1.s[63]++;for (name in left) {
3456 cov_1ac9yxw2a1.s[64]++;if (Object.prototype.hasOwnProperty.call(left, name)) {
3457 cov_1ac9yxw2a1.b[20][0]++;cov_1ac9yxw2a1.s[65]++;if ((cov_1ac9yxw2a1.b[22][0]++, typeof delta[name] === 'undefined') && ((cov_1ac9yxw2a1.b[22][1]++, !arrayKeys) || (cov_1ac9yxw2a1.b[22][2]++, typeof delta['_' + name] === 'undefined'))) {
3458 cov_1ac9yxw2a1.b[21][0]++;cov_1ac9yxw2a1.s[66]++;keys.push(name);
3459 } else {
3460 cov_1ac9yxw2a1.b[21][1]++;
3461 }
3462 } else {
3463 cov_1ac9yxw2a1.b[20][1]++;
3464 }
3465 }
3466 } else {
3467 cov_1ac9yxw2a1.b[19][1]++;
3468 } // look for move destinations
3469 cov_1ac9yxw2a1.s[67]++;for (name in delta) {
3470 cov_1ac9yxw2a1.s[68]++;if (Object.prototype.hasOwnProperty.call(delta, name)) {
3471 cov_1ac9yxw2a1.b[23][0]++;var value = (cov_1ac9yxw2a1.s[69]++, delta[name]);cov_1ac9yxw2a1.s[70]++;if ((cov_1ac9yxw2a1.b[25][0]++, isArray$3(value)) && (cov_1ac9yxw2a1.b[25][1]++, value[2] === 3)) {
3472 cov_1ac9yxw2a1.b[24][0]++;cov_1ac9yxw2a1.s[71]++;moveDestinations[value[1].toString()] = { key: name, value: (cov_1ac9yxw2a1.b[26][0]++, left) && (cov_1ac9yxw2a1.b[26][1]++, left[parseInt(name.substr(1))]) };cov_1ac9yxw2a1.s[72]++;if (this.includeMoveDestinations !== false) {
3473 cov_1ac9yxw2a1.b[27][0]++;cov_1ac9yxw2a1.s[73]++;if ((cov_1ac9yxw2a1.b[29][0]++, typeof left === 'undefined') && (cov_1ac9yxw2a1.b[29][1]++, typeof delta[value[1]] === 'undefined')) {
3474 cov_1ac9yxw2a1.b[28][0]++;cov_1ac9yxw2a1.s[74]++;keys.push(value[1].toString());
3475 } else {
3476 cov_1ac9yxw2a1.b[28][1]++;
3477 }
3478 } else {
3479 cov_1ac9yxw2a1.b[27][1]++;
3480 }
3481 } else {
3482 cov_1ac9yxw2a1.b[24][1]++;
3483 }
3484 } else {
3485 cov_1ac9yxw2a1.b[23][1]++;
3486 }
3487 }cov_1ac9yxw2a1.s[75]++;if (arrayKeys) {
3488 cov_1ac9yxw2a1.b[30][0]++;cov_1ac9yxw2a1.s[76]++;keys.sort(arrayKeyComparer);
3489 } else {
3490 cov_1ac9yxw2a1.b[30][1]++;cov_1ac9yxw2a1.s[77]++;keys.sort();
3491 }cov_1ac9yxw2a1.s[78]++;for (var index = 0, length = keys.length; index < length; index++) {
3492 var key = (cov_1ac9yxw2a1.s[79]++, keys[index]);cov_1ac9yxw2a1.s[80]++;if ((cov_1ac9yxw2a1.b[32][0]++, arrayKeys) && (cov_1ac9yxw2a1.b[32][1]++, key === '_t')) {
3493 cov_1ac9yxw2a1.b[31][0]++;cov_1ac9yxw2a1.s[81]++;continue;
3494 } else {
3495 cov_1ac9yxw2a1.b[31][1]++;
3496 }var leftKey = (cov_1ac9yxw2a1.s[82]++, arrayKeys ? (cov_1ac9yxw2a1.b[33][0]++, typeof key === 'number' ? (cov_1ac9yxw2a1.b[34][0]++, key) : (cov_1ac9yxw2a1.b[34][1]++, parseInt(trimUnderscore(key), 10))) : (cov_1ac9yxw2a1.b[33][1]++, key));var isLast = (cov_1ac9yxw2a1.s[83]++, index === length - 1);cov_1ac9yxw2a1.s[84]++;fn(key, leftKey, moveDestinations[leftKey], isLast);
3497 }
3498 } }, { key: 'getDeltaType', value: function getDeltaType(delta, movedFrom) {
3499 cov_1ac9yxw2a1.f[18]++;cov_1ac9yxw2a1.s[85]++;if (typeof delta === 'undefined') {
3500 cov_1ac9yxw2a1.b[35][0]++;cov_1ac9yxw2a1.s[86]++;if (typeof movedFrom !== 'undefined') {
3501 cov_1ac9yxw2a1.b[36][0]++;cov_1ac9yxw2a1.s[87]++;return 'movedestination';
3502 } else {
3503 cov_1ac9yxw2a1.b[36][1]++;
3504 }cov_1ac9yxw2a1.s[88]++;return 'unchanged';
3505 } else {
3506 cov_1ac9yxw2a1.b[35][1]++;
3507 }cov_1ac9yxw2a1.s[89]++;if (isArray$3(delta)) {
3508 cov_1ac9yxw2a1.b[37][0]++;cov_1ac9yxw2a1.s[90]++;if (delta.length === 1) {
3509 cov_1ac9yxw2a1.b[38][0]++;cov_1ac9yxw2a1.s[91]++;return 'added';
3510 } else {
3511 cov_1ac9yxw2a1.b[38][1]++;
3512 }cov_1ac9yxw2a1.s[92]++;if (delta.length === 2) {
3513 cov_1ac9yxw2a1.b[39][0]++;cov_1ac9yxw2a1.s[93]++;return 'modified';
3514 } else {
3515 cov_1ac9yxw2a1.b[39][1]++;
3516 }cov_1ac9yxw2a1.s[94]++;if ((cov_1ac9yxw2a1.b[41][0]++, delta.length === 3) && (cov_1ac9yxw2a1.b[41][1]++, delta[2] === 0)) {
3517 cov_1ac9yxw2a1.b[40][0]++;cov_1ac9yxw2a1.s[95]++;return 'deleted';
3518 } else {
3519 cov_1ac9yxw2a1.b[40][1]++;
3520 }cov_1ac9yxw2a1.s[96]++;if ((cov_1ac9yxw2a1.b[43][0]++, delta.length === 3) && (cov_1ac9yxw2a1.b[43][1]++, delta[2] === 2)) {
3521 cov_1ac9yxw2a1.b[42][0]++;cov_1ac9yxw2a1.s[97]++;return 'textdiff';
3522 } else {
3523 cov_1ac9yxw2a1.b[42][1]++;
3524 }cov_1ac9yxw2a1.s[98]++;if ((cov_1ac9yxw2a1.b[45][0]++, delta.length === 3) && (cov_1ac9yxw2a1.b[45][1]++, delta[2] === 3)) {
3525 cov_1ac9yxw2a1.b[44][0]++;cov_1ac9yxw2a1.s[99]++;return 'moved';
3526 } else {
3527 cov_1ac9yxw2a1.b[44][1]++;
3528 }
3529 } else {
3530 cov_1ac9yxw2a1.b[37][1]++;cov_1ac9yxw2a1.s[100]++;if ((typeof delta === 'undefined' ? (cov_1ac9yxw2a1.b[47][0]++, 'undefined') : (cov_1ac9yxw2a1.b[47][1]++, _typeof$1(delta))) === 'object') {
3531 cov_1ac9yxw2a1.b[46][0]++;cov_1ac9yxw2a1.s[101]++;return 'node';
3532 } else {
3533 cov_1ac9yxw2a1.b[46][1]++;
3534 }
3535 }cov_1ac9yxw2a1.s[102]++;return 'unknown';
3536 } }, { key: 'parseTextDiff', value: function parseTextDiff(value) {
3537 cov_1ac9yxw2a1.f[19]++;var output = (cov_1ac9yxw2a1.s[103]++, []);var lines = (cov_1ac9yxw2a1.s[104]++, value.split('\n@@ '));cov_1ac9yxw2a1.s[105]++;for (var i = 0, l = lines.length; i < l; i++) {
3538 var line = (cov_1ac9yxw2a1.s[106]++, lines[i]);var lineOutput = (cov_1ac9yxw2a1.s[107]++, { pieces: [] });var location = (cov_1ac9yxw2a1.s[108]++, /^(?:@@ )?[-+]?(\d+),(\d+)/.exec(line).slice(1));cov_1ac9yxw2a1.s[109]++;lineOutput.location = { line: location[0], chr: location[1] };var pieces = (cov_1ac9yxw2a1.s[110]++, line.split('\n').slice(1));cov_1ac9yxw2a1.s[111]++;for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
3539 var piece = (cov_1ac9yxw2a1.s[112]++, pieces[pieceIndex]);cov_1ac9yxw2a1.s[113]++;if (!piece.length) {
3540 cov_1ac9yxw2a1.b[48][0]++;cov_1ac9yxw2a1.s[114]++;continue;
3541 } else {
3542 cov_1ac9yxw2a1.b[48][1]++;
3543 }var pieceOutput = (cov_1ac9yxw2a1.s[115]++, { type: 'context' });cov_1ac9yxw2a1.s[116]++;if (piece.substr(0, 1) === '+') {
3544 cov_1ac9yxw2a1.b[49][0]++;cov_1ac9yxw2a1.s[117]++;pieceOutput.type = 'added';
3545 } else {
3546 cov_1ac9yxw2a1.b[49][1]++;cov_1ac9yxw2a1.s[118]++;if (piece.substr(0, 1) === '-') {
3547 cov_1ac9yxw2a1.b[50][0]++;cov_1ac9yxw2a1.s[119]++;pieceOutput.type = 'deleted';
3548 } else {
3549 cov_1ac9yxw2a1.b[50][1]++;
3550 }
3551 }cov_1ac9yxw2a1.s[120]++;pieceOutput.text = piece.slice(1);cov_1ac9yxw2a1.s[121]++;lineOutput.pieces.push(pieceOutput);
3552 }cov_1ac9yxw2a1.s[122]++;output.push(lineOutput);
3553 }cov_1ac9yxw2a1.s[123]++;return output;
3554 } }]);cov_1ac9yxw2a1.s[124]++;return BaseFormatter;
3555}());
3556
3557var base = Object.freeze({
3558 default: BaseFormatter
3559});
3560
3561var cov_273kjaqpct = function () {
3562 var path = '/Users/benja/proj/jsondiffpatch/src/formatters/html.js',
3563 hash = '63dce5e0e502012449d5dd59da2c9dad1f59955d',
3564 global = new Function('return this')(),
3565 gcv = '__coverage__',
3566 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/formatters/html.js', statementMap: { '0': { start: { line: 3, column: 20 }, end: { line: 139, column: 16 } }, '1': { start: { line: 4, column: 2 }, end: { line: 4, column: 55 } }, '2': { start: { line: 7, column: 4 }, end: { line: 7, column: 53 } }, '3': { start: { line: 8, column: 4 }, end: { line: 8, column: 146 } }, '4': { start: { line: 11, column: 2 }, end: { line: 137, column: 6 } }, '5': { start: { line: 14, column: 6 }, end: { line: 14, column: 72 } }, '6': { start: { line: 19, column: 6 }, end: { line: 19, column: 83 } }, '7': { start: { line: 24, column: 18 }, end: { line: 24, column: 43 } }, '8': { start: { line: 25, column: 6 }, end: { line: 25, column: 57 } }, '9': { start: { line: 26, column: 6 }, end: { line: 36, column: 7 } }, '10': { start: { line: 27, column: 19 }, end: { line: 27, column: 27 } }, '11': { start: { line: 28, column: 8 }, end: { line: 28, column: 283 } }, '12': { start: { line: 29, column: 21 }, end: { line: 29, column: 32 } }, '13': { start: { line: 30, column: 8 }, end: { line: 34, column: 9 } }, '14': { start: { line: 32, column: 22 }, end: { line: 32, column: 40 } }, '15': { start: { line: 33, column: 10 }, end: { line: 33, column: 130 } }, '16': { start: { line: 35, column: 8 }, end: { line: 35, column: 35 } }, '17': { start: { line: 37, column: 6 }, end: { line: 37, column: 27 } }, '18': { start: { line: 42, column: 22 }, end: { line: 42, column: 110 } }, '19': { start: { line: 43, column: 6 }, end: { line: 43, column: 73 } }, '20': { start: { line: 48, column: 6 }, end: { line: 48, column: 149 } }, '21': { start: { line: 53, column: 22 }, end: { line: 53, column: 110 } }, '22': { start: { line: 54, column: 6 }, end: { line: 54, column: 148 } }, '23': { start: { line: 59, column: 6 }, end: { line: 59, column: 27 } }, '24': { start: { line: 68, column: 6 }, end: { line: 70, column: 7 } }, '25': { start: { line: 69, column: 8 }, end: { line: 69, column: 15 } }, '26': { start: { line: 71, column: 6 }, end: { line: 71, column: 55 } }, '27': { start: { line: 72, column: 6 }, end: { line: 72, column: 38 } }, '28': { start: { line: 73, column: 6 }, end: { line: 73, column: 28 } }, '29': { start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }, '30': { start: { line: 79, column: 8 }, end: { line: 79, column: 15 } }, '31': { start: { line: 81, column: 6 }, end: { line: 81, column: 55 } }, '32': { start: { line: 82, column: 6 }, end: { line: 82, column: 38 } }, '33': { start: { line: 83, column: 6 }, end: { line: 83, column: 28 } }, '34': { start: { line: 89, column: 21 }, end: { line: 89, column: 58 } }, '35': { start: { line: 90, column: 6 }, end: { line: 90, column: 94 } }, '36': { start: { line: 91, column: 6 }, end: { line: 91, column: 53 } }, '37': { start: { line: 92, column: 6 }, end: { line: 92, column: 27 } }, '38': { start: { line: 97, column: 6 }, end: { line: 97, column: 55 } }, '39': { start: { line: 98, column: 6 }, end: { line: 98, column: 42 } }, '40': { start: { line: 99, column: 6 }, end: { line: 99, column: 28 } }, '41': { start: { line: 104, column: 6 }, end: { line: 104, column: 80 } }, '42': { start: { line: 105, column: 6 }, end: { line: 105, column: 42 } }, '43': { start: { line: 106, column: 6 }, end: { line: 106, column: 92 } }, '44': { start: { line: 107, column: 6 }, end: { line: 107, column: 42 } }, '45': { start: { line: 108, column: 6 }, end: { line: 108, column: 28 } }, '46': { start: { line: 113, column: 6 }, end: { line: 113, column: 55 } }, '47': { start: { line: 114, column: 6 }, end: { line: 114, column: 42 } }, '48': { start: { line: 115, column: 6 }, end: { line: 115, column: 28 } }, '49': { start: { line: 120, column: 6 }, end: { line: 120, column: 55 } }, '50': { start: { line: 121, column: 6 }, end: { line: 121, column: 42 } }, '51': { start: { line: 122, column: 6 }, end: { line: 122, column: 95 } }, '52': { start: { line: 125, column: 6 }, end: { line: 127, column: 702 } }, '53': { start: { line: 128, column: 6 }, end: { line: 128, column: 31 } }, '54': { start: { line: 133, column: 6 }, end: { line: 133, column: 55 } }, '55': { start: { line: 134, column: 6 }, end: { line: 134, column: 51 } }, '56': { start: { line: 135, column: 6 }, end: { line: 135, column: 28 } }, '57': { start: { line: 138, column: 2 }, end: { line: 138, column: 23 } }, '58': { start: { line: 142, column: 13 }, end: { line: 142, column: 17 } }, '59': { start: { line: 143, column: 21 }, end: { line: 143, column: 106 } }, '60': { start: { line: 144, column: 2 }, end: { line: 146, column: 3 } }, '61': { start: { line: 145, column: 4 }, end: { line: 145, column: 64 } }, '62': { start: { line: 147, column: 2 }, end: { line: 147, column: 14 } }, '63': { start: { line: 150, column: 19 }, end: { line: 199, column: 1 } }, '64': { start: { line: 151, column: 13 }, end: { line: 151, column: 32 } }, '65': { start: { line: 152, column: 23 }, end: { line: 156, column: 3 } }, '66': { start: { line: 153, column: 22 }, end: { line: 153, column: 38 } }, '67': { start: { line: 154, column: 20 }, end: { line: 154, column: 34 } }, '68': { start: { line: 155, column: 4 }, end: { line: 155, column: 36 } }, '69': { start: { line: 157, column: 20 }, end: { line: 162, column: 3 } }, '70': { start: { line: 158, column: 16 }, end: { line: 158, column: 42 } }, '71': { start: { line: 159, column: 4 }, end: { line: 161, column: 5 } }, '72': { start: { line: 160, column: 6 }, end: { line: 160, column: 19 } }, '73': { start: { line: 163, column: 21 }, end: { line: 169, column: 3 } }, '74': { start: { line: 164, column: 19 }, end: { line: 164, column: 33 } }, '75': { start: { line: 166, column: 4 }, end: { line: 168, column: 5 } }, '76': { start: { line: 167, column: 6 }, end: { line: 167, column: 25 } }, '77': { start: { line: 170, column: 2 }, end: { line: 198, column: 5 } }, '78': { start: { line: 171, column: 21 }, end: { line: 171, column: 37 } }, '79': { start: { line: 172, column: 19 }, end: { line: 172, column: 33 } }, '80': { start: { line: 173, column: 16 }, end: { line: 173, column: 27 } }, '81': { start: { line: 175, column: 22 }, end: { line: 175, column: 32 } }, '82': { start: { line: 176, column: 14 }, end: { line: 176, column: 25 } }, '83': { start: { line: 177, column: 15 }, end: { line: 177, column: 30 } }, '84': { start: { line: 178, column: 4 }, end: { line: 178, column: 31 } }, '85': { start: { line: 179, column: 22 }, end: { line: 179, column: 99 } }, '86': { start: { line: 180, column: 20 }, end: { line: 180, column: 42 } }, '87': { start: { line: 181, column: 26 }, end: { line: 181, column: 32 } }, '88': { start: { line: 182, column: 4 }, end: { line: 186, column: 7 } }, '89': { start: { line: 183, column: 6 }, end: { line: 185, column: 7 } }, '90': { start: { line: 184, column: 8 }, end: { line: 184, column: 32 } }, '91': { start: { line: 187, column: 4 }, end: { line: 189, column: 5 } }, '92': { start: { line: 188, column: 6 }, end: { line: 188, column: 13 } }, '93': { start: { line: 190, column: 4 }, end: { line: 197, column: 20 } }, '94': { start: { line: 191, column: 21 }, end: { line: 191, column: 70 } }, '95': { start: { line: 192, column: 6 }, end: { line: 192, column: 57 } }, '96': { start: { line: 193, column: 6 }, end: { line: 193, column: 60 } }, '97': { start: { line: 194, column: 18 }, end: { line: 194, column: 169 } }, '98': { start: { line: 195, column: 6 }, end: { line: 195, column: 36 } }, '99': { start: { line: 196, column: 6 }, end: { line: 196, column: 29 } }, '100': { start: { line: 204, column: 27 }, end: { line: 256, column: 1 } }, '101': { start: { line: 205, column: 11 }, end: { line: 205, column: 32 } }, '102': { start: { line: 206, column: 15 }, end: { line: 206, column: 41 } }, '103': { start: { line: 207, column: 16 }, end: { line: 212, column: 3 } }, '104': { start: { line: 213, column: 13 }, end: { line: 213, column: 25 } }, '105': { start: { line: 214, column: 2 }, end: { line: 216, column: 3 } }, '106': { start: { line: 215, column: 4 }, end: { line: 215, column: 11 } }, '107': { start: { line: 217, column: 2 }, end: { line: 226, column: 3 } }, '108': { start: { line: 218, column: 4 }, end: { line: 218, column: 33 } }, '109': { start: { line: 219, column: 4 }, end: { line: 219, column: 32 } }, '110': { start: { line: 220, column: 4 }, end: { line: 220, column: 33 } }, '111': { start: { line: 221, column: 4 }, end: { line: 221, column: 32 } }, '112': { start: { line: 222, column: 4 }, end: { line: 224, column: 5 } }, '113': { start: { line: 223, column: 6 }, end: { line: 223, column: 31 } }, '114': { start: { line: 225, column: 4 }, end: { line: 225, column: 11 } }, '115': { start: { line: 227, column: 2 }, end: { line: 237, column: 3 } }, '116': { start: { line: 228, column: 4 }, end: { line: 228, column: 33 } }, '117': { start: { line: 229, column: 4 }, end: { line: 229, column: 30 } }, '118': { start: { line: 230, column: 4 }, end: { line: 232, column: 11 } }, '119': { start: { line: 231, column: 6 }, end: { line: 231, column: 31 } }, '120': { start: { line: 234, column: 4 }, end: { line: 234, column: 32 } }, '121': { start: { line: 235, column: 4 }, end: { line: 235, column: 30 } }, '122': { start: { line: 236, column: 4 }, end: { line: 236, column: 32 } }, '123': { start: { line: 238, column: 19 }, end: { line: 240, column: 9 } }, '124': { start: { line: 239, column: 4 }, end: { line: 239, column: 21 } }, '125': { start: { line: 241, column: 2 }, end: { line: 255, column: 12 } }, '126': { start: { line: 242, column: 4 }, end: { line: 242, column: 33 } }, '127': { start: { line: 243, column: 4 }, end: { line: 243, column: 32 } }, '128': { start: { line: 244, column: 4 }, end: { line: 250, column: 5 } }, '129': { start: { line: 245, column: 6 }, end: { line: 245, column: 31 } }, '130': { start: { line: 246, column: 6 }, end: { line: 246, column: 35 } }, '131': { start: { line: 248, column: 6 }, end: { line: 248, column: 32 } }, '132': { start: { line: 249, column: 6 }, end: { line: 249, column: 34 } }, '133': { start: { line: 251, column: 4 }, end: { line: 254, column: 20 } }, '134': { start: { line: 252, column: 6 }, end: { line: 252, column: 35 } }, '135': { start: { line: 253, column: 6 }, end: { line: 253, column: 32 } }, '136': { start: { line: 258, column: 27 }, end: { line: 260, column: 1 } }, '137': { start: { line: 259, column: 2 }, end: { line: 259, column: 43 } }, '138': { start: { line: 264, column: 22 }, end: { line: 264, column: 28 } }, '139': { start: { line: 267, column: 2 }, end: { line: 269, column: 3 } }, '140': { start: { line: 268, column: 4 }, end: { line: 268, column: 42 } }, '141': { start: { line: 270, column: 2 }, end: { line: 270, column: 45 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 3, column: 20 }, end: { line: 3, column: 21 } }, loc: { start: { line: 3, column: 46 }, end: { line: 139, column: 1 } }, line: 3 }, '1': { name: 'HtmlFormatter', decl: { start: { line: 6, column: 11 }, end: { line: 6, column: 24 } }, loc: { start: { line: 6, column: 27 }, end: { line: 9, column: 3 } }, line: 6 }, '2': { name: 'typeFormattterErrorFormatter', decl: { start: { line: 13, column: 20 }, end: { line: 13, column: 48 } }, loc: { start: { line: 13, column: 63 }, end: { line: 15, column: 5 } }, line: 13 }, '3': { name: 'formatValue', decl: { start: { line: 18, column: 20 }, end: { line: 18, column: 31 } }, loc: { start: { line: 18, column: 48 }, end: { line: 20, column: 5 } }, line: 18 }, '4': { name: 'formatTextDiffString', decl: { start: { line: 23, column: 20 }, end: { line: 23, column: 40 } }, loc: { start: { line: 23, column: 57 }, end: { line: 38, column: 5 } }, line: 23 }, '5': { name: 'rootBegin', decl: { start: { line: 41, column: 20 }, end: { line: 41, column: 29 } }, loc: { start: { line: 41, column: 55 }, end: { line: 44, column: 5 } }, line: 41 }, '6': { name: 'rootEnd', decl: { start: { line: 47, column: 20 }, end: { line: 47, column: 27 } }, loc: { start: { line: 47, column: 37 }, end: { line: 49, column: 5 } }, line: 47 }, '7': { name: 'nodeBegin', decl: { start: { line: 52, column: 20 }, end: { line: 52, column: 29 } }, loc: { start: { line: 52, column: 69 }, end: { line: 55, column: 5 } }, line: 52 }, '8': { name: 'nodeEnd', decl: { start: { line: 58, column: 20 }, end: { line: 58, column: 27 } }, loc: { start: { line: 58, column: 37 }, end: { line: 60, column: 5 } }, line: 58 }, '9': { name: 'format_unchanged', decl: { start: { line: 67, column: 20 }, end: { line: 67, column: 36 } }, loc: { start: { line: 67, column: 59 }, end: { line: 74, column: 5 } }, line: 67 }, '10': { name: 'format_movedestination', decl: { start: { line: 77, column: 20 }, end: { line: 77, column: 42 } }, loc: { start: { line: 77, column: 65 }, end: { line: 84, column: 5 } }, line: 77 }, '11': { name: 'format_node', decl: { start: { line: 87, column: 20 }, end: { line: 87, column: 31 } }, loc: { start: { line: 87, column: 54 }, end: { line: 93, column: 5 } }, line: 87 }, '12': { name: 'format_added', decl: { start: { line: 96, column: 20 }, end: { line: 96, column: 32 } }, loc: { start: { line: 96, column: 49 }, end: { line: 100, column: 5 } }, line: 96 }, '13': { name: 'format_modified', decl: { start: { line: 103, column: 20 }, end: { line: 103, column: 35 } }, loc: { start: { line: 103, column: 52 }, end: { line: 109, column: 5 } }, line: 103 }, '14': { name: 'format_deleted', decl: { start: { line: 112, column: 20 }, end: { line: 112, column: 34 } }, loc: { start: { line: 112, column: 51 }, end: { line: 116, column: 5 } }, line: 112 }, '15': { name: 'format_moved', decl: { start: { line: 119, column: 20 }, end: { line: 119, column: 32 } }, loc: { start: { line: 119, column: 49 }, end: { line: 129, column: 5 } }, line: 119 }, '16': { name: 'format_textdiff', decl: { start: { line: 132, column: 20 }, end: { line: 132, column: 35 } }, loc: { start: { line: 132, column: 52 }, end: { line: 136, column: 5 } }, line: 132 }, '17': { name: 'htmlEscape', decl: { start: { line: 141, column: 9 }, end: { line: 141, column: 19 } }, loc: { start: { line: 141, column: 26 }, end: { line: 148, column: 1 } }, line: 141 }, '18': { name: 'jsondiffpatchHtmlFormatterAdjustArrows', decl: { start: { line: 150, column: 28 }, end: { line: 150, column: 66 } }, loc: { start: { line: 150, column: 76 }, end: { line: 199, column: 1 } }, line: 150 }, '19': { name: 'getElementText', decl: { start: { line: 152, column: 32 }, end: { line: 152, column: 46 } }, loc: { start: { line: 152, column: 53 }, end: { line: 156, column: 3 } }, line: 152 }, '20': { name: 'eachByQuery', decl: { start: { line: 157, column: 29 }, end: { line: 157, column: 40 } }, loc: { start: { line: 157, column: 56 }, end: { line: 162, column: 3 } }, line: 157 }, '21': { name: 'eachChildren', decl: { start: { line: 163, column: 30 }, end: { line: 163, column: 42 } }, loc: { start: { line: 163, column: 54 }, end: { line: 169, column: 3 } }, line: 163 }, '22': { name: '(anonymous_22)', decl: { start: { line: 170, column: 44 }, end: { line: 170, column: 45 } }, loc: { start: { line: 170, column: 61 }, end: { line: 198, column: 3 } }, line: 170 }, '23': { name: '(anonymous_23)', decl: { start: { line: 182, column: 28 }, end: { line: 182, column: 29 } }, loc: { start: { line: 182, column: 45 }, end: { line: 186, column: 5 } }, line: 182 }, '24': { name: 'showUnchanged', decl: { start: { line: 204, column: 36 }, end: { line: 204, column: 49 } }, loc: { start: { line: 204, column: 69 }, end: { line: 256, column: 1 } }, line: 204 }, '25': { name: '(anonymous_25)', decl: { start: { line: 230, column: 15 }, end: { line: 230, column: 16 } }, loc: { start: { line: 230, column: 27 }, end: { line: 232, column: 5 } }, line: 230 }, '26': { name: '(anonymous_26)', decl: { start: { line: 238, column: 31 }, end: { line: 238, column: 32 } }, loc: { start: { line: 238, column: 43 }, end: { line: 240, column: 3 } }, line: 238 }, '27': { name: '(anonymous_27)', decl: { start: { line: 241, column: 13 }, end: { line: 241, column: 14 } }, loc: { start: { line: 241, column: 25 }, end: { line: 255, column: 3 } }, line: 241 }, '28': { name: '(anonymous_28)', decl: { start: { line: 251, column: 15 }, end: { line: 251, column: 16 } }, loc: { start: { line: 251, column: 27 }, end: { line: 254, column: 5 } }, line: 251 }, '29': { name: 'hideUnchanged', decl: { start: { line: 258, column: 36 }, end: { line: 258, column: 49 } }, loc: { start: { line: 258, column: 63 }, end: { line: 260, column: 1 } }, line: 258 }, '30': { name: 'format', decl: { start: { line: 266, column: 16 }, end: { line: 266, column: 22 } }, loc: { start: { line: 266, column: 36 }, end: { line: 271, column: 1 } }, line: 266 } }, branchMap: { '0': { loc: { start: { line: 8, column: 57 }, end: { line: 8, column: 120 } }, type: 'binary-expr', locations: [{ start: { line: 8, column: 57 }, end: { line: 8, column: 80 } }, { start: { line: 8, column: 84 }, end: { line: 8, column: 120 } }], line: 8 }, '1': { loc: { start: { line: 42, column: 49 }, end: { line: 42, column: 109 } }, type: 'cond-expr', locations: [{ start: { line: 42, column: 60 }, end: { line: 42, column: 104 } }, { start: { line: 42, column: 107 }, end: { line: 42, column: 109 } }], line: 42 }, '2': { loc: { start: { line: 48, column: 30 }, end: { line: 48, column: 146 } }, type: 'cond-expr', locations: [{ start: { line: 48, column: 50 }, end: { line: 48, column: 141 } }, { start: { line: 48, column: 144 }, end: { line: 48, column: 146 } }], line: 48 }, '3': { loc: { start: { line: 53, column: 49 }, end: { line: 53, column: 109 } }, type: 'cond-expr', locations: [{ start: { line: 53, column: 60 }, end: { line: 53, column: 104 } }, { start: { line: 53, column: 107 }, end: { line: 53, column: 109 } }], line: 53 }, '4': { loc: { start: { line: 68, column: 6 }, end: { line: 70, column: 7 } }, type: 'if', locations: [{ start: { line: 68, column: 6 }, end: { line: 70, column: 7 } }, { start: { line: 68, column: 6 }, end: { line: 70, column: 7 } }], line: 68 }, '5': { loc: { start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }, type: 'if', locations: [{ start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }, { start: { line: 78, column: 6 }, end: { line: 80, column: 7 } }], line: 78 }, '6': { loc: { start: { line: 89, column: 21 }, end: { line: 89, column: 58 } }, type: 'cond-expr', locations: [{ start: { line: 89, column: 40 }, end: { line: 89, column: 47 } }, { start: { line: 89, column: 50 }, end: { line: 89, column: 58 } }], line: 89 }, '7': { loc: { start: { line: 151, column: 13 }, end: { line: 151, column: 32 } }, type: 'binary-expr', locations: [{ start: { line: 151, column: 13 }, end: { line: 151, column: 20 } }, { start: { line: 151, column: 24 }, end: { line: 151, column: 32 } }], line: 151 }, '8': { loc: { start: { line: 155, column: 11 }, end: { line: 155, column: 35 } }, type: 'binary-expr', locations: [{ start: { line: 155, column: 11 }, end: { line: 155, column: 22 } }, { start: { line: 155, column: 26 }, end: { line: 155, column: 35 } }], line: 155 }, '9': { loc: { start: { line: 183, column: 6 }, end: { line: 185, column: 7 } }, type: 'if', locations: [{ start: { line: 183, column: 6 }, end: { line: 185, column: 7 } }, { start: { line: 183, column: 6 }, end: { line: 185, column: 7 } }], line: 183 }, '10': { loc: { start: { line: 187, column: 4 }, end: { line: 189, column: 5 } }, type: 'if', locations: [{ start: { line: 187, column: 4 }, end: { line: 189, column: 5 } }, { start: { line: 187, column: 4 }, end: { line: 189, column: 5 } }], line: 187 }, '11': { loc: { start: { line: 193, column: 24 }, end: { line: 193, column: 51 } }, type: 'cond-expr', locations: [{ start: { line: 193, column: 39 }, end: { line: 193, column: 40 } }, { start: { line: 193, column: 43 }, end: { line: 193, column: 51 } }], line: 193 }, '12': { loc: { start: { line: 194, column: 18 }, end: { line: 194, column: 169 } }, type: 'cond-expr', locations: [{ start: { line: 194, column: 33 }, end: { line: 194, column: 99 } }, { start: { line: 194, column: 102 }, end: { line: 194, column: 169 } }], line: 194 }, '13': { loc: { start: { line: 205, column: 11 }, end: { line: 205, column: 32 } }, type: 'binary-expr', locations: [{ start: { line: 205, column: 11 }, end: { line: 205, column: 15 } }, { start: { line: 205, column: 19 }, end: { line: 205, column: 32 } }], line: 205 }, '14': { loc: { start: { line: 214, column: 2 }, end: { line: 216, column: 3 } }, type: 'if', locations: [{ start: { line: 214, column: 2 }, end: { line: 216, column: 3 } }, { start: { line: 214, column: 2 }, end: { line: 216, column: 3 } }], line: 214 }, '15': { loc: { start: { line: 217, column: 2 }, end: { line: 226, column: 3 } }, type: 'if', locations: [{ start: { line: 217, column: 2 }, end: { line: 226, column: 3 } }, { start: { line: 217, column: 2 }, end: { line: 226, column: 3 } }], line: 217 }, '16': { loc: { start: { line: 222, column: 4 }, end: { line: 224, column: 5 } }, type: 'if', locations: [{ start: { line: 222, column: 4 }, end: { line: 224, column: 5 } }, { start: { line: 222, column: 4 }, end: { line: 224, column: 5 } }], line: 222 }, '17': { loc: { start: { line: 227, column: 2 }, end: { line: 237, column: 3 } }, type: 'if', locations: [{ start: { line: 227, column: 2 }, end: { line: 237, column: 3 } }, { start: { line: 227, column: 2 }, end: { line: 237, column: 3 } }], line: 227 }, '18': { loc: { start: { line: 244, column: 4 }, end: { line: 250, column: 5 } }, type: 'if', locations: [{ start: { line: 244, column: 4 }, end: { line: 250, column: 5 } }, { start: { line: 244, column: 4 }, end: { line: 250, column: 5 } }], line: 244 }, '19': { loc: { start: { line: 267, column: 2 }, end: { line: 269, column: 3 } }, type: 'if', locations: [{ start: { line: 267, column: 2 }, end: { line: 269, column: 3 } }, { start: { line: 267, column: 2 }, end: { line: 269, column: 3 } }], line: 267 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0, '86': 0, '87': 0, '88': 0, '89': 0, '90': 0, '91': 0, '92': 0, '93': 0, '94': 0, '95': 0, '96': 0, '97': 0, '98': 0, '99': 0, '100': 0, '101': 0, '102': 0, '103': 0, '104': 0, '105': 0, '106': 0, '107': 0, '108': 0, '109': 0, '110': 0, '111': 0, '112': 0, '113': 0, '114': 0, '115': 0, '116': 0, '117': 0, '118': 0, '119': 0, '120': 0, '121': 0, '122': 0, '123': 0, '124': 0, '125': 0, '126': 0, '127': 0, '128': 0, '129': 0, '130': 0, '131': 0, '132': 0, '133': 0, '134': 0, '135': 0, '136': 0, '137': 0, '138': 0, '139': 0, '140': 0, '141': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3567 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3568 return coverage[path];
3569 }coverageData.hash = hash;return coverage[path] = coverageData;
3570}();var HtmlFormatter = (cov_273kjaqpct.s[0]++, function (_BaseFormatter) {
3571 cov_273kjaqpct.f[0]++;cov_273kjaqpct.s[1]++;inherits$1(HtmlFormatter, _BaseFormatter);function HtmlFormatter() {
3572 cov_273kjaqpct.f[1]++;cov_273kjaqpct.s[2]++;classCallCheck$1(this, HtmlFormatter);cov_273kjaqpct.s[3]++;return possibleConstructorReturn$1(this, ((cov_273kjaqpct.b[0][0]++, HtmlFormatter.__proto__) || (cov_273kjaqpct.b[0][1]++, Object.getPrototypeOf(HtmlFormatter))).apply(this, arguments));
3573 }cov_273kjaqpct.s[4]++;createClass$1(HtmlFormatter, [{ key: 'typeFormattterErrorFormatter', value: function typeFormattterErrorFormatter(context, err) {
3574 cov_273kjaqpct.f[2]++;cov_273kjaqpct.s[5]++;context.out('<pre class="jsondiffpatch-error">' + err + '</pre>');
3575 } }, { key: 'formatValue', value: function formatValue(context, value) {
3576 cov_273kjaqpct.f[3]++;cov_273kjaqpct.s[6]++;context.out('<pre>' + htmlEscape(JSON.stringify(value, null, 2)) + '</pre>');
3577 } }, { key: 'formatTextDiffString', value: function formatTextDiffString(context, value) {
3578 cov_273kjaqpct.f[4]++;var lines = (cov_273kjaqpct.s[7]++, this.parseTextDiff(value));cov_273kjaqpct.s[8]++;context.out('<ul class="jsondiffpatch-textdiff">');cov_273kjaqpct.s[9]++;for (var i = 0, l = lines.length; i < l; i++) {
3579 var line = (cov_273kjaqpct.s[10]++, lines[i]);cov_273kjaqpct.s[11]++;context.out('<li><div class="jsondiffpatch-textdiff-location">' + ('<span class="jsondiffpatch-textdiff-line-number">' + line.location.line + '</span><span class="jsondiffpatch-textdiff-char">' + line.location.chr + '</span></div><div class="jsondiffpatch-textdiff-line">'));var pieces = (cov_273kjaqpct.s[12]++, line.pieces);cov_273kjaqpct.s[13]++;for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
3580 /* global decodeURI */var piece = (cov_273kjaqpct.s[14]++, pieces[pieceIndex]);cov_273kjaqpct.s[15]++;context.out('<span class="jsondiffpatch-textdiff-' + piece.type + '">' + htmlEscape(decodeURI(piece.text)) + '</span>');
3581 }cov_273kjaqpct.s[16]++;context.out('</div></li>');
3582 }cov_273kjaqpct.s[17]++;context.out('</ul>');
3583 } }, { key: 'rootBegin', value: function rootBegin(context, type, nodeType) {
3584 cov_273kjaqpct.f[5]++;var nodeClass = (cov_273kjaqpct.s[18]++, 'jsondiffpatch-' + type + (nodeType ? (cov_273kjaqpct.b[1][0]++, ' jsondiffpatch-child-node-type-' + nodeType) : (cov_273kjaqpct.b[1][1]++, '')));cov_273kjaqpct.s[19]++;context.out('<div class="jsondiffpatch-delta ' + nodeClass + '">');
3585 } }, { key: 'rootEnd', value: function rootEnd(context) {
3586 cov_273kjaqpct.f[6]++;cov_273kjaqpct.s[20]++;context.out('</div>' + (context.hasArrows ? (cov_273kjaqpct.b[2][0]++, '<script type="text/javascript">setTimeout(' + (adjustArrows.toString() + ',10);</script>')) : (cov_273kjaqpct.b[2][1]++, '')));
3587 } }, { key: 'nodeBegin', value: function nodeBegin(context, key, leftKey, type, nodeType) {
3588 cov_273kjaqpct.f[7]++;var nodeClass = (cov_273kjaqpct.s[21]++, 'jsondiffpatch-' + type + (nodeType ? (cov_273kjaqpct.b[3][0]++, ' jsondiffpatch-child-node-type-' + nodeType) : (cov_273kjaqpct.b[3][1]++, '')));cov_273kjaqpct.s[22]++;context.out('<li class="' + nodeClass + '" data-key="' + leftKey + '">' + ('<div class="jsondiffpatch-property-name">' + leftKey + '</div>'));
3589 } }, { key: 'nodeEnd', value: function nodeEnd(context) {
3590 cov_273kjaqpct.f[8]++;cov_273kjaqpct.s[23]++;context.out('</li>');
3591 } /* jshint camelcase: false */ /* eslint-disable camelcase */ }, { key: 'format_unchanged', value: function format_unchanged(context, delta, left) {
3592 cov_273kjaqpct.f[9]++;cov_273kjaqpct.s[24]++;if (typeof left === 'undefined') {
3593 cov_273kjaqpct.b[4][0]++;cov_273kjaqpct.s[25]++;return;
3594 } else {
3595 cov_273kjaqpct.b[4][1]++;
3596 }cov_273kjaqpct.s[26]++;context.out('<div class="jsondiffpatch-value">');cov_273kjaqpct.s[27]++;this.formatValue(context, left);cov_273kjaqpct.s[28]++;context.out('</div>');
3597 } }, { key: 'format_movedestination', value: function format_movedestination(context, delta, left) {
3598 cov_273kjaqpct.f[10]++;cov_273kjaqpct.s[29]++;if (typeof left === 'undefined') {
3599 cov_273kjaqpct.b[5][0]++;cov_273kjaqpct.s[30]++;return;
3600 } else {
3601 cov_273kjaqpct.b[5][1]++;
3602 }cov_273kjaqpct.s[31]++;context.out('<div class="jsondiffpatch-value">');cov_273kjaqpct.s[32]++;this.formatValue(context, left);cov_273kjaqpct.s[33]++;context.out('</div>');
3603 } }, { key: 'format_node', value: function format_node(context, delta, left) {
3604 cov_273kjaqpct.f[11]++; // recurse
3605 var nodeType = (cov_273kjaqpct.s[34]++, delta._t === 'a' ? (cov_273kjaqpct.b[6][0]++, 'array') : (cov_273kjaqpct.b[6][1]++, 'object'));cov_273kjaqpct.s[35]++;context.out('<ul class="jsondiffpatch-node jsondiffpatch-node-type-' + nodeType + '">');cov_273kjaqpct.s[36]++;this.formatDeltaChildren(context, delta, left);cov_273kjaqpct.s[37]++;context.out('</ul>');
3606 } }, { key: 'format_added', value: function format_added(context, delta) {
3607 cov_273kjaqpct.f[12]++;cov_273kjaqpct.s[38]++;context.out('<div class="jsondiffpatch-value">');cov_273kjaqpct.s[39]++;this.formatValue(context, delta[0]);cov_273kjaqpct.s[40]++;context.out('</div>');
3608 } }, { key: 'format_modified', value: function format_modified(context, delta) {
3609 cov_273kjaqpct.f[13]++;cov_273kjaqpct.s[41]++;context.out('<div class="jsondiffpatch-value jsondiffpatch-left-value">');cov_273kjaqpct.s[42]++;this.formatValue(context, delta[0]);cov_273kjaqpct.s[43]++;context.out('</div>' + '<div class="jsondiffpatch-value jsondiffpatch-right-value">');cov_273kjaqpct.s[44]++;this.formatValue(context, delta[1]);cov_273kjaqpct.s[45]++;context.out('</div>');
3610 } }, { key: 'format_deleted', value: function format_deleted(context, delta) {
3611 cov_273kjaqpct.f[14]++;cov_273kjaqpct.s[46]++;context.out('<div class="jsondiffpatch-value">');cov_273kjaqpct.s[47]++;this.formatValue(context, delta[0]);cov_273kjaqpct.s[48]++;context.out('</div>');
3612 } }, { key: 'format_moved', value: function format_moved(context, delta) {
3613 cov_273kjaqpct.f[15]++;cov_273kjaqpct.s[49]++;context.out('<div class="jsondiffpatch-value">');cov_273kjaqpct.s[50]++;this.formatValue(context, delta[0]);cov_273kjaqpct.s[51]++;context.out('</div><div class="jsondiffpatch-moved-destination">' + delta[1] + '</div>'); // draw an SVG arrow from here to move destination
3614 cov_273kjaqpct.s[52]++;context.out( /* jshint multistr: true */'<div class="jsondiffpatch-arrow" ' + 'style="position: relative; left: -34px;">\n <svg width="30" height="60" ' + 'style="position: absolute; display: none;">\n <defs>\n <marker id="markerArrow" markerWidth="8" markerHeight="8"\n refx="2" refy="4"\n orient="auto" markerUnits="userSpaceOnUse">\n <path d="M1,1 L1,7 L7,4 L1,1" style="fill: #339;" />\n </marker>\n </defs>\n <path d="M30,0 Q-10,25 26,50"\n style="stroke: #88f; stroke-width: 2px; fill: none; ' + 'stroke-opacity: 0.5; marker-end: url(#markerArrow);"\n ></path>\n </svg>\n </div>');cov_273kjaqpct.s[53]++;context.hasArrows = true;
3615 } }, { key: 'format_textdiff', value: function format_textdiff(context, delta) {
3616 cov_273kjaqpct.f[16]++;cov_273kjaqpct.s[54]++;context.out('<div class="jsondiffpatch-value">');cov_273kjaqpct.s[55]++;this.formatTextDiffString(context, delta[0]);cov_273kjaqpct.s[56]++;context.out('</div>');
3617 } }]);cov_273kjaqpct.s[57]++;return HtmlFormatter;
3618}(BaseFormatter));function htmlEscape(text) {
3619 cov_273kjaqpct.f[17]++;var html = (cov_273kjaqpct.s[58]++, text);var replacements = (cov_273kjaqpct.s[59]++, [[/&/g, '&amp;'], [/</g, '&lt;'], [/>/g, '&gt;'], [/'/g, '&apos;'], [/"/g, '&quot;']]);cov_273kjaqpct.s[60]++;for (var i = 0; i < replacements.length; i++) {
3620 cov_273kjaqpct.s[61]++;html = html.replace(replacements[i][0], replacements[i][1]);
3621 }cov_273kjaqpct.s[62]++;return html;
3622}cov_273kjaqpct.s[63]++;var adjustArrows = function jsondiffpatchHtmlFormatterAdjustArrows(nodeArg) {
3623 cov_273kjaqpct.f[18]++;var node = (cov_273kjaqpct.s[64]++, (cov_273kjaqpct.b[7][0]++, nodeArg) || (cov_273kjaqpct.b[7][1]++, document));cov_273kjaqpct.s[65]++;var getElementText = function getElementText(_ref) {
3624 cov_273kjaqpct.f[19]++;var textContent = (cov_273kjaqpct.s[66]++, _ref.textContent),
3625 innerText = (cov_273kjaqpct.s[67]++, _ref.innerText);cov_273kjaqpct.s[68]++;return (cov_273kjaqpct.b[8][0]++, textContent) || (cov_273kjaqpct.b[8][1]++, innerText);
3626 };cov_273kjaqpct.s[69]++;var eachByQuery = function eachByQuery(el, query, fn) {
3627 cov_273kjaqpct.f[20]++;var elems = (cov_273kjaqpct.s[70]++, el.querySelectorAll(query));cov_273kjaqpct.s[71]++;for (var i = 0, l = elems.length; i < l; i++) {
3628 cov_273kjaqpct.s[72]++;fn(elems[i]);
3629 }
3630 };cov_273kjaqpct.s[73]++;var eachChildren = function eachChildren(_ref2, fn) {
3631 cov_273kjaqpct.f[21]++;var children = (cov_273kjaqpct.s[74]++, _ref2.children);cov_273kjaqpct.s[75]++;for (var i = 0, l = children.length; i < l; i++) {
3632 cov_273kjaqpct.s[76]++;fn(children[i], i);
3633 }
3634 };cov_273kjaqpct.s[77]++;eachByQuery(node, '.jsondiffpatch-arrow', function (_ref3) {
3635 cov_273kjaqpct.f[22]++;var parentNode = (cov_273kjaqpct.s[78]++, _ref3.parentNode),
3636 children = (cov_273kjaqpct.s[79]++, _ref3.children),
3637 style = (cov_273kjaqpct.s[80]++, _ref3.style);var arrowParent = (cov_273kjaqpct.s[81]++, parentNode);var svg = (cov_273kjaqpct.s[82]++, children[0]);var path = (cov_273kjaqpct.s[83]++, svg.children[1]);cov_273kjaqpct.s[84]++;svg.style.display = 'none';var destination = (cov_273kjaqpct.s[85]++, getElementText(arrowParent.querySelector('.jsondiffpatch-moved-destination')));var container = (cov_273kjaqpct.s[86]++, arrowParent.parentNode);var destinationElem = (cov_273kjaqpct.s[87]++, void 0);cov_273kjaqpct.s[88]++;eachChildren(container, function (child) {
3638 cov_273kjaqpct.f[23]++;cov_273kjaqpct.s[89]++;if (child.getAttribute('data-key') === destination) {
3639 cov_273kjaqpct.b[9][0]++;cov_273kjaqpct.s[90]++;destinationElem = child;
3640 } else {
3641 cov_273kjaqpct.b[9][1]++;
3642 }
3643 });cov_273kjaqpct.s[91]++;if (!destinationElem) {
3644 cov_273kjaqpct.b[10][0]++;cov_273kjaqpct.s[92]++;return;
3645 } else {
3646 cov_273kjaqpct.b[10][1]++;
3647 }cov_273kjaqpct.s[93]++;try {
3648 var distance = (cov_273kjaqpct.s[94]++, destinationElem.offsetTop - arrowParent.offsetTop);cov_273kjaqpct.s[95]++;svg.setAttribute('height', Math.abs(distance) + 6);cov_273kjaqpct.s[96]++;style.top = -8 + (distance > 0 ? (cov_273kjaqpct.b[11][0]++, 0) : (cov_273kjaqpct.b[11][1]++, distance)) + 'px';var curve = (cov_273kjaqpct.s[97]++, distance > 0 ? (cov_273kjaqpct.b[12][0]++, 'M30,0 Q-10,' + Math.round(distance / 2) + ' 26,' + (distance - 4)) : (cov_273kjaqpct.b[12][1]++, 'M30,' + -distance + ' Q-10,' + Math.round(-distance / 2) + ' 26,4'));cov_273kjaqpct.s[98]++;path.setAttribute('d', curve);cov_273kjaqpct.s[99]++;svg.style.display = '';
3649 } catch (err) {}
3650 });
3651}; /* jshint camelcase: true */ /* eslint-enable camelcase */cov_273kjaqpct.s[100]++;var showUnchanged = function showUnchanged(show, node, delay) {
3652 cov_273kjaqpct.f[24]++;var el = (cov_273kjaqpct.s[101]++, (cov_273kjaqpct.b[13][0]++, node) || (cov_273kjaqpct.b[13][1]++, document.body));var prefix = (cov_273kjaqpct.s[102]++, 'jsondiffpatch-unchanged-');var classes = (cov_273kjaqpct.s[103]++, { showing: prefix + 'showing', hiding: prefix + 'hiding', visible: prefix + 'visible', hidden: prefix + 'hidden' });var list = (cov_273kjaqpct.s[104]++, el.classList);cov_273kjaqpct.s[105]++;if (!list) {
3653 cov_273kjaqpct.b[14][0]++;cov_273kjaqpct.s[106]++;return;
3654 } else {
3655 cov_273kjaqpct.b[14][1]++;
3656 }cov_273kjaqpct.s[107]++;if (!delay) {
3657 cov_273kjaqpct.b[15][0]++;cov_273kjaqpct.s[108]++;list.remove(classes.showing);cov_273kjaqpct.s[109]++;list.remove(classes.hiding);cov_273kjaqpct.s[110]++;list.remove(classes.visible);cov_273kjaqpct.s[111]++;list.remove(classes.hidden);cov_273kjaqpct.s[112]++;if (show === false) {
3658 cov_273kjaqpct.b[16][0]++;cov_273kjaqpct.s[113]++;list.add(classes.hidden);
3659 } else {
3660 cov_273kjaqpct.b[16][1]++;
3661 }cov_273kjaqpct.s[114]++;return;
3662 } else {
3663 cov_273kjaqpct.b[15][1]++;
3664 }cov_273kjaqpct.s[115]++;if (show === false) {
3665 cov_273kjaqpct.b[17][0]++;cov_273kjaqpct.s[116]++;list.remove(classes.showing);cov_273kjaqpct.s[117]++;list.add(classes.visible);cov_273kjaqpct.s[118]++;setTimeout(function () {
3666 cov_273kjaqpct.f[25]++;cov_273kjaqpct.s[119]++;list.add(classes.hiding);
3667 }, 10);
3668 } else {
3669 cov_273kjaqpct.b[17][1]++;cov_273kjaqpct.s[120]++;list.remove(classes.hiding);cov_273kjaqpct.s[121]++;list.add(classes.showing);cov_273kjaqpct.s[122]++;list.remove(classes.hidden);
3670 }var intervalId = (cov_273kjaqpct.s[123]++, setInterval(function () {
3671 cov_273kjaqpct.f[26]++;cov_273kjaqpct.s[124]++;adjustArrows(el);
3672 }, 100));cov_273kjaqpct.s[125]++;setTimeout(function () {
3673 cov_273kjaqpct.f[27]++;cov_273kjaqpct.s[126]++;list.remove(classes.showing);cov_273kjaqpct.s[127]++;list.remove(classes.hiding);cov_273kjaqpct.s[128]++;if (show === false) {
3674 cov_273kjaqpct.b[18][0]++;cov_273kjaqpct.s[129]++;list.add(classes.hidden);cov_273kjaqpct.s[130]++;list.remove(classes.visible);
3675 } else {
3676 cov_273kjaqpct.b[18][1]++;cov_273kjaqpct.s[131]++;list.add(classes.visible);cov_273kjaqpct.s[132]++;list.remove(classes.hidden);
3677 }cov_273kjaqpct.s[133]++;setTimeout(function () {
3678 cov_273kjaqpct.f[28]++;cov_273kjaqpct.s[134]++;list.remove(classes.visible);cov_273kjaqpct.s[135]++;clearInterval(intervalId);
3679 }, delay + 400);
3680 }, delay);
3681};cov_273kjaqpct.s[136]++;var hideUnchanged = function hideUnchanged(node, delay) {
3682 cov_273kjaqpct.f[29]++;cov_273kjaqpct.s[137]++;return showUnchanged(false, node, delay);
3683};var defaultInstance = (cov_273kjaqpct.s[138]++, void 0);function format(delta, left) {
3684 cov_273kjaqpct.f[30]++;cov_273kjaqpct.s[139]++;if (!defaultInstance) {
3685 cov_273kjaqpct.b[19][0]++;cov_273kjaqpct.s[140]++;defaultInstance = new HtmlFormatter();
3686 } else {
3687 cov_273kjaqpct.b[19][1]++;
3688 }cov_273kjaqpct.s[141]++;return defaultInstance.format(delta, left);
3689}
3690
3691var html = Object.freeze({
3692 showUnchanged: showUnchanged,
3693 hideUnchanged: hideUnchanged,
3694 default: HtmlFormatter,
3695 format: format
3696});
3697
3698var cov_23zb36bnir = function () {
3699 var path = '/Users/benja/proj/jsondiffpatch/src/formatters/annotated.js',
3700 hash = '750ced81bce7e3624b7eddbe3e7bc0f18f2d4a8b',
3701 global = new Function('return this')(),
3702 gcv = '__coverage__',
3703 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/formatters/annotated.js', statementMap: { '0': { start: { line: 3, column: 25 }, end: { line: 114, column: 16 } }, '1': { start: { line: 4, column: 2 }, end: { line: 4, column: 60 } }, '2': { start: { line: 7, column: 4 }, end: { line: 7, column: 58 } }, '3': { start: { line: 9, column: 16 }, end: { line: 9, column: 148 } }, '4': { start: { line: 11, column: 4 }, end: { line: 11, column: 42 } }, '5': { start: { line: 12, column: 4 }, end: { line: 12, column: 17 } }, '6': { start: { line: 15, column: 2 }, end: { line: 112, column: 6 } }, '7': { start: { line: 18, column: 6 }, end: { line: 18, column: 162 } }, '8': { start: { line: 19, column: 6 }, end: { line: 22, column: 8 } }, '9': { start: { line: 20, column: 8 }, end: { line: 20, column: 98 } }, '10': { start: { line: 21, column: 8 }, end: { line: 21, column: 78 } }, '11': { start: { line: 23, column: 6 }, end: { line: 31, column: 8 } }, '12': { start: { line: 24, column: 8 }, end: { line: 24, column: 145 } }, '13': { start: { line: 25, column: 8 }, end: { line: 25, column: 39 } }, '14': { start: { line: 26, column: 8 }, end: { line: 26, column: 65 } }, '15': { start: { line: 27, column: 8 }, end: { line: 27, column: 26 } }, '16': { start: { line: 28, column: 8 }, end: { line: 28, column: 77 } }, '17': { start: { line: 29, column: 8 }, end: { line: 29, column: 30 } }, '18': { start: { line: 30, column: 8 }, end: { line: 30, column: 40 } }, '19': { start: { line: 36, column: 6 }, end: { line: 36, column: 76 } }, '20': { start: { line: 41, column: 18 }, end: { line: 41, column: 43 } }, '21': { start: { line: 42, column: 6 }, end: { line: 42, column: 57 } }, '22': { start: { line: 43, column: 6 }, end: { line: 52, column: 7 } }, '23': { start: { line: 44, column: 19 }, end: { line: 44, column: 27 } }, '24': { start: { line: 45, column: 8 }, end: { line: 45, column: 283 } }, '25': { start: { line: 46, column: 21 }, end: { line: 46, column: 32 } }, '26': { start: { line: 47, column: 8 }, end: { line: 50, column: 9 } }, '27': { start: { line: 48, column: 22 }, end: { line: 48, column: 40 } }, '28': { start: { line: 49, column: 10 }, end: { line: 49, column: 107 } }, '29': { start: { line: 51, column: 8 }, end: { line: 51, column: 35 } }, '30': { start: { line: 53, column: 6 }, end: { line: 53, column: 27 } }, '31': { start: { line: 58, column: 6 }, end: { line: 58, column: 67 } }, '32': { start: { line: 59, column: 6 }, end: { line: 62, column: 7 } }, '33': { start: { line: 60, column: 8 }, end: { line: 60, column: 25 } }, '34': { start: { line: 61, column: 8 }, end: { line: 61, column: 25 } }, '35': { start: { line: 63, column: 6 }, end: { line: 65, column: 7 } }, '36': { start: { line: 64, column: 8 }, end: { line: 64, column: 87 } }, '37': { start: { line: 70, column: 6 }, end: { line: 73, column: 7 } }, '38': { start: { line: 71, column: 8 }, end: { line: 71, column: 27 } }, '39': { start: { line: 72, column: 8 }, end: { line: 72, column: 25 } }, '40': { start: { line: 74, column: 6 }, end: { line: 74, column: 30 } }, '41': { start: { line: 79, column: 6 }, end: { line: 79, column: 48 } }, '42': { start: { line: 80, column: 6 }, end: { line: 82, column: 7 } }, '43': { start: { line: 81, column: 8 }, end: { line: 81, column: 25 } }, '44': { start: { line: 83, column: 6 }, end: { line: 85, column: 7 } }, '45': { start: { line: 84, column: 8 }, end: { line: 84, column: 87 } }, '46': { start: { line: 90, column: 6 }, end: { line: 92, column: 7 } }, '47': { start: { line: 91, column: 8 }, end: { line: 91, column: 27 } }, '48': { start: { line: 93, column: 6 }, end: { line: 93, column: 45 } }, '49': { start: { line: 110, column: 6 }, end: { line: 110, column: 53 } }, '50': { start: { line: 113, column: 2 }, end: { line: 113, column: 28 } }, '51': { start: { line: 118, column: 23 }, end: { line: 120, column: 1 } }, '52': { start: { line: 119, column: 2 }, end: { line: 119, column: 76 } }, '53': { start: { line: 122, column: 23 }, end: { line: 160, column: 1 } }, '54': { start: { line: 124, column: 23 }, end: { line: 124, column: 49 } }, '55': { start: { line: 125, column: 4 }, end: { line: 127, column: 5 } }, '56': { start: { line: 126, column: 6 }, end: { line: 126, column: 40 } }, '57': { start: { line: 128, column: 4 }, end: { line: 130, column: 5 } }, '58': { start: { line: 129, column: 6 }, end: { line: 129, column: 57 } }, '59': { start: { line: 131, column: 4 }, end: { line: 131, column: 70 } }, '60': { start: { line: 134, column: 23 }, end: { line: 134, column: 64 } }, '61': { start: { line: 135, column: 4 }, end: { line: 137, column: 5 } }, '62': { start: { line: 136, column: 6 }, end: { line: 136, column: 43 } }, '63': { start: { line: 138, column: 4 }, end: { line: 140, column: 5 } }, '64': { start: { line: 139, column: 6 }, end: { line: 139, column: 57 } }, '65': { start: { line: 141, column: 4 }, end: { line: 141, column: 73 } }, '66': { start: { line: 144, column: 23 }, end: { line: 144, column: 60 } }, '67': { start: { line: 145, column: 4 }, end: { line: 147, column: 5 } }, '68': { start: { line: 146, column: 6 }, end: { line: 146, column: 43 } }, '69': { start: { line: 148, column: 4 }, end: { line: 150, column: 5 } }, '70': { start: { line: 149, column: 6 }, end: { line: 149, column: 54 } }, '71': { start: { line: 151, column: 4 }, end: { line: 151, column: 73 } }, '72': { start: { line: 154, column: 4 }, end: { line: 154, column: 202 } }, '73': { start: { line: 157, column: 19 }, end: { line: 157, column: 155 } }, '74': { start: { line: 158, column: 4 }, end: { line: 158, column: 155 } }, '75': { start: { line: 162, column: 22 }, end: { line: 174, column: 1 } }, '76': { start: { line: 163, column: 18 }, end: { line: 163, column: 42 } }, '77': { start: { line: 164, column: 18 }, end: { line: 164, column: 45 } }, '78': { start: { line: 165, column: 17 }, end: { line: 165, column: 98 } }, '79': { start: { line: 166, column: 13 }, end: { line: 166, column: 43 } }, '80': { start: { line: 167, column: 2 }, end: { line: 170, column: 3 } }, '81': { start: { line: 169, column: 4 }, end: { line: 169, column: 49 } }, '82': { start: { line: 171, column: 2 }, end: { line: 171, column: 19 } }, '83': { start: { line: 172, column: 2 }, end: { line: 172, column: 30 } }, '84': { start: { line: 173, column: 2 }, end: { line: 173, column: 21 } }, '85': { start: { line: 177, column: 0 }, end: { line: 177, column: 60 } }, '86': { start: { line: 178, column: 0 }, end: { line: 178, column: 63 } }, '87': { start: { line: 179, column: 0 }, end: { line: 179, column: 62 } }, '88': { start: { line: 180, column: 0 }, end: { line: 180, column: 60 } }, '89': { start: { line: 181, column: 0 }, end: { line: 181, column: 63 } }, '90': { start: { line: 188, column: 22 }, end: { line: 188, column: 28 } }, '91': { start: { line: 191, column: 2 }, end: { line: 193, column: 3 } }, '92': { start: { line: 192, column: 4 }, end: { line: 192, column: 47 } }, '93': { start: { line: 194, column: 2 }, end: { line: 194, column: 45 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 3, column: 25 }, end: { line: 3, column: 26 } }, loc: { start: { line: 3, column: 51 }, end: { line: 114, column: 1 } }, line: 3 }, '1': { name: 'AnnotatedFormatter', decl: { start: { line: 6, column: 11 }, end: { line: 6, column: 29 } }, loc: { start: { line: 6, column: 32 }, end: { line: 13, column: 3 } }, line: 6 }, '2': { name: 'prepareContext', decl: { start: { line: 17, column: 20 }, end: { line: 17, column: 34 } }, loc: { start: { line: 17, column: 44 }, end: { line: 32, column: 5 } }, line: 17 }, '3': { name: '(anonymous_3)', decl: { start: { line: 19, column: 23 }, end: { line: 19, column: 24 } }, loc: { start: { line: 19, column: 41 }, end: { line: 22, column: 7 } }, line: 19 }, '4': { name: '(anonymous_4)', decl: { start: { line: 23, column: 20 }, end: { line: 23, column: 21 } }, loc: { start: { line: 23, column: 46 }, end: { line: 31, column: 7 } }, line: 23 }, '5': { name: 'typeFormattterErrorFormatter', decl: { start: { line: 35, column: 20 }, end: { line: 35, column: 48 } }, loc: { start: { line: 35, column: 63 }, end: { line: 37, column: 5 } }, line: 35 }, '6': { name: 'formatTextDiffString', decl: { start: { line: 40, column: 20 }, end: { line: 40, column: 40 } }, loc: { start: { line: 40, column: 57 }, end: { line: 54, column: 5 } }, line: 40 }, '7': { name: 'rootBegin', decl: { start: { line: 57, column: 20 }, end: { line: 57, column: 29 } }, loc: { start: { line: 57, column: 55 }, end: { line: 66, column: 5 } }, line: 57 }, '8': { name: 'rootEnd', decl: { start: { line: 69, column: 20 }, end: { line: 69, column: 27 } }, loc: { start: { line: 69, column: 43 }, end: { line: 75, column: 5 } }, line: 69 }, '9': { name: 'nodeBegin', decl: { start: { line: 78, column: 20 }, end: { line: 78, column: 29 } }, loc: { start: { line: 78, column: 69 }, end: { line: 86, column: 5 } }, line: 78 }, '10': { name: 'nodeEnd', decl: { start: { line: 89, column: 20 }, end: { line: 89, column: 27 } }, loc: { start: { line: 89, column: 75 }, end: { line: 94, column: 5 } }, line: 89 }, '11': { name: 'format_unchanged', decl: { start: { line: 102, column: 20 }, end: { line: 102, column: 36 } }, loc: { start: { line: 102, column: 39 }, end: { line: 102, column: 41 } }, line: 102 }, '12': { name: 'format_movedestination', decl: { start: { line: 105, column: 20 }, end: { line: 105, column: 42 } }, loc: { start: { line: 105, column: 45 }, end: { line: 105, column: 47 } }, line: 105 }, '13': { name: 'format_node', decl: { start: { line: 108, column: 20 }, end: { line: 108, column: 31 } }, loc: { start: { line: 108, column: 54 }, end: { line: 111, column: 5 } }, line: 108 }, '14': { name: 'wrapPropertyName', decl: { start: { line: 118, column: 32 }, end: { line: 118, column: 48 } }, loc: { start: { line: 118, column: 55 }, end: { line: 120, column: 1 } }, line: 118 }, '15': { name: 'added', decl: { start: { line: 123, column: 18 }, end: { line: 123, column: 23 } }, loc: { start: { line: 123, column: 51 }, end: { line: 132, column: 3 } }, line: 123 }, '16': { name: 'modified', decl: { start: { line: 133, column: 21 }, end: { line: 133, column: 29 } }, loc: { start: { line: 133, column: 57 }, end: { line: 142, column: 3 } }, line: 133 }, '17': { name: 'deleted', decl: { start: { line: 143, column: 20 }, end: { line: 143, column: 27 } }, loc: { start: { line: 143, column: 55 }, end: { line: 152, column: 3 } }, line: 143 }, '18': { name: 'moved', decl: { start: { line: 153, column: 18 }, end: { line: 153, column: 23 } }, loc: { start: { line: 153, column: 51 }, end: { line: 155, column: 3 } }, line: 153 }, '19': { name: 'textdiff', decl: { start: { line: 156, column: 21 }, end: { line: 156, column: 29 } }, loc: { start: { line: 156, column: 57 }, end: { line: 159, column: 3 } }, line: 156 }, '20': { name: 'formatAnyChange', decl: { start: { line: 162, column: 31 }, end: { line: 162, column: 46 } }, loc: { start: { line: 162, column: 63 }, end: { line: 174, column: 1 } }, line: 162 }, '21': { name: 'format', decl: { start: { line: 190, column: 16 }, end: { line: 190, column: 22 } }, loc: { start: { line: 190, column: 36 }, end: { line: 195, column: 1 } }, line: 190 } }, branchMap: { '0': { loc: { start: { line: 9, column: 62 }, end: { line: 9, column: 135 } }, type: 'binary-expr', locations: [{ start: { line: 9, column: 62 }, end: { line: 9, column: 90 } }, { start: { line: 9, column: 94 }, end: { line: 9, column: 135 } }], line: 9 }, '1': { loc: { start: { line: 18, column: 23 }, end: { line: 18, column: 116 } }, type: 'binary-expr', locations: [{ start: { line: 18, column: 23 }, end: { line: 18, column: 61 } }, { start: { line: 18, column: 65 }, end: { line: 18, column: 116 } }], line: 18 }, '2': { loc: { start: { line: 20, column: 28 }, end: { line: 20, column: 49 } }, type: 'binary-expr', locations: [{ start: { line: 20, column: 28 }, end: { line: 20, column: 44 } }, { start: { line: 20, column: 48 }, end: { line: 20, column: 49 } }], line: 20 }, '3': { loc: { start: { line: 20, column: 54 }, end: { line: 20, column: 96 } }, type: 'cond-expr', locations: [{ start: { line: 20, column: 86 }, end: { line: 20, column: 87 } }, { start: { line: 20, column: 90 }, end: { line: 20, column: 96 } }], line: 20 }, '4': { loc: { start: { line: 59, column: 6 }, end: { line: 62, column: 7 } }, type: 'if', locations: [{ start: { line: 59, column: 6 }, end: { line: 62, column: 7 } }, { start: { line: 59, column: 6 }, end: { line: 62, column: 7 } }], line: 59 }, '5': { loc: { start: { line: 63, column: 6 }, end: { line: 65, column: 7 } }, type: 'if', locations: [{ start: { line: 63, column: 6 }, end: { line: 65, column: 7 } }, { start: { line: 63, column: 6 }, end: { line: 65, column: 7 } }], line: 63 }, '6': { loc: { start: { line: 70, column: 6 }, end: { line: 73, column: 7 } }, type: 'if', locations: [{ start: { line: 70, column: 6 }, end: { line: 73, column: 7 } }, { start: { line: 70, column: 6 }, end: { line: 73, column: 7 } }], line: 70 }, '7': { loc: { start: { line: 80, column: 6 }, end: { line: 82, column: 7 } }, type: 'if', locations: [{ start: { line: 80, column: 6 }, end: { line: 82, column: 7 } }, { start: { line: 80, column: 6 }, end: { line: 82, column: 7 } }], line: 80 }, '8': { loc: { start: { line: 83, column: 6 }, end: { line: 85, column: 7 } }, type: 'if', locations: [{ start: { line: 83, column: 6 }, end: { line: 85, column: 7 } }, { start: { line: 83, column: 6 }, end: { line: 85, column: 7 } }], line: 83 }, '9': { loc: { start: { line: 90, column: 6 }, end: { line: 92, column: 7 } }, type: 'if', locations: [{ start: { line: 90, column: 6 }, end: { line: 92, column: 7 } }, { start: { line: 90, column: 6 }, end: { line: 92, column: 7 } }], line: 90 }, '10': { loc: { start: { line: 93, column: 25 }, end: { line: 93, column: 42 } }, type: 'cond-expr', locations: [{ start: { line: 93, column: 34 }, end: { line: 93, column: 36 } }, { start: { line: 93, column: 39 }, end: { line: 93, column: 42 } }], line: 93 }, '11': { loc: { start: { line: 125, column: 4 }, end: { line: 127, column: 5 } }, type: 'if', locations: [{ start: { line: 125, column: 4 }, end: { line: 127, column: 5 } }, { start: { line: 125, column: 4 }, end: { line: 127, column: 5 } }], line: 125 }, '12': { loc: { start: { line: 128, column: 4 }, end: { line: 130, column: 5 } }, type: 'if', locations: [{ start: { line: 128, column: 4 }, end: { line: 130, column: 5 } }, { start: { line: 128, column: 4 }, end: { line: 130, column: 5 } }], line: 128 }, '13': { loc: { start: { line: 135, column: 4 }, end: { line: 137, column: 5 } }, type: 'if', locations: [{ start: { line: 135, column: 4 }, end: { line: 137, column: 5 } }, { start: { line: 135, column: 4 }, end: { line: 137, column: 5 } }], line: 135 }, '14': { loc: { start: { line: 138, column: 4 }, end: { line: 140, column: 5 } }, type: 'if', locations: [{ start: { line: 138, column: 4 }, end: { line: 140, column: 5 } }, { start: { line: 138, column: 4 }, end: { line: 140, column: 5 } }], line: 138 }, '15': { loc: { start: { line: 145, column: 4 }, end: { line: 147, column: 5 } }, type: 'if', locations: [{ start: { line: 145, column: 4 }, end: { line: 147, column: 5 } }, { start: { line: 145, column: 4 }, end: { line: 147, column: 5 } }], line: 145 }, '16': { loc: { start: { line: 148, column: 4 }, end: { line: 150, column: 5 } }, type: 'if', locations: [{ start: { line: 148, column: 4 }, end: { line: 150, column: 5 } }, { start: { line: 148, column: 4 }, end: { line: 150, column: 5 } }], line: 148 }, '17': { loc: { start: { line: 157, column: 19 }, end: { line: 157, column: 155 } }, type: 'cond-expr', locations: [{ start: { line: 157, column: 52 }, end: { line: 157, column: 54 } }, { start: { line: 157, column: 57 }, end: { line: 157, column: 155 } }], line: 157 }, '18': { loc: { start: { line: 157, column: 57 }, end: { line: 157, column: 155 } }, type: 'cond-expr', locations: [{ start: { line: 157, column: 87 }, end: { line: 157, column: 109 } }, { start: { line: 157, column: 112 }, end: { line: 157, column: 155 } }], line: 157 }, '19': { loc: { start: { line: 165, column: 17 }, end: { line: 165, column: 98 } }, type: 'binary-expr', locations: [{ start: { line: 165, column: 17 }, end: { line: 165, column: 26 } }, { start: { line: 165, column: 30 }, end: { line: 165, column: 98 } }], line: 165 }, '20': { loc: { start: { line: 167, column: 2 }, end: { line: 170, column: 3 } }, type: 'if', locations: [{ start: { line: 167, column: 2 }, end: { line: 170, column: 3 } }, { start: { line: 167, column: 2 }, end: { line: 170, column: 3 } }], line: 167 }, '21': { loc: { start: { line: 191, column: 2 }, end: { line: 193, column: 3 } }, type: 'if', locations: [{ start: { line: 191, column: 2 }, end: { line: 193, column: 3 } }, { start: { line: 191, column: 2 }, end: { line: 193, column: 3 } }], line: 191 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0, '86': 0, '87': 0, '88': 0, '89': 0, '90': 0, '91': 0, '92': 0, '93': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0], '20': [0, 0], '21': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3704 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3705 return coverage[path];
3706 }coverageData.hash = hash;return coverage[path] = coverageData;
3707}();var AnnotatedFormatter = (cov_23zb36bnir.s[0]++, function (_BaseFormatter) {
3708 cov_23zb36bnir.f[0]++;cov_23zb36bnir.s[1]++;inherits$1(AnnotatedFormatter, _BaseFormatter);function AnnotatedFormatter() {
3709 cov_23zb36bnir.f[1]++;cov_23zb36bnir.s[2]++;classCallCheck$1(this, AnnotatedFormatter);var _this = (cov_23zb36bnir.s[3]++, possibleConstructorReturn$1(this, ((cov_23zb36bnir.b[0][0]++, AnnotatedFormatter.__proto__) || (cov_23zb36bnir.b[0][1]++, Object.getPrototypeOf(AnnotatedFormatter))).call(this)));cov_23zb36bnir.s[4]++;_this.includeMoveDestinations = false;cov_23zb36bnir.s[5]++;return _this;
3710 }cov_23zb36bnir.s[6]++;createClass$1(AnnotatedFormatter, [{ key: 'prepareContext', value: function prepareContext(context) {
3711 cov_23zb36bnir.f[2]++;cov_23zb36bnir.s[7]++;get$1((cov_23zb36bnir.b[1][0]++, AnnotatedFormatter.prototype.__proto__) || (cov_23zb36bnir.b[1][1]++, Object.getPrototypeOf(AnnotatedFormatter.prototype)), 'prepareContext', this).call(this, context);cov_23zb36bnir.s[8]++;context.indent = function (levels) {
3712 cov_23zb36bnir.f[3]++;cov_23zb36bnir.s[9]++;this.indentLevel = ((cov_23zb36bnir.b[2][0]++, this.indentLevel) || (cov_23zb36bnir.b[2][1]++, 0)) + (typeof levels === 'undefined' ? (cov_23zb36bnir.b[3][0]++, 1) : (cov_23zb36bnir.b[3][1]++, levels));cov_23zb36bnir.s[10]++;this.indentPad = new Array(this.indentLevel + 1).join('&nbsp;&nbsp;');
3713 };cov_23zb36bnir.s[11]++;context.row = function (json, htmlNote) {
3714 cov_23zb36bnir.f[4]++;cov_23zb36bnir.s[12]++;context.out('<tr><td style="white-space: nowrap;">' + '<pre class="jsondiffpatch-annotated-indent"' + ' style="display: inline-block">');cov_23zb36bnir.s[13]++;context.out(context.indentPad);cov_23zb36bnir.s[14]++;context.out('</pre><pre style="display: inline-block">');cov_23zb36bnir.s[15]++;context.out(json);cov_23zb36bnir.s[16]++;context.out('</pre></td><td class="jsondiffpatch-delta-note"><div>');cov_23zb36bnir.s[17]++;context.out(htmlNote);cov_23zb36bnir.s[18]++;context.out('</div></td></tr>');
3715 };
3716 } }, { key: 'typeFormattterErrorFormatter', value: function typeFormattterErrorFormatter(context, err) {
3717 cov_23zb36bnir.f[5]++;cov_23zb36bnir.s[19]++;context.row('', '<pre class="jsondiffpatch-error">' + err + '</pre>');
3718 } }, { key: 'formatTextDiffString', value: function formatTextDiffString(context, value) {
3719 cov_23zb36bnir.f[6]++;var lines = (cov_23zb36bnir.s[20]++, this.parseTextDiff(value));cov_23zb36bnir.s[21]++;context.out('<ul class="jsondiffpatch-textdiff">');cov_23zb36bnir.s[22]++;for (var i = 0, l = lines.length; i < l; i++) {
3720 var line = (cov_23zb36bnir.s[23]++, lines[i]);cov_23zb36bnir.s[24]++;context.out('<li><div class="jsondiffpatch-textdiff-location">' + ('<span class="jsondiffpatch-textdiff-line-number">' + line.location.line + '</span><span class="jsondiffpatch-textdiff-char">' + line.location.chr + '</span></div><div class="jsondiffpatch-textdiff-line">'));var pieces = (cov_23zb36bnir.s[25]++, line.pieces);cov_23zb36bnir.s[26]++;for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
3721 var piece = (cov_23zb36bnir.s[27]++, pieces[pieceIndex]);cov_23zb36bnir.s[28]++;context.out('<span class="jsondiffpatch-textdiff-' + piece.type + '">' + piece.text + '</span>');
3722 }cov_23zb36bnir.s[29]++;context.out('</div></li>');
3723 }cov_23zb36bnir.s[30]++;context.out('</ul>');
3724 } }, { key: 'rootBegin', value: function rootBegin(context, type, nodeType) {
3725 cov_23zb36bnir.f[7]++;cov_23zb36bnir.s[31]++;context.out('<table class="jsondiffpatch-annotated-delta">');cov_23zb36bnir.s[32]++;if (type === 'node') {
3726 cov_23zb36bnir.b[4][0]++;cov_23zb36bnir.s[33]++;context.row('{');cov_23zb36bnir.s[34]++;context.indent();
3727 } else {
3728 cov_23zb36bnir.b[4][1]++;
3729 }cov_23zb36bnir.s[35]++;if (nodeType === 'array') {
3730 cov_23zb36bnir.b[5][0]++;cov_23zb36bnir.s[36]++;context.row('"_t": "a",', 'Array delta (member names indicate array indices)');
3731 } else {
3732 cov_23zb36bnir.b[5][1]++;
3733 }
3734 } }, { key: 'rootEnd', value: function rootEnd(context, type) {
3735 cov_23zb36bnir.f[8]++;cov_23zb36bnir.s[37]++;if (type === 'node') {
3736 cov_23zb36bnir.b[6][0]++;cov_23zb36bnir.s[38]++;context.indent(-1);cov_23zb36bnir.s[39]++;context.row('}');
3737 } else {
3738 cov_23zb36bnir.b[6][1]++;
3739 }cov_23zb36bnir.s[40]++;context.out('</table>');
3740 } }, { key: 'nodeBegin', value: function nodeBegin(context, key, leftKey, type, nodeType) {
3741 cov_23zb36bnir.f[9]++;cov_23zb36bnir.s[41]++;context.row('&quot;' + key + '&quot;: {');cov_23zb36bnir.s[42]++;if (type === 'node') {
3742 cov_23zb36bnir.b[7][0]++;cov_23zb36bnir.s[43]++;context.indent();
3743 } else {
3744 cov_23zb36bnir.b[7][1]++;
3745 }cov_23zb36bnir.s[44]++;if (nodeType === 'array') {
3746 cov_23zb36bnir.b[8][0]++;cov_23zb36bnir.s[45]++;context.row('"_t": "a",', 'Array delta (member names indicate array indices)');
3747 } else {
3748 cov_23zb36bnir.b[8][1]++;
3749 }
3750 } }, { key: 'nodeEnd', value: function nodeEnd(context, key, leftKey, type, nodeType, isLast) {
3751 cov_23zb36bnir.f[10]++;cov_23zb36bnir.s[46]++;if (type === 'node') {
3752 cov_23zb36bnir.b[9][0]++;cov_23zb36bnir.s[47]++;context.indent(-1);
3753 } else {
3754 cov_23zb36bnir.b[9][1]++;
3755 }cov_23zb36bnir.s[48]++;context.row('}' + (isLast ? (cov_23zb36bnir.b[10][0]++, '') : (cov_23zb36bnir.b[10][1]++, ',')));
3756 } /* jshint camelcase: false */ /* eslint-disable camelcase */ }, { key: 'format_unchanged', value: function format_unchanged() {
3757 cov_23zb36bnir.f[11]++;
3758 } }, { key: 'format_movedestination', value: function format_movedestination() {
3759 cov_23zb36bnir.f[12]++;
3760 } }, { key: 'format_node', value: function format_node(context, delta, left) {
3761 cov_23zb36bnir.f[13]++;cov_23zb36bnir.s[49]++; // recurse
3762 this.formatDeltaChildren(context, delta, left);
3763 } }]);cov_23zb36bnir.s[50]++;return AnnotatedFormatter;
3764}(BaseFormatter)); /* eslint-enable camelcase */cov_23zb36bnir.s[51]++;var wrapPropertyName = function wrapPropertyName(name) {
3765 cov_23zb36bnir.f[14]++;cov_23zb36bnir.s[52]++;return '<pre style="display:inline-block">&quot;' + name + '&quot;</pre>';
3766};var deltaAnnotations = (cov_23zb36bnir.s[53]++, { added: function added(delta, left, key, leftKey) {
3767 cov_23zb36bnir.f[15]++;var formatLegend = (cov_23zb36bnir.s[54]++, ' <pre>([newValue])</pre>');cov_23zb36bnir.s[55]++;if (typeof leftKey === 'undefined') {
3768 cov_23zb36bnir.b[11][0]++;cov_23zb36bnir.s[56]++;return 'new value' + formatLegend;
3769 } else {
3770 cov_23zb36bnir.b[11][1]++;
3771 }cov_23zb36bnir.s[57]++;if (typeof leftKey === 'number') {
3772 cov_23zb36bnir.b[12][0]++;cov_23zb36bnir.s[58]++;return 'insert at index ' + leftKey + formatLegend;
3773 } else {
3774 cov_23zb36bnir.b[12][1]++;
3775 }cov_23zb36bnir.s[59]++;return 'add property ' + wrapPropertyName(leftKey) + formatLegend;
3776 }, modified: function modified(delta, left, key, leftKey) {
3777 cov_23zb36bnir.f[16]++;var formatLegend = (cov_23zb36bnir.s[60]++, ' <pre>([previousValue, newValue])</pre>');cov_23zb36bnir.s[61]++;if (typeof leftKey === 'undefined') {
3778 cov_23zb36bnir.b[13][0]++;cov_23zb36bnir.s[62]++;return 'modify value' + formatLegend;
3779 } else {
3780 cov_23zb36bnir.b[13][1]++;
3781 }cov_23zb36bnir.s[63]++;if (typeof leftKey === 'number') {
3782 cov_23zb36bnir.b[14][0]++;cov_23zb36bnir.s[64]++;return 'modify at index ' + leftKey + formatLegend;
3783 } else {
3784 cov_23zb36bnir.b[14][1]++;
3785 }cov_23zb36bnir.s[65]++;return 'modify property ' + wrapPropertyName(leftKey) + formatLegend;
3786 }, deleted: function deleted(delta, left, key, leftKey) {
3787 cov_23zb36bnir.f[17]++;var formatLegend = (cov_23zb36bnir.s[66]++, ' <pre>([previousValue, 0, 0])</pre>');cov_23zb36bnir.s[67]++;if (typeof leftKey === 'undefined') {
3788 cov_23zb36bnir.b[15][0]++;cov_23zb36bnir.s[68]++;return 'delete value' + formatLegend;
3789 } else {
3790 cov_23zb36bnir.b[15][1]++;
3791 }cov_23zb36bnir.s[69]++;if (typeof leftKey === 'number') {
3792 cov_23zb36bnir.b[16][0]++;cov_23zb36bnir.s[70]++;return 'remove index ' + leftKey + formatLegend;
3793 } else {
3794 cov_23zb36bnir.b[16][1]++;
3795 }cov_23zb36bnir.s[71]++;return 'delete property ' + wrapPropertyName(leftKey) + formatLegend;
3796 }, moved: function moved(delta, left, key, leftKey) {
3797 cov_23zb36bnir.f[18]++;cov_23zb36bnir.s[72]++;return 'move from <span title="(position to remove at original state)">' + ('index ' + leftKey + '</span> to <span title="(position to insert at final') + (' state)">index ' + delta[1] + '</span>');
3798 }, textdiff: function textdiff(delta, left, key, leftKey) {
3799 cov_23zb36bnir.f[19]++;var location = (cov_23zb36bnir.s[73]++, typeof leftKey === 'undefined' ? (cov_23zb36bnir.b[17][0]++, '') : (cov_23zb36bnir.b[17][1]++, typeof leftKey === 'number' ? (cov_23zb36bnir.b[18][0]++, ' at index ' + leftKey) : (cov_23zb36bnir.b[18][1]++, ' at property ' + wrapPropertyName(leftKey))));cov_23zb36bnir.s[74]++;return 'text diff' + location + ', format is <a href="https://code.google.com/' + 'p/google-diff-match-patch/wiki/Unidiff">a variation of Unidiff</a>';
3800 } });cov_23zb36bnir.s[75]++;var formatAnyChange = function formatAnyChange(context, delta) {
3801 cov_23zb36bnir.f[20]++;var deltaType = (cov_23zb36bnir.s[76]++, this.getDeltaType(delta));var annotator = (cov_23zb36bnir.s[77]++, deltaAnnotations[deltaType]);var htmlNote = (cov_23zb36bnir.s[78]++, (cov_23zb36bnir.b[19][0]++, annotator) && (cov_23zb36bnir.b[19][1]++, annotator.apply(annotator, Array.prototype.slice.call(arguments, 1))));var json = (cov_23zb36bnir.s[79]++, JSON.stringify(delta, null, 2));cov_23zb36bnir.s[80]++;if (deltaType === 'textdiff') {
3802 cov_23zb36bnir.b[20][0]++;cov_23zb36bnir.s[81]++; // split text diffs lines
3803 json = json.split('\\n').join('\\n"+\n "');
3804 } else {
3805 cov_23zb36bnir.b[20][1]++;
3806 }cov_23zb36bnir.s[82]++;context.indent();cov_23zb36bnir.s[83]++;context.row(json, htmlNote);cov_23zb36bnir.s[84]++;context.indent(-1);
3807}; /* eslint-disable camelcase */cov_23zb36bnir.s[85]++;AnnotatedFormatter.prototype.format_added = formatAnyChange;cov_23zb36bnir.s[86]++;AnnotatedFormatter.prototype.format_modified = formatAnyChange;cov_23zb36bnir.s[87]++;AnnotatedFormatter.prototype.format_deleted = formatAnyChange;cov_23zb36bnir.s[88]++;AnnotatedFormatter.prototype.format_moved = formatAnyChange;cov_23zb36bnir.s[89]++;AnnotatedFormatter.prototype.format_textdiff = formatAnyChange; /* eslint-enable camelcase */ /* jshint camelcase: true */var defaultInstance$1 = (cov_23zb36bnir.s[90]++, void 0);function format$1(delta, left) {
3808 cov_23zb36bnir.f[21]++;cov_23zb36bnir.s[91]++;if (!defaultInstance$1) {
3809 cov_23zb36bnir.b[21][0]++;cov_23zb36bnir.s[92]++;defaultInstance$1 = new AnnotatedFormatter();
3810 } else {
3811 cov_23zb36bnir.b[21][1]++;
3812 }cov_23zb36bnir.s[93]++;return defaultInstance$1.format(delta, left);
3813}
3814
3815var annotated = Object.freeze({
3816 default: AnnotatedFormatter,
3817 format: format$1
3818});
3819
3820var cov_jjhm4s856 = function () {
3821 var path = '/Users/benja/proj/jsondiffpatch/src/formatters/jsonpatch.js',
3822 hash = '9b5b78803240797e2db3754793b03ea9de3badde',
3823 global = new Function('return this')(),
3824 gcv = '__coverage__',
3825 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/formatters/jsonpatch.js', statementMap: { '0': { start: { line: 3, column: 17 }, end: { line: 8, column: 1 } }, '1': { start: { line: 10, column: 20 }, end: { line: 128, column: 16 } }, '2': { start: { line: 11, column: 2 }, end: { line: 11, column: 55 } }, '3': { start: { line: 14, column: 4 }, end: { line: 14, column: 53 } }, '4': { start: { line: 16, column: 16 }, end: { line: 16, column: 138 } }, '5': { start: { line: 18, column: 4 }, end: { line: 18, column: 41 } }, '6': { start: { line: 19, column: 4 }, end: { line: 19, column: 17 } }, '7': { start: { line: 22, column: 2 }, end: { line: 126, column: 6 } }, '8': { start: { line: 25, column: 6 }, end: { line: 25, column: 152 } }, '9': { start: { line: 26, column: 6 }, end: { line: 26, column: 26 } }, '10': { start: { line: 27, column: 6 }, end: { line: 27, column: 24 } }, '11': { start: { line: 28, column: 6 }, end: { line: 40, column: 8 } }, '12': { start: { line: 29, column: 17 }, end: { line: 29, column: 23 } }, '13': { start: { line: 30, column: 20 }, end: { line: 30, column: 29 } }, '14': { start: { line: 32, column: 18 }, end: { line: 35, column: 9 } }, '15': { start: { line: 36, column: 8 }, end: { line: 38, column: 9 } }, '16': { start: { line: 37, column: 10 }, end: { line: 37, column: 28 } }, '17': { start: { line: 39, column: 8 }, end: { line: 39, column: 30 } }, '18': { start: { line: 42, column: 6 }, end: { line: 46, column: 8 } }, '19': { start: { line: 43, column: 22 }, end: { line: 43, column: 30 } }, '20': { start: { line: 44, column: 19 }, end: { line: 44, column: 37 } }, '21': { start: { line: 45, column: 8 }, end: { line: 45, column: 77 } }, '22': { start: { line: 48, column: 6 }, end: { line: 50, column: 8 } }, '23': { start: { line: 49, column: 8 }, end: { line: 49, column: 41 } }, '24': { start: { line: 55, column: 6 }, end: { line: 55, column: 36 } }, '25': { start: { line: 66, column: 17 }, end: { line: 66, column: 26 } }, '26': { start: { line: 68, column: 6 }, end: { line: 68, column: 25 } }, '27': { start: { line: 73, column: 17 }, end: { line: 73, column: 27 } }, '28': { start: { line: 75, column: 6 }, end: { line: 75, column: 17 } }, '29': { start: { line: 90, column: 6 }, end: { line: 90, column: 53 } }, '30': { start: { line: 95, column: 6 }, end: { line: 95, column: 69 } }, '31': { start: { line: 100, column: 6 }, end: { line: 100, column: 73 } }, '32': { start: { line: 105, column: 6 }, end: { line: 105, column: 55 } }, '33': { start: { line: 110, column: 15 }, end: { line: 110, column: 23 } }, '34': { start: { line: 111, column: 6 }, end: { line: 111, column: 29 } }, '35': { start: { line: 116, column: 6 }, end: { line: 116, column: 41 } }, '36': { start: { line: 121, column: 20 }, end: { line: 121, column: 22 } }, '37': { start: { line: 122, column: 6 }, end: { line: 122, column: 35 } }, '38': { start: { line: 123, column: 6 }, end: { line: 123, column: 41 } }, '39': { start: { line: 124, column: 6 }, end: { line: 124, column: 28 } }, '40': { start: { line: 127, column: 2 }, end: { line: 127, column: 23 } }, '41': { start: { line: 135, column: 11 }, end: { line: 137, column: 1 } }, '42': { start: { line: 136, column: 2 }, end: { line: 136, column: 29 } }, '43': { start: { line: 139, column: 13 }, end: { line: 142, column: 1 } }, '44': { start: { line: 140, column: 2 }, end: { line: 140, column: 17 } }, '45': { start: { line: 141, column: 2 }, end: { line: 141, column: 13 } }, '46': { start: { line: 144, column: 25 }, end: { line: 152, column: 1 } }, '47': { start: { line: 145, column: 14 }, end: { line: 145, column: 34 } }, '48': { start: { line: 146, column: 14 }, end: { line: 146, column: 34 } }, '49': { start: { line: 147, column: 2 }, end: { line: 151, column: 3 } }, '50': { start: { line: 148, column: 4 }, end: { line: 148, column: 25 } }, '51': { start: { line: 150, column: 4 }, end: { line: 150, column: 13 } }, '52': { start: { line: 154, column: 27 }, end: { line: 164, column: 1 } }, '53': { start: { line: 155, column: 2 }, end: { line: 163, column: 5 } }, '54': { start: { line: 156, column: 17 }, end: { line: 156, column: 34 } }, '55': { start: { line: 157, column: 17 }, end: { line: 157, column: 34 } }, '56': { start: { line: 158, column: 4 }, end: { line: 162, column: 5 } }, '57': { start: { line: 159, column: 6 }, end: { line: 159, column: 43 } }, '58': { start: { line: 161, column: 6 }, end: { line: 161, column: 60 } }, '59': { start: { line: 166, column: 16 }, end: { line: 175, column: 1 } }, '60': { start: { line: 167, column: 13 }, end: { line: 167, column: 15 } }, '61': { start: { line: 168, column: 14 }, end: { line: 168, column: 16 } }, '62': { start: { line: 170, column: 2 }, end: { line: 173, column: 5 } }, '63': { start: { line: 171, column: 15 }, end: { line: 171, column: 38 } }, '64': { start: { line: 172, column: 4 }, end: { line: 172, column: 18 } }, '65': { start: { line: 174, column: 2 }, end: { line: 174, column: 23 } }, '66': { start: { line: 177, column: 26 }, end: { line: 184, column: 1 } }, '67': { start: { line: 178, column: 19 }, end: { line: 181, column: 3 } }, '68': { start: { line: 179, column: 13 }, end: { line: 179, column: 21 } }, '69': { start: { line: 180, column: 4 }, end: { line: 180, column: 27 } }, '70': { start: { line: 182, column: 26 }, end: { line: 182, column: 66 } }, '71': { start: { line: 183, column: 2 }, end: { line: 183, column: 27 } }, '72': { start: { line: 186, column: 17 }, end: { line: 194, column: 1 } }, '73': { start: { line: 187, column: 29 }, end: { line: 187, column: 67 } }, '74': { start: { line: 188, column: 30 }, end: { line: 188, column: 81 } }, '75': { start: { line: 189, column: 18 }, end: { line: 189, column: 42 } }, '76': { start: { line: 190, column: 17 }, end: { line: 190, column: 41 } }, '77': { start: { line: 192, column: 25 }, end: { line: 192, column: 56 } }, '78': { start: { line: 193, column: 2 }, end: { line: 193, column: 43 } }, '79': { start: { line: 196, column: 22 }, end: { line: 196, column: 28 } }, '80': { start: { line: 198, column: 20 }, end: { line: 203, column: 1 } }, '81': { start: { line: 199, column: 2 }, end: { line: 201, column: 3 } }, '82': { start: { line: 200, column: 4 }, end: { line: 200, column: 42 } }, '83': { start: { line: 202, column: 2 }, end: { line: 202, column: 57 } }, '84': { start: { line: 205, column: 17 }, end: { line: 207, column: 1 } }, '85': { start: { line: 206, column: 2 }, end: { line: 206, column: 35 } } }, fnMap: { '0': { name: '(anonymous_0)', decl: { start: { line: 10, column: 20 }, end: { line: 10, column: 21 } }, loc: { start: { line: 10, column: 46 }, end: { line: 128, column: 1 } }, line: 10 }, '1': { name: 'JSONFormatter', decl: { start: { line: 13, column: 11 }, end: { line: 13, column: 24 } }, loc: { start: { line: 13, column: 27 }, end: { line: 20, column: 3 } }, line: 13 }, '2': { name: 'prepareContext', decl: { start: { line: 24, column: 20 }, end: { line: 24, column: 34 } }, loc: { start: { line: 24, column: 44 }, end: { line: 51, column: 5 } }, line: 24 }, '3': { name: '(anonymous_3)', decl: { start: { line: 28, column: 30 }, end: { line: 28, column: 31 } }, loc: { start: { line: 28, column: 45 }, end: { line: 40, column: 7 } }, line: 28 }, '4': { name: '(anonymous_4)', decl: { start: { line: 42, column: 27 }, end: { line: 42, column: 28 } }, loc: { start: { line: 42, column: 41 }, end: { line: 46, column: 7 } }, line: 42 }, '5': { name: '(anonymous_5)', decl: { start: { line: 48, column: 28 }, end: { line: 48, column: 29 } }, loc: { start: { line: 48, column: 40 }, end: { line: 50, column: 7 } }, line: 48 }, '6': { name: 'typeFormattterErrorFormatter', decl: { start: { line: 54, column: 20 }, end: { line: 54, column: 48 } }, loc: { start: { line: 54, column: 63 }, end: { line: 56, column: 5 } }, line: 54 }, '7': { name: 'rootBegin', decl: { start: { line: 59, column: 20 }, end: { line: 59, column: 29 } }, loc: { start: { line: 59, column: 32 }, end: { line: 59, column: 34 } }, line: 59 }, '8': { name: 'rootEnd', decl: { start: { line: 62, column: 20 }, end: { line: 62, column: 27 } }, loc: { start: { line: 62, column: 30 }, end: { line: 62, column: 32 } }, line: 62 }, '9': { name: 'nodeBegin', decl: { start: { line: 65, column: 20 }, end: { line: 65, column: 29 } }, loc: { start: { line: 65, column: 50 }, end: { line: 69, column: 5 } }, line: 65 }, '10': { name: 'nodeEnd', decl: { start: { line: 72, column: 20 }, end: { line: 72, column: 27 } }, loc: { start: { line: 72, column: 35 }, end: { line: 76, column: 5 } }, line: 72 }, '11': { name: 'format_unchanged', decl: { start: { line: 83, column: 20 }, end: { line: 83, column: 36 } }, loc: { start: { line: 83, column: 39 }, end: { line: 83, column: 41 } }, line: 83 }, '12': { name: 'format_movedestination', decl: { start: { line: 86, column: 20 }, end: { line: 86, column: 42 } }, loc: { start: { line: 86, column: 45 }, end: { line: 86, column: 47 } }, line: 86 }, '13': { name: 'format_node', decl: { start: { line: 89, column: 20 }, end: { line: 89, column: 31 } }, loc: { start: { line: 89, column: 54 }, end: { line: 91, column: 5 } }, line: 89 }, '14': { name: 'format_added', decl: { start: { line: 94, column: 20 }, end: { line: 94, column: 32 } }, loc: { start: { line: 94, column: 49 }, end: { line: 96, column: 5 } }, line: 94 }, '15': { name: 'format_modified', decl: { start: { line: 99, column: 20 }, end: { line: 99, column: 35 } }, loc: { start: { line: 99, column: 52 }, end: { line: 101, column: 5 } }, line: 99 }, '16': { name: 'format_deleted', decl: { start: { line: 104, column: 20 }, end: { line: 104, column: 34 } }, loc: { start: { line: 104, column: 44 }, end: { line: 106, column: 5 } }, line: 104 }, '17': { name: 'format_moved', decl: { start: { line: 109, column: 20 }, end: { line: 109, column: 32 } }, loc: { start: { line: 109, column: 49 }, end: { line: 112, column: 5 } }, line: 109 }, '18': { name: 'format_textdiff', decl: { start: { line: 115, column: 20 }, end: { line: 115, column: 35 } }, loc: { start: { line: 115, column: 38 }, end: { line: 117, column: 5 } }, line: 115 }, '19': { name: 'format', decl: { start: { line: 120, column: 20 }, end: { line: 120, column: 26 } }, loc: { start: { line: 120, column: 40 }, end: { line: 125, column: 5 } }, line: 120 }, '20': { name: 'last', decl: { start: { line: 135, column: 20 }, end: { line: 135, column: 24 } }, loc: { start: { line: 135, column: 30 }, end: { line: 137, column: 1 } }, line: 135 }, '21': { name: 'sortBy', decl: { start: { line: 139, column: 22 }, end: { line: 139, column: 28 } }, loc: { start: { line: 139, column: 40 }, end: { line: 142, column: 1 } }, line: 139 }, '22': { name: 'compareByIndexDesc', decl: { start: { line: 144, column: 34 }, end: { line: 144, column: 52 } }, loc: { start: { line: 144, column: 69 }, end: { line: 152, column: 1 } }, line: 144 }, '23': { name: 'opsByDescendingOrder', decl: { start: { line: 154, column: 36 }, end: { line: 154, column: 56 } }, loc: { start: { line: 154, column: 68 }, end: { line: 164, column: 1 } }, line: 154 }, '24': { name: '(anonymous_24)', decl: { start: { line: 155, column: 27 }, end: { line: 155, column: 28 } }, loc: { start: { line: 155, column: 43 }, end: { line: 163, column: 3 } }, line: 155 }, '25': { name: 'partition', decl: { start: { line: 166, column: 25 }, end: { line: 166, column: 34 } }, loc: { start: { line: 166, column: 46 }, end: { line: 175, column: 1 } }, line: 166 }, '26': { name: '(anonymous_26)', decl: { start: { line: 170, column: 14 }, end: { line: 170, column: 15 } }, loc: { start: { line: 170, column: 28 }, end: { line: 173, column: 3 } }, line: 170 }, '27': { name: 'partitionRemovedOps', decl: { start: { line: 177, column: 35 }, end: { line: 177, column: 54 } }, loc: { start: { line: 177, column: 74 }, end: { line: 184, column: 1 } }, line: 177 }, '28': { name: 'isRemoveOp', decl: { start: { line: 178, column: 28 }, end: { line: 178, column: 38 } }, loc: { start: { line: 178, column: 46 }, end: { line: 181, column: 3 } }, line: 178 }, '29': { name: 'reorderOps', decl: { start: { line: 186, column: 26 }, end: { line: 186, column: 36 } }, loc: { start: { line: 186, column: 56 }, end: { line: 194, column: 1 } }, line: 186 }, '30': { name: 'format', decl: { start: { line: 198, column: 29 }, end: { line: 198, column: 35 } }, loc: { start: { line: 198, column: 49 }, end: { line: 203, column: 1 } }, line: 198 }, '31': { name: 'log', decl: { start: { line: 205, column: 26 }, end: { line: 205, column: 29 } }, loc: { start: { line: 205, column: 43 }, end: { line: 207, column: 1 } }, line: 205 } }, branchMap: { '0': { loc: { start: { line: 16, column: 62 }, end: { line: 16, column: 125 } }, type: 'binary-expr', locations: [{ start: { line: 16, column: 62 }, end: { line: 16, column: 85 } }, { start: { line: 16, column: 89 }, end: { line: 16, column: 125 } }], line: 16 }, '1': { loc: { start: { line: 25, column: 23 }, end: { line: 25, column: 106 } }, type: 'binary-expr', locations: [{ start: { line: 25, column: 23 }, end: { line: 25, column: 56 } }, { start: { line: 25, column: 60 }, end: { line: 25, column: 106 } }], line: 25 }, '2': { loc: { start: { line: 36, column: 8 }, end: { line: 38, column: 9 } }, type: 'if', locations: [{ start: { line: 36, column: 8 }, end: { line: 38, column: 9 } }, { start: { line: 36, column: 8 }, end: { line: 38, column: 9 } }], line: 36 }, '3': { loc: { start: { line: 147, column: 2 }, end: { line: 151, column: 3 } }, type: 'if', locations: [{ start: { line: 147, column: 2 }, end: { line: 151, column: 3 } }, { start: { line: 147, column: 2 }, end: { line: 151, column: 3 } }], line: 147 }, '4': { loc: { start: { line: 147, column: 8 }, end: { line: 147, column: 36 } }, type: 'binary-expr', locations: [{ start: { line: 147, column: 8 }, end: { line: 147, column: 20 } }, { start: { line: 147, column: 24 }, end: { line: 147, column: 36 } }], line: 147 }, '5': { loc: { start: { line: 158, column: 4 }, end: { line: 162, column: 5 } }, type: 'if', locations: [{ start: { line: 158, column: 4 }, end: { line: 162, column: 5 } }, { start: { line: 158, column: 4 }, end: { line: 162, column: 5 } }], line: 158 }, '6': { loc: { start: { line: 171, column: 15 }, end: { line: 171, column: 38 } }, type: 'cond-expr', locations: [{ start: { line: 171, column: 26 }, end: { line: 171, column: 30 } }, { start: { line: 171, column: 33 }, end: { line: 171, column: 38 } }], line: 171 }, '7': { loc: { start: { line: 199, column: 2 }, end: { line: 201, column: 3 } }, type: 'if', locations: [{ start: { line: 199, column: 2 }, end: { line: 201, column: 3 } }, { start: { line: 199, column: 2 }, end: { line: 201, column: 3 } }], line: 199 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3826 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3827 return coverage[path];
3828 }coverageData.hash = hash;return coverage[path] = coverageData;
3829}();var OPERATIONS = (cov_jjhm4s856.s[0]++, { add: 'add', remove: 'remove', replace: 'replace', move: 'move' });var JSONFormatter = (cov_jjhm4s856.s[1]++, function (_BaseFormatter) {
3830 cov_jjhm4s856.f[0]++;cov_jjhm4s856.s[2]++;inherits$1(JSONFormatter, _BaseFormatter);function JSONFormatter() {
3831 cov_jjhm4s856.f[1]++;cov_jjhm4s856.s[3]++;classCallCheck$1(this, JSONFormatter);var _this = (cov_jjhm4s856.s[4]++, possibleConstructorReturn$1(this, ((cov_jjhm4s856.b[0][0]++, JSONFormatter.__proto__) || (cov_jjhm4s856.b[0][1]++, Object.getPrototypeOf(JSONFormatter))).call(this)));cov_jjhm4s856.s[5]++;_this.includeMoveDestinations = true;cov_jjhm4s856.s[6]++;return _this;
3832 }cov_jjhm4s856.s[7]++;createClass$1(JSONFormatter, [{ key: 'prepareContext', value: function prepareContext(context) {
3833 cov_jjhm4s856.f[2]++;cov_jjhm4s856.s[8]++;get$1((cov_jjhm4s856.b[1][0]++, JSONFormatter.prototype.__proto__) || (cov_jjhm4s856.b[1][1]++, Object.getPrototypeOf(JSONFormatter.prototype)), 'prepareContext', this).call(this, context);cov_jjhm4s856.s[9]++;context.result = [];cov_jjhm4s856.s[10]++;context.path = [];cov_jjhm4s856.s[11]++;context.pushCurrentOp = function (obj) {
3834 cov_jjhm4s856.f[3]++;var op = (cov_jjhm4s856.s[12]++, obj.op),
3835 value = (cov_jjhm4s856.s[13]++, obj.value);var val = (cov_jjhm4s856.s[14]++, { op: op, path: this.currentPath() });cov_jjhm4s856.s[15]++;if (typeof value !== 'undefined') {
3836 cov_jjhm4s856.b[2][0]++;cov_jjhm4s856.s[16]++;val.value = value;
3837 } else {
3838 cov_jjhm4s856.b[2][1]++;
3839 }cov_jjhm4s856.s[17]++;this.result.push(val);
3840 };cov_jjhm4s856.s[18]++;context.pushMoveOp = function (to) {
3841 cov_jjhm4s856.f[4]++;var finalTo = (cov_jjhm4s856.s[19]++, '/' + to);var from = (cov_jjhm4s856.s[20]++, this.currentPath());cov_jjhm4s856.s[21]++;this.result.push({ op: OPERATIONS.move, from: from, path: finalTo });
3842 };cov_jjhm4s856.s[22]++;context.currentPath = function () {
3843 cov_jjhm4s856.f[5]++;cov_jjhm4s856.s[23]++;return '/' + this.path.join('/');
3844 };
3845 } }, { key: 'typeFormattterErrorFormatter', value: function typeFormattterErrorFormatter(context, err) {
3846 cov_jjhm4s856.f[6]++;cov_jjhm4s856.s[24]++;context.out('[ERROR] ' + err);
3847 } }, { key: 'rootBegin', value: function rootBegin() {
3848 cov_jjhm4s856.f[7]++;
3849 } }, { key: 'rootEnd', value: function rootEnd() {
3850 cov_jjhm4s856.f[8]++;
3851 } }, { key: 'nodeBegin', value: function nodeBegin(_ref, key, leftKey) {
3852 cov_jjhm4s856.f[9]++;var path = (cov_jjhm4s856.s[25]++, _ref.path);cov_jjhm4s856.s[26]++;path.push(leftKey);
3853 } }, { key: 'nodeEnd', value: function nodeEnd(_ref2) {
3854 cov_jjhm4s856.f[10]++;var path = (cov_jjhm4s856.s[27]++, _ref2.path);cov_jjhm4s856.s[28]++;path.pop();
3855 } /* jshint camelcase: false */ /* eslint-disable camelcase */ }, { key: 'format_unchanged', value: function format_unchanged() {
3856 cov_jjhm4s856.f[11]++;
3857 } }, { key: 'format_movedestination', value: function format_movedestination() {
3858 cov_jjhm4s856.f[12]++;
3859 } }, { key: 'format_node', value: function format_node(context, delta, left) {
3860 cov_jjhm4s856.f[13]++;cov_jjhm4s856.s[29]++;this.formatDeltaChildren(context, delta, left);
3861 } }, { key: 'format_added', value: function format_added(context, delta) {
3862 cov_jjhm4s856.f[14]++;cov_jjhm4s856.s[30]++;context.pushCurrentOp({ op: OPERATIONS.add, value: delta[0] });
3863 } }, { key: 'format_modified', value: function format_modified(context, delta) {
3864 cov_jjhm4s856.f[15]++;cov_jjhm4s856.s[31]++;context.pushCurrentOp({ op: OPERATIONS.replace, value: delta[1] });
3865 } }, { key: 'format_deleted', value: function format_deleted(context) {
3866 cov_jjhm4s856.f[16]++;cov_jjhm4s856.s[32]++;context.pushCurrentOp({ op: OPERATIONS.remove });
3867 } }, { key: 'format_moved', value: function format_moved(context, delta) {
3868 cov_jjhm4s856.f[17]++;var to = (cov_jjhm4s856.s[33]++, delta[1]);cov_jjhm4s856.s[34]++;context.pushMoveOp(to);
3869 } }, { key: 'format_textdiff', value: function format_textdiff() {
3870 cov_jjhm4s856.f[18]++;cov_jjhm4s856.s[35]++;throw new Error('Not implemented');
3871 } }, { key: 'format', value: function format(delta, left) {
3872 cov_jjhm4s856.f[19]++;var context = (cov_jjhm4s856.s[36]++, {});cov_jjhm4s856.s[37]++;this.prepareContext(context);cov_jjhm4s856.s[38]++;this.recurse(context, delta, left);cov_jjhm4s856.s[39]++;return context.result;
3873 } }]);cov_jjhm4s856.s[40]++;return JSONFormatter;
3874}(BaseFormatter)); /* jshint camelcase: true */ /* eslint-enable camelcase */cov_jjhm4s856.s[41]++;var last = function last(arr) {
3875 cov_jjhm4s856.f[20]++;cov_jjhm4s856.s[42]++;return arr[arr.length - 1];
3876};cov_jjhm4s856.s[43]++;var sortBy = function sortBy(arr, pred) {
3877 cov_jjhm4s856.f[21]++;cov_jjhm4s856.s[44]++;arr.sort(pred);cov_jjhm4s856.s[45]++;return arr;
3878};cov_jjhm4s856.s[46]++;var compareByIndexDesc = function compareByIndexDesc(indexA, indexB) {
3879 cov_jjhm4s856.f[22]++;var lastA = (cov_jjhm4s856.s[47]++, parseInt(indexA, 10));var lastB = (cov_jjhm4s856.s[48]++, parseInt(indexB, 10));cov_jjhm4s856.s[49]++;if (!((cov_jjhm4s856.b[4][0]++, isNaN(lastA)) || (cov_jjhm4s856.b[4][1]++, isNaN(lastB)))) {
3880 cov_jjhm4s856.b[3][0]++;cov_jjhm4s856.s[50]++;return lastB - lastA;
3881 } else {
3882 cov_jjhm4s856.b[3][1]++;cov_jjhm4s856.s[51]++;return 0;
3883 }
3884};cov_jjhm4s856.s[52]++;var opsByDescendingOrder = function opsByDescendingOrder(removeOps) {
3885 cov_jjhm4s856.f[23]++;cov_jjhm4s856.s[53]++;return sortBy(removeOps, function (a, b) {
3886 cov_jjhm4s856.f[24]++;var splitA = (cov_jjhm4s856.s[54]++, a.path.split('/'));var splitB = (cov_jjhm4s856.s[55]++, b.path.split('/'));cov_jjhm4s856.s[56]++;if (splitA.length !== splitB.length) {
3887 cov_jjhm4s856.b[5][0]++;cov_jjhm4s856.s[57]++;return splitA.length - splitB.length;
3888 } else {
3889 cov_jjhm4s856.b[5][1]++;cov_jjhm4s856.s[58]++;return compareByIndexDesc(last(splitA), last(splitB));
3890 }
3891 });
3892};cov_jjhm4s856.s[59]++;var partition = function partition(arr, pred) {
3893 cov_jjhm4s856.f[25]++;var left = (cov_jjhm4s856.s[60]++, []);var right = (cov_jjhm4s856.s[61]++, []);cov_jjhm4s856.s[62]++;arr.forEach(function (el) {
3894 cov_jjhm4s856.f[26]++;var coll = (cov_jjhm4s856.s[63]++, pred(el) ? (cov_jjhm4s856.b[6][0]++, left) : (cov_jjhm4s856.b[6][1]++, right));cov_jjhm4s856.s[64]++;coll.push(el);
3895 });cov_jjhm4s856.s[65]++;return [left, right];
3896};cov_jjhm4s856.s[66]++;var partitionRemovedOps = function partitionRemovedOps(jsonFormattedDiff) {
3897 cov_jjhm4s856.f[27]++;cov_jjhm4s856.s[67]++;var isRemoveOp = function isRemoveOp(_ref3) {
3898 cov_jjhm4s856.f[28]++;var op = (cov_jjhm4s856.s[68]++, _ref3.op);cov_jjhm4s856.s[69]++;return op === 'remove';
3899 };var removeOpsOtherOps = (cov_jjhm4s856.s[70]++, partition(jsonFormattedDiff, isRemoveOp));cov_jjhm4s856.s[71]++;return removeOpsOtherOps;
3900};cov_jjhm4s856.s[72]++;var reorderOps = function reorderOps(jsonFormattedDiff) {
3901 cov_jjhm4s856.f[29]++;var _partitionRemovedOps = (cov_jjhm4s856.s[73]++, partitionRemovedOps(jsonFormattedDiff)),
3902 _partitionRemovedOps2 = (cov_jjhm4s856.s[74]++, slicedToArray$1(_partitionRemovedOps, 2)),
3903 removeOps = (cov_jjhm4s856.s[75]++, _partitionRemovedOps2[0]),
3904 otherOps = (cov_jjhm4s856.s[76]++, _partitionRemovedOps2[1]);var removeOpsReverse = (cov_jjhm4s856.s[77]++, opsByDescendingOrder(removeOps));cov_jjhm4s856.s[78]++;return removeOpsReverse.concat(otherOps);
3905};var defaultInstance$2 = (cov_jjhm4s856.s[79]++, void 0);cov_jjhm4s856.s[80]++;var format$2 = function format(delta, left) {
3906 cov_jjhm4s856.f[30]++;cov_jjhm4s856.s[81]++;if (!defaultInstance$2) {
3907 cov_jjhm4s856.b[7][0]++;cov_jjhm4s856.s[82]++;defaultInstance$2 = new JSONFormatter();
3908 } else {
3909 cov_jjhm4s856.b[7][1]++;
3910 }cov_jjhm4s856.s[83]++;return reorderOps(defaultInstance$2.format(delta, left));
3911};cov_jjhm4s856.s[84]++;var log = function log(delta, left) {
3912 cov_jjhm4s856.f[31]++;cov_jjhm4s856.s[85]++;console.log(format$2(delta, left));
3913};
3914
3915var jsonpatch = Object.freeze({
3916 default: JSONFormatter,
3917 format: format$2,
3918 log: log
3919});
3920
3921var cov_ye0cg04jg = function () {
3922 var path = '/Users/benja/proj/jsondiffpatch/src/formatters/console.js',
3923 hash = '5598765ad1d7bff6441347bf30803e4f0a7e9135',
3924 global = new Function('return this')(),
3925 gcv = '__coverage__',
3926 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/formatters/console.js', statementMap: { '0': { start: { line: 5, column: 2 }, end: { line: 11, column: 4 } }, '1': { start: { line: 6, column: 4 }, end: { line: 8, column: 5 } }, '2': { start: { line: 7, column: 6 }, end: { line: 7, column: 35 } }, '3': { start: { line: 10, column: 4 }, end: { line: 10, column: 16 } }, '4': { start: { line: 14, column: 13 }, end: { line: 22, column: 1 } }, '5': { start: { line: 24, column: 23 }, end: { line: 205, column: 16 } }, '6': { start: { line: 25, column: 2 }, end: { line: 25, column: 58 } }, '7': { start: { line: 28, column: 4 }, end: { line: 28, column: 56 } }, '8': { start: { line: 30, column: 16 }, end: { line: 30, column: 144 } }, '9': { start: { line: 32, column: 4 }, end: { line: 32, column: 42 } }, '10': { start: { line: 33, column: 4 }, end: { line: 33, column: 17 } }, '11': { start: { line: 36, column: 2 }, end: { line: 203, column: 6 } }, '12': { start: { line: 39, column: 6 }, end: { line: 39, column: 158 } }, '13': { start: { line: 40, column: 6 }, end: { line: 44, column: 8 } }, '14': { start: { line: 41, column: 8 }, end: { line: 41, column: 98 } }, '15': { start: { line: 42, column: 8 }, end: { line: 42, column: 68 } }, '16': { start: { line: 43, column: 8 }, end: { line: 43, column: 23 } }, '17': { start: { line: 45, column: 6 }, end: { line: 47, column: 8 } }, '18': { start: { line: 46, column: 8 }, end: { line: 46, column: 56 } }, '19': { start: { line: 48, column: 6 }, end: { line: 61, column: 8 } }, '20': { start: { line: 49, column: 8 }, end: { line: 51, column: 9 } }, '21': { start: { line: 50, column: 10 }, end: { line: 50, column: 41 } }, '22': { start: { line: 53, column: 8 }, end: { line: 60, column: 9 } }, '23': { start: { line: 54, column: 22 }, end: { line: 54, column: 41 } }, '24': { start: { line: 55, column: 21 }, end: { line: 55, column: 62 } }, '25': { start: { line: 56, column: 10 }, end: { line: 58, column: 11 } }, '26': { start: { line: 57, column: 12 }, end: { line: 57, column: 39 } }, '27': { start: { line: 59, column: 10 }, end: { line: 59, column: 33 } }, '28': { start: { line: 62, column: 6 }, end: { line: 65, column: 8 } }, '29': { start: { line: 63, column: 8 }, end: { line: 63, column: 38 } }, '30': { start: { line: 64, column: 8 }, end: { line: 64, column: 34 } }, '31': { start: { line: 66, column: 6 }, end: { line: 69, column: 8 } }, '32': { start: { line: 67, column: 8 }, end: { line: 67, column: 38 } }, '33': { start: { line: 68, column: 8 }, end: { line: 68, column: 27 } }, '34': { start: { line: 74, column: 6 }, end: { line: 74, column: 38 } }, '35': { start: { line: 75, column: 6 }, end: { line: 75, column: 35 } }, '36': { start: { line: 76, column: 6 }, end: { line: 76, column: 25 } }, '37': { start: { line: 81, column: 6 }, end: { line: 81, column: 50 } }, '38': { start: { line: 86, column: 18 }, end: { line: 86, column: 43 } }, '39': { start: { line: 87, column: 6 }, end: { line: 87, column: 23 } }, '40': { start: { line: 88, column: 6 }, end: { line: 103, column: 7 } }, '41': { start: { line: 89, column: 19 }, end: { line: 89, column: 27 } }, '42': { start: { line: 90, column: 8 }, end: { line: 90, column: 47 } }, '43': { start: { line: 91, column: 8 }, end: { line: 91, column: 72 } }, '44': { start: { line: 92, column: 8 }, end: { line: 92, column: 27 } }, '45': { start: { line: 93, column: 21 }, end: { line: 93, column: 32 } }, '46': { start: { line: 94, column: 8 }, end: { line: 99, column: 9 } }, '47': { start: { line: 95, column: 22 }, end: { line: 95, column: 40 } }, '48': { start: { line: 96, column: 10 }, end: { line: 96, column: 48 } }, '49': { start: { line: 97, column: 10 }, end: { line: 97, column: 34 } }, '50': { start: { line: 98, column: 10 }, end: { line: 98, column: 29 } }, '51': { start: { line: 100, column: 8 }, end: { line: 102, column: 9 } }, '52': { start: { line: 101, column: 10 }, end: { line: 101, column: 28 } }, '53': { start: { line: 104, column: 6 }, end: { line: 104, column: 25 } }, '54': { start: { line: 109, column: 6 }, end: { line: 109, column: 38 } }, '55': { start: { line: 110, column: 6 }, end: { line: 113, column: 7 } }, '56': { start: { line: 111, column: 8 }, end: { line: 111, column: 54 } }, '57': { start: { line: 112, column: 8 }, end: { line: 112, column: 25 } }, '58': { start: { line: 118, column: 6 }, end: { line: 121, column: 7 } }, '59': { start: { line: 119, column: 8 }, end: { line: 119, column: 27 } }, '60': { start: { line: 120, column: 8 }, end: { line: 120, column: 54 } }, '61': { start: { line: 122, column: 6 }, end: { line: 122, column: 25 } }, '62': { start: { line: 127, column: 6 }, end: { line: 127, column: 38 } }, '63': { start: { line: 128, column: 6 }, end: { line: 128, column: 34 } }, '64': { start: { line: 129, column: 6 }, end: { line: 132, column: 7 } }, '65': { start: { line: 130, column: 8 }, end: { line: 130, column: 54 } }, '66': { start: { line: 131, column: 8 }, end: { line: 131, column: 25 } }, '67': { start: { line: 137, column: 6 }, end: { line: 140, column: 7 } }, '68': { start: { line: 138, column: 8 }, end: { line: 138, column: 27 } }, '69': { start: { line: 139, column: 8 }, end: { line: 139, column: 76 } }, '70': { start: { line: 141, column: 6 }, end: { line: 143, column: 7 } }, '71': { start: { line: 142, column: 8 }, end: { line: 142, column: 26 } }, '72': { start: { line: 144, column: 6 }, end: { line: 144, column: 25 } }, '73': { start: { line: 153, column: 6 }, end: { line: 155, column: 7 } }, '74': { start: { line: 154, column: 8 }, end: { line: 154, column: 15 } }, '75': { start: { line: 156, column: 6 }, end: { line: 156, column: 38 } }, '76': { start: { line: 161, column: 6 }, end: { line: 163, column: 7 } }, '77': { start: { line: 162, column: 8 }, end: { line: 162, column: 15 } }, '78': { start: { line: 164, column: 6 }, end: { line: 164, column: 38 } }, '79': { start: { line: 170, column: 6 }, end: { line: 170, column: 53 } }, '80': { start: { line: 175, column: 6 }, end: { line: 175, column: 42 } }, '81': { start: { line: 180, column: 6 }, end: { line: 180, column: 40 } }, '82': { start: { line: 181, column: 6 }, end: { line: 181, column: 42 } }, '83': { start: { line: 182, column: 6 }, end: { line: 182, column: 25 } }, '84': { start: { line: 183, column: 6 }, end: { line: 183, column: 26 } }, '85': { start: { line: 184, column: 6 }, end: { line: 184, column: 38 } }, '86': { start: { line: 185, column: 6 }, end: { line: 185, column: 42 } }, '87': { start: { line: 186, column: 6 }, end: { line: 186, column: 25 } }, '88': { start: { line: 191, column: 6 }, end: { line: 191, column: 42 } }, '89': { start: { line: 196, column: 6 }, end: { line: 196, column: 37 } }, '90': { start: { line: 201, column: 6 }, end: { line: 201, column: 51 } }, '91': { start: { line: 204, column: 2 }, end: { line: 204, column: 26 } }, '92': { start: { line: 213, column: 22 }, end: { line: 213, column: 28 } }, '93': { start: { line: 215, column: 20 }, end: { line: 220, column: 1 } }, '94': { start: { line: 216, column: 2 }, end: { line: 218, column: 3 } }, '95': { start: { line: 217, column: 4 }, end: { line: 217, column: 45 } }, '96': { start: { line: 219, column: 2 }, end: { line: 219, column: 45 } }, '97': { start: { line: 223, column: 2 }, end: { line: 223, column: 35 } } }, fnMap: { '0': { name: 'chalkColor', decl: { start: { line: 4, column: 9 }, end: { line: 4, column: 19 } }, loc: { start: { line: 4, column: 26 }, end: { line: 12, column: 1 } }, line: 4 }, '1': { name: '(anonymous_1)', decl: { start: { line: 5, column: 33 }, end: { line: 5, column: 34 } }, loc: { start: { line: 5, column: 45 }, end: { line: 11, column: 3 } }, line: 5 }, '2': { name: '(anonymous_2)', decl: { start: { line: 24, column: 23 }, end: { line: 24, column: 24 } }, loc: { start: { line: 24, column: 49 }, end: { line: 205, column: 1 } }, line: 24 }, '3': { name: 'ConsoleFormatter', decl: { start: { line: 27, column: 11 }, end: { line: 27, column: 27 } }, loc: { start: { line: 27, column: 30 }, end: { line: 34, column: 3 } }, line: 27 }, '4': { name: 'prepareContext', decl: { start: { line: 38, column: 20 }, end: { line: 38, column: 34 } }, loc: { start: { line: 38, column: 44 }, end: { line: 70, column: 5 } }, line: 38 }, '5': { name: '(anonymous_5)', decl: { start: { line: 40, column: 23 }, end: { line: 40, column: 24 } }, loc: { start: { line: 40, column: 41 }, end: { line: 44, column: 7 } }, line: 40 }, '6': { name: '(anonymous_6)', decl: { start: { line: 45, column: 24 }, end: { line: 45, column: 25 } }, loc: { start: { line: 45, column: 36 }, end: { line: 47, column: 7 } }, line: 45 }, '7': { name: '(anonymous_7)', decl: { start: { line: 48, column: 20 }, end: { line: 48, column: 21 } }, loc: { start: { line: 48, column: 32 }, end: { line: 61, column: 7 } }, line: 48 }, '8': { name: '(anonymous_8)', decl: { start: { line: 62, column: 26 }, end: { line: 62, column: 27 } }, loc: { start: { line: 62, column: 43 }, end: { line: 65, column: 7 } }, line: 62 }, '9': { name: '(anonymous_9)', decl: { start: { line: 66, column: 25 }, end: { line: 66, column: 26 } }, loc: { start: { line: 66, column: 37 }, end: { line: 69, column: 7 } }, line: 66 }, '10': { name: 'typeFormattterErrorFormatter', decl: { start: { line: 73, column: 20 }, end: { line: 73, column: 48 } }, loc: { start: { line: 73, column: 63 }, end: { line: 77, column: 5 } }, line: 73 }, '11': { name: 'formatValue', decl: { start: { line: 80, column: 20 }, end: { line: 80, column: 31 } }, loc: { start: { line: 80, column: 48 }, end: { line: 82, column: 5 } }, line: 80 }, '12': { name: 'formatTextDiffString', decl: { start: { line: 85, column: 20 }, end: { line: 85, column: 40 } }, loc: { start: { line: 85, column: 57 }, end: { line: 105, column: 5 } }, line: 85 }, '13': { name: 'rootBegin', decl: { start: { line: 108, column: 20 }, end: { line: 108, column: 29 } }, loc: { start: { line: 108, column: 55 }, end: { line: 114, column: 5 } }, line: 108 }, '14': { name: 'rootEnd', decl: { start: { line: 117, column: 20 }, end: { line: 117, column: 27 } }, loc: { start: { line: 117, column: 53 }, end: { line: 123, column: 5 } }, line: 117 }, '15': { name: 'nodeBegin', decl: { start: { line: 126, column: 20 }, end: { line: 126, column: 29 } }, loc: { start: { line: 126, column: 69 }, end: { line: 133, column: 5 } }, line: 126 }, '16': { name: 'nodeEnd', decl: { start: { line: 136, column: 20 }, end: { line: 136, column: 27 } }, loc: { start: { line: 136, column: 75 }, end: { line: 145, column: 5 } }, line: 136 }, '17': { name: 'format_unchanged', decl: { start: { line: 152, column: 20 }, end: { line: 152, column: 36 } }, loc: { start: { line: 152, column: 59 }, end: { line: 157, column: 5 } }, line: 152 }, '18': { name: 'format_movedestination', decl: { start: { line: 160, column: 20 }, end: { line: 160, column: 42 } }, loc: { start: { line: 160, column: 65 }, end: { line: 165, column: 5 } }, line: 160 }, '19': { name: 'format_node', decl: { start: { line: 168, column: 20 }, end: { line: 168, column: 31 } }, loc: { start: { line: 168, column: 54 }, end: { line: 171, column: 5 } }, line: 168 }, '20': { name: 'format_added', decl: { start: { line: 174, column: 20 }, end: { line: 174, column: 32 } }, loc: { start: { line: 174, column: 49 }, end: { line: 176, column: 5 } }, line: 174 }, '21': { name: 'format_modified', decl: { start: { line: 179, column: 20 }, end: { line: 179, column: 35 } }, loc: { start: { line: 179, column: 52 }, end: { line: 187, column: 5 } }, line: 179 }, '22': { name: 'format_deleted', decl: { start: { line: 190, column: 20 }, end: { line: 190, column: 34 } }, loc: { start: { line: 190, column: 51 }, end: { line: 192, column: 5 } }, line: 190 }, '23': { name: 'format_moved', decl: { start: { line: 195, column: 20 }, end: { line: 195, column: 32 } }, loc: { start: { line: 195, column: 49 }, end: { line: 197, column: 5 } }, line: 195 }, '24': { name: 'format_textdiff', decl: { start: { line: 200, column: 20 }, end: { line: 200, column: 35 } }, loc: { start: { line: 200, column: 52 }, end: { line: 202, column: 5 } }, line: 200 }, '25': { name: 'format', decl: { start: { line: 215, column: 29 }, end: { line: 215, column: 35 } }, loc: { start: { line: 215, column: 49 }, end: { line: 220, column: 1 } }, line: 215 }, '26': { name: 'log', decl: { start: { line: 222, column: 16 }, end: { line: 222, column: 19 } }, loc: { start: { line: 222, column: 33 }, end: { line: 224, column: 1 } }, line: 222 } }, branchMap: { '0': { loc: { start: { line: 5, column: 9 }, end: { line: 11, column: 3 } }, type: 'binary-expr', locations: [{ start: { line: 5, column: 9 }, end: { line: 5, column: 14 } }, { start: { line: 5, column: 18 }, end: { line: 5, column: 29 } }, { start: { line: 5, column: 33 }, end: { line: 11, column: 3 } }], line: 5 }, '1': { loc: { start: { line: 30, column: 62 }, end: { line: 30, column: 131 } }, type: 'binary-expr', locations: [{ start: { line: 30, column: 62 }, end: { line: 30, column: 88 } }, { start: { line: 30, column: 92 }, end: { line: 30, column: 131 } }], line: 30 }, '2': { loc: { start: { line: 39, column: 23 }, end: { line: 39, column: 112 } }, type: 'binary-expr', locations: [{ start: { line: 39, column: 23 }, end: { line: 39, column: 59 } }, { start: { line: 39, column: 63 }, end: { line: 39, column: 112 } }], line: 39 }, '3': { loc: { start: { line: 41, column: 28 }, end: { line: 41, column: 49 } }, type: 'binary-expr', locations: [{ start: { line: 41, column: 28 }, end: { line: 41, column: 44 } }, { start: { line: 41, column: 48 }, end: { line: 41, column: 49 } }], line: 41 }, '4': { loc: { start: { line: 41, column: 54 }, end: { line: 41, column: 96 } }, type: 'cond-expr', locations: [{ start: { line: 41, column: 86 }, end: { line: 41, column: 87 } }, { start: { line: 41, column: 90 }, end: { line: 41, column: 96 } }], line: 41 }, '5': { loc: { start: { line: 46, column: 33 }, end: { line: 46, column: 53 } }, type: 'binary-expr', locations: [{ start: { line: 46, column: 33 }, end: { line: 46, column: 47 } }, { start: { line: 46, column: 51 }, end: { line: 46, column: 53 } }], line: 46 }, '6': { loc: { start: { line: 55, column: 40 }, end: { line: 55, column: 60 } }, type: 'binary-expr', locations: [{ start: { line: 55, column: 40 }, end: { line: 55, column: 54 } }, { start: { line: 55, column: 58 }, end: { line: 55, column: 60 } }], line: 55 }, '7': { loc: { start: { line: 56, column: 10 }, end: { line: 58, column: 11 } }, type: 'if', locations: [{ start: { line: 56, column: 10 }, end: { line: 58, column: 11 } }, { start: { line: 56, column: 10 }, end: { line: 58, column: 11 } }], line: 56 }, '8': { loc: { start: { line: 56, column: 14 }, end: { line: 56, column: 41 } }, type: 'binary-expr', locations: [{ start: { line: 56, column: 14 }, end: { line: 56, column: 24 } }, { start: { line: 56, column: 28 }, end: { line: 56, column: 41 } }], line: 56 }, '9': { loc: { start: { line: 63, column: 21 }, end: { line: 63, column: 37 } }, type: 'binary-expr', locations: [{ start: { line: 63, column: 21 }, end: { line: 63, column: 31 } }, { start: { line: 63, column: 35 }, end: { line: 63, column: 37 } }], line: 63 }, '10': { loc: { start: { line: 67, column: 21 }, end: { line: 67, column: 37 } }, type: 'binary-expr', locations: [{ start: { line: 67, column: 21 }, end: { line: 67, column: 31 } }, { start: { line: 67, column: 35 }, end: { line: 67, column: 37 } }], line: 67 }, '11': { loc: { start: { line: 100, column: 8 }, end: { line: 102, column: 9 } }, type: 'if', locations: [{ start: { line: 100, column: 8 }, end: { line: 102, column: 9 } }, { start: { line: 100, column: 8 }, end: { line: 102, column: 9 } }], line: 100 }, '12': { loc: { start: { line: 110, column: 6 }, end: { line: 113, column: 7 } }, type: 'if', locations: [{ start: { line: 110, column: 6 }, end: { line: 113, column: 7 } }, { start: { line: 110, column: 6 }, end: { line: 113, column: 7 } }], line: 110 }, '13': { loc: { start: { line: 111, column: 20 }, end: { line: 111, column: 52 } }, type: 'cond-expr', locations: [{ start: { line: 111, column: 43 }, end: { line: 111, column: 46 } }, { start: { line: 111, column: 49 }, end: { line: 111, column: 52 } }], line: 111 }, '14': { loc: { start: { line: 118, column: 6 }, end: { line: 121, column: 7 } }, type: 'if', locations: [{ start: { line: 118, column: 6 }, end: { line: 121, column: 7 } }, { start: { line: 118, column: 6 }, end: { line: 121, column: 7 } }], line: 118 }, '15': { loc: { start: { line: 120, column: 20 }, end: { line: 120, column: 52 } }, type: 'cond-expr', locations: [{ start: { line: 120, column: 43 }, end: { line: 120, column: 46 } }, { start: { line: 120, column: 49 }, end: { line: 120, column: 52 } }], line: 120 }, '16': { loc: { start: { line: 129, column: 6 }, end: { line: 132, column: 7 } }, type: 'if', locations: [{ start: { line: 129, column: 6 }, end: { line: 132, column: 7 } }, { start: { line: 129, column: 6 }, end: { line: 132, column: 7 } }], line: 129 }, '17': { loc: { start: { line: 130, column: 20 }, end: { line: 130, column: 52 } }, type: 'cond-expr', locations: [{ start: { line: 130, column: 43 }, end: { line: 130, column: 46 } }, { start: { line: 130, column: 49 }, end: { line: 130, column: 52 } }], line: 130 }, '18': { loc: { start: { line: 137, column: 6 }, end: { line: 140, column: 7 } }, type: 'if', locations: [{ start: { line: 137, column: 6 }, end: { line: 140, column: 7 } }, { start: { line: 137, column: 6 }, end: { line: 140, column: 7 } }], line: 137 }, '19': { loc: { start: { line: 139, column: 20 }, end: { line: 139, column: 74 } }, type: 'cond-expr', locations: [{ start: { line: 139, column: 43 }, end: { line: 139, column: 46 } }, { start: { line: 139, column: 49 }, end: { line: 139, column: 74 } }], line: 139 }, '20': { loc: { start: { line: 139, column: 56 }, end: { line: 139, column: 73 } }, type: 'cond-expr', locations: [{ start: { line: 139, column: 65 }, end: { line: 139, column: 67 } }, { start: { line: 139, column: 70 }, end: { line: 139, column: 73 } }], line: 139 }, '21': { loc: { start: { line: 141, column: 6 }, end: { line: 143, column: 7 } }, type: 'if', locations: [{ start: { line: 141, column: 6 }, end: { line: 143, column: 7 } }, { start: { line: 141, column: 6 }, end: { line: 143, column: 7 } }], line: 141 }, '22': { loc: { start: { line: 153, column: 6 }, end: { line: 155, column: 7 } }, type: 'if', locations: [{ start: { line: 153, column: 6 }, end: { line: 155, column: 7 } }, { start: { line: 153, column: 6 }, end: { line: 155, column: 7 } }], line: 153 }, '23': { loc: { start: { line: 161, column: 6 }, end: { line: 163, column: 7 } }, type: 'if', locations: [{ start: { line: 161, column: 6 }, end: { line: 163, column: 7 } }, { start: { line: 161, column: 6 }, end: { line: 163, column: 7 } }], line: 161 }, '24': { loc: { start: { line: 216, column: 2 }, end: { line: 218, column: 3 } }, type: 'if', locations: [{ start: { line: 216, column: 2 }, end: { line: 218, column: 3 } }, { start: { line: 216, column: 2 }, end: { line: 218, column: 3 } }], line: 216 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0, '27': 0, '28': 0, '29': 0, '30': 0, '31': 0, '32': 0, '33': 0, '34': 0, '35': 0, '36': 0, '37': 0, '38': 0, '39': 0, '40': 0, '41': 0, '42': 0, '43': 0, '44': 0, '45': 0, '46': 0, '47': 0, '48': 0, '49': 0, '50': 0, '51': 0, '52': 0, '53': 0, '54': 0, '55': 0, '56': 0, '57': 0, '58': 0, '59': 0, '60': 0, '61': 0, '62': 0, '63': 0, '64': 0, '65': 0, '66': 0, '67': 0, '68': 0, '69': 0, '70': 0, '71': 0, '72': 0, '73': 0, '74': 0, '75': 0, '76': 0, '77': 0, '78': 0, '79': 0, '80': 0, '81': 0, '82': 0, '83': 0, '84': 0, '85': 0, '86': 0, '87': 0, '88': 0, '89': 0, '90': 0, '91': 0, '92': 0, '93': 0, '94': 0, '95': 0, '96': 0, '97': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0, '17': 0, '18': 0, '19': 0, '20': 0, '21': 0, '22': 0, '23': 0, '24': 0, '25': 0, '26': 0 }, b: { '0': [0, 0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0], '5': [0, 0], '6': [0, 0], '7': [0, 0], '8': [0, 0], '9': [0, 0], '10': [0, 0], '11': [0, 0], '12': [0, 0], '13': [0, 0], '14': [0, 0], '15': [0, 0], '16': [0, 0], '17': [0, 0], '18': [0, 0], '19': [0, 0], '20': [0, 0], '21': [0, 0], '22': [0, 0], '23': [0, 0], '24': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
3927 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
3928 return coverage[path];
3929 }coverageData.hash = hash;return coverage[path] = coverageData;
3930}();function chalkColor(name) {
3931 cov_ye0cg04jg.f[0]++;cov_ye0cg04jg.s[0]++;return (cov_ye0cg04jg.b[0][0]++, chalk) && (cov_ye0cg04jg.b[0][1]++, chalk[name]) || (cov_ye0cg04jg.b[0][2]++, function () {
3932 cov_ye0cg04jg.f[1]++;cov_ye0cg04jg.s[1]++;for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
3933 cov_ye0cg04jg.s[2]++;args[_key] = arguments[_key];
3934 }cov_ye0cg04jg.s[3]++;return args;
3935 });
3936}var colors = (cov_ye0cg04jg.s[4]++, { added: chalkColor('green'), deleted: chalkColor('red'), movedestination: chalkColor('gray'), moved: chalkColor('yellow'), unchanged: chalkColor('gray'), error: chalkColor('white.bgRed'), textDiffLine: chalkColor('gray') });var ConsoleFormatter = (cov_ye0cg04jg.s[5]++, function (_BaseFormatter) {
3937 cov_ye0cg04jg.f[2]++;cov_ye0cg04jg.s[6]++;inherits$1(ConsoleFormatter, _BaseFormatter);function ConsoleFormatter() {
3938 cov_ye0cg04jg.f[3]++;cov_ye0cg04jg.s[7]++;classCallCheck$1(this, ConsoleFormatter);var _this = (cov_ye0cg04jg.s[8]++, possibleConstructorReturn$1(this, ((cov_ye0cg04jg.b[1][0]++, ConsoleFormatter.__proto__) || (cov_ye0cg04jg.b[1][1]++, Object.getPrototypeOf(ConsoleFormatter))).call(this)));cov_ye0cg04jg.s[9]++;_this.includeMoveDestinations = false;cov_ye0cg04jg.s[10]++;return _this;
3939 }cov_ye0cg04jg.s[11]++;createClass$1(ConsoleFormatter, [{ key: 'prepareContext', value: function prepareContext(context) {
3940 cov_ye0cg04jg.f[4]++;cov_ye0cg04jg.s[12]++;get$1((cov_ye0cg04jg.b[2][0]++, ConsoleFormatter.prototype.__proto__) || (cov_ye0cg04jg.b[2][1]++, Object.getPrototypeOf(ConsoleFormatter.prototype)), 'prepareContext', this).call(this, context);cov_ye0cg04jg.s[13]++;context.indent = function (levels) {
3941 cov_ye0cg04jg.f[5]++;cov_ye0cg04jg.s[14]++;this.indentLevel = ((cov_ye0cg04jg.b[3][0]++, this.indentLevel) || (cov_ye0cg04jg.b[3][1]++, 0)) + (typeof levels === 'undefined' ? (cov_ye0cg04jg.b[4][0]++, 1) : (cov_ye0cg04jg.b[4][1]++, levels));cov_ye0cg04jg.s[15]++;this.indentPad = new Array(this.indentLevel + 1).join(' ');cov_ye0cg04jg.s[16]++;this.outLine();
3942 };cov_ye0cg04jg.s[17]++;context.outLine = function () {
3943 cov_ye0cg04jg.f[6]++;cov_ye0cg04jg.s[18]++;this.buffer.push('\n' + ((cov_ye0cg04jg.b[5][0]++, this.indentPad) || (cov_ye0cg04jg.b[5][1]++, '')));
3944 };cov_ye0cg04jg.s[19]++;context.out = function () {
3945 cov_ye0cg04jg.f[7]++;cov_ye0cg04jg.s[20]++;for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3946 cov_ye0cg04jg.s[21]++;args[_key2] = arguments[_key2];
3947 }cov_ye0cg04jg.s[22]++;for (var i = 0, l = args.length; i < l; i++) {
3948 var lines = (cov_ye0cg04jg.s[23]++, args[i].split('\n'));var text = (cov_ye0cg04jg.s[24]++, lines.join('\n' + ((cov_ye0cg04jg.b[6][0]++, this.indentPad) || (cov_ye0cg04jg.b[6][1]++, ''))));cov_ye0cg04jg.s[25]++;if ((cov_ye0cg04jg.b[8][0]++, this.color) && (cov_ye0cg04jg.b[8][1]++, this.color[0])) {
3949 cov_ye0cg04jg.b[7][0]++;cov_ye0cg04jg.s[26]++;text = this.color[0](text);
3950 } else {
3951 cov_ye0cg04jg.b[7][1]++;
3952 }cov_ye0cg04jg.s[27]++;this.buffer.push(text);
3953 }
3954 };cov_ye0cg04jg.s[28]++;context.pushColor = function (color) {
3955 cov_ye0cg04jg.f[8]++;cov_ye0cg04jg.s[29]++;this.color = (cov_ye0cg04jg.b[9][0]++, this.color) || (cov_ye0cg04jg.b[9][1]++, []);cov_ye0cg04jg.s[30]++;this.color.unshift(color);
3956 };cov_ye0cg04jg.s[31]++;context.popColor = function () {
3957 cov_ye0cg04jg.f[9]++;cov_ye0cg04jg.s[32]++;this.color = (cov_ye0cg04jg.b[10][0]++, this.color) || (cov_ye0cg04jg.b[10][1]++, []);cov_ye0cg04jg.s[33]++;this.color.shift();
3958 };
3959 } }, { key: 'typeFormattterErrorFormatter', value: function typeFormattterErrorFormatter(context, err) {
3960 cov_ye0cg04jg.f[10]++;cov_ye0cg04jg.s[34]++;context.pushColor(colors.error);cov_ye0cg04jg.s[35]++;context.out('[ERROR]' + err);cov_ye0cg04jg.s[36]++;context.popColor();
3961 } }, { key: 'formatValue', value: function formatValue(context, value) {
3962 cov_ye0cg04jg.f[11]++;cov_ye0cg04jg.s[37]++;context.out(JSON.stringify(value, null, 2));
3963 } }, { key: 'formatTextDiffString', value: function formatTextDiffString(context, value) {
3964 cov_ye0cg04jg.f[12]++;var lines = (cov_ye0cg04jg.s[38]++, this.parseTextDiff(value));cov_ye0cg04jg.s[39]++;context.indent();cov_ye0cg04jg.s[40]++;for (var i = 0, l = lines.length; i < l; i++) {
3965 var line = (cov_ye0cg04jg.s[41]++, lines[i]);cov_ye0cg04jg.s[42]++;context.pushColor(colors.textDiffLine);cov_ye0cg04jg.s[43]++;context.out(line.location.line + ',' + line.location.chr + ' ');cov_ye0cg04jg.s[44]++;context.popColor();var pieces = (cov_ye0cg04jg.s[45]++, line.pieces);cov_ye0cg04jg.s[46]++;for (var pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
3966 var piece = (cov_ye0cg04jg.s[47]++, pieces[pieceIndex]);cov_ye0cg04jg.s[48]++;context.pushColor(colors[piece.type]);cov_ye0cg04jg.s[49]++;context.out(piece.text);cov_ye0cg04jg.s[50]++;context.popColor();
3967 }cov_ye0cg04jg.s[51]++;if (i < l - 1) {
3968 cov_ye0cg04jg.b[11][0]++;cov_ye0cg04jg.s[52]++;context.outLine();
3969 } else {
3970 cov_ye0cg04jg.b[11][1]++;
3971 }
3972 }cov_ye0cg04jg.s[53]++;context.indent(-1);
3973 } }, { key: 'rootBegin', value: function rootBegin(context, type, nodeType) {
3974 cov_ye0cg04jg.f[13]++;cov_ye0cg04jg.s[54]++;context.pushColor(colors[type]);cov_ye0cg04jg.s[55]++;if (type === 'node') {
3975 cov_ye0cg04jg.b[12][0]++;cov_ye0cg04jg.s[56]++;context.out(nodeType === 'array' ? (cov_ye0cg04jg.b[13][0]++, '[') : (cov_ye0cg04jg.b[13][1]++, '{'));cov_ye0cg04jg.s[57]++;context.indent();
3976 } else {
3977 cov_ye0cg04jg.b[12][1]++;
3978 }
3979 } }, { key: 'rootEnd', value: function rootEnd(context, type, nodeType) {
3980 cov_ye0cg04jg.f[14]++;cov_ye0cg04jg.s[58]++;if (type === 'node') {
3981 cov_ye0cg04jg.b[14][0]++;cov_ye0cg04jg.s[59]++;context.indent(-1);cov_ye0cg04jg.s[60]++;context.out(nodeType === 'array' ? (cov_ye0cg04jg.b[15][0]++, ']') : (cov_ye0cg04jg.b[15][1]++, '}'));
3982 } else {
3983 cov_ye0cg04jg.b[14][1]++;
3984 }cov_ye0cg04jg.s[61]++;context.popColor();
3985 } }, { key: 'nodeBegin', value: function nodeBegin(context, key, leftKey, type, nodeType) {
3986 cov_ye0cg04jg.f[15]++;cov_ye0cg04jg.s[62]++;context.pushColor(colors[type]);cov_ye0cg04jg.s[63]++;context.out(leftKey + ': ');cov_ye0cg04jg.s[64]++;if (type === 'node') {
3987 cov_ye0cg04jg.b[16][0]++;cov_ye0cg04jg.s[65]++;context.out(nodeType === 'array' ? (cov_ye0cg04jg.b[17][0]++, '[') : (cov_ye0cg04jg.b[17][1]++, '{'));cov_ye0cg04jg.s[66]++;context.indent();
3988 } else {
3989 cov_ye0cg04jg.b[16][1]++;
3990 }
3991 } }, { key: 'nodeEnd', value: function nodeEnd(context, key, leftKey, type, nodeType, isLast) {
3992 cov_ye0cg04jg.f[16]++;cov_ye0cg04jg.s[67]++;if (type === 'node') {
3993 cov_ye0cg04jg.b[18][0]++;cov_ye0cg04jg.s[68]++;context.indent(-1);cov_ye0cg04jg.s[69]++;context.out(nodeType === 'array' ? (cov_ye0cg04jg.b[19][0]++, ']') : (cov_ye0cg04jg.b[19][1]++, '}' + (isLast ? (cov_ye0cg04jg.b[20][0]++, '') : (cov_ye0cg04jg.b[20][1]++, ','))));
3994 } else {
3995 cov_ye0cg04jg.b[18][1]++;
3996 }cov_ye0cg04jg.s[70]++;if (!isLast) {
3997 cov_ye0cg04jg.b[21][0]++;cov_ye0cg04jg.s[71]++;context.outLine();
3998 } else {
3999 cov_ye0cg04jg.b[21][1]++;
4000 }cov_ye0cg04jg.s[72]++;context.popColor();
4001 } /* jshint camelcase: false */ /* eslint-disable camelcase */ }, { key: 'format_unchanged', value: function format_unchanged(context, delta, left) {
4002 cov_ye0cg04jg.f[17]++;cov_ye0cg04jg.s[73]++;if (typeof left === 'undefined') {
4003 cov_ye0cg04jg.b[22][0]++;cov_ye0cg04jg.s[74]++;return;
4004 } else {
4005 cov_ye0cg04jg.b[22][1]++;
4006 }cov_ye0cg04jg.s[75]++;this.formatValue(context, left);
4007 } }, { key: 'format_movedestination', value: function format_movedestination(context, delta, left) {
4008 cov_ye0cg04jg.f[18]++;cov_ye0cg04jg.s[76]++;if (typeof left === 'undefined') {
4009 cov_ye0cg04jg.b[23][0]++;cov_ye0cg04jg.s[77]++;return;
4010 } else {
4011 cov_ye0cg04jg.b[23][1]++;
4012 }cov_ye0cg04jg.s[78]++;this.formatValue(context, left);
4013 } }, { key: 'format_node', value: function format_node(context, delta, left) {
4014 cov_ye0cg04jg.f[19]++;cov_ye0cg04jg.s[79]++; // recurse
4015 this.formatDeltaChildren(context, delta, left);
4016 } }, { key: 'format_added', value: function format_added(context, delta) {
4017 cov_ye0cg04jg.f[20]++;cov_ye0cg04jg.s[80]++;this.formatValue(context, delta[0]);
4018 } }, { key: 'format_modified', value: function format_modified(context, delta) {
4019 cov_ye0cg04jg.f[21]++;cov_ye0cg04jg.s[81]++;context.pushColor(colors.deleted);cov_ye0cg04jg.s[82]++;this.formatValue(context, delta[0]);cov_ye0cg04jg.s[83]++;context.popColor();cov_ye0cg04jg.s[84]++;context.out(' => ');cov_ye0cg04jg.s[85]++;context.pushColor(colors.added);cov_ye0cg04jg.s[86]++;this.formatValue(context, delta[1]);cov_ye0cg04jg.s[87]++;context.popColor();
4020 } }, { key: 'format_deleted', value: function format_deleted(context, delta) {
4021 cov_ye0cg04jg.f[22]++;cov_ye0cg04jg.s[88]++;this.formatValue(context, delta[0]);
4022 } }, { key: 'format_moved', value: function format_moved(context, delta) {
4023 cov_ye0cg04jg.f[23]++;cov_ye0cg04jg.s[89]++;context.out('==> ' + delta[1]);
4024 } }, { key: 'format_textdiff', value: function format_textdiff(context, delta) {
4025 cov_ye0cg04jg.f[24]++;cov_ye0cg04jg.s[90]++;this.formatTextDiffString(context, delta[0]);
4026 } }]);cov_ye0cg04jg.s[91]++;return ConsoleFormatter;
4027}(BaseFormatter)); /* eslint-enable camelcase */var defaultInstance$3 = (cov_ye0cg04jg.s[92]++, void 0);cov_ye0cg04jg.s[93]++;var format$3 = function format(delta, left) {
4028 cov_ye0cg04jg.f[25]++;cov_ye0cg04jg.s[94]++;if (!defaultInstance$3) {
4029 cov_ye0cg04jg.b[24][0]++;cov_ye0cg04jg.s[95]++;defaultInstance$3 = new ConsoleFormatter();
4030 } else {
4031 cov_ye0cg04jg.b[24][1]++;
4032 }cov_ye0cg04jg.s[96]++;return defaultInstance$3.format(delta, left);
4033};function log$1(delta, left) {
4034 cov_ye0cg04jg.f[26]++;cov_ye0cg04jg.s[97]++;console.log(format$3(delta, left));
4035}
4036
4037var console$1 = Object.freeze({
4038 default: ConsoleFormatter,
4039 format: format$3,
4040 log: log$1
4041});
4042
4043var cov_1weqc1su9i = function () {
4044 var path = '/Users/benja/proj/jsondiffpatch/src/formatters/index.js',
4045 hash = 'c90281cbe3a6f4f9d6d07f59d6c3ec3cc53eab42',
4046 global = new Function('return this')(),
4047 gcv = '__coverage__',
4048 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/formatters/index.js', statementMap: {}, fnMap: {}, branchMap: {}, s: {}, f: {}, b: {}, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
4049 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
4050 return coverage[path];
4051 }coverageData.hash = hash;return coverage[path] = coverageData;
4052}();
4053
4054var index = Object.freeze({
4055 base: base,
4056 html: html,
4057 annotated: annotated,
4058 jsonpatch: jsonpatch,
4059 console: console$1
4060});
4061
4062var cov_wclgz6xnr = function () {
4063 var path = '/Users/benja/proj/jsondiffpatch/src/date-reviver.js',
4064 hash = '327f769b790d8f76a1477ada73bfb6605beb67d0',
4065 global = new Function('return this')(),
4066 gcv = '__coverage__',
4067 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/date-reviver.js', statementMap: { '0': { start: { line: 3, column: 14 }, end: { line: 3, column: 20 } }, '1': { start: { line: 4, column: 2 }, end: { line: 10, column: 3 } }, '2': { start: { line: 6, column: 4 }, end: { line: 6, column: 113 } }, '3': { start: { line: 7, column: 4 }, end: { line: 9, column: 5 } }, '4': { start: { line: 8, column: 6 }, end: { line: 8, column: 120 } }, '5': { start: { line: 11, column: 2 }, end: { line: 11, column: 15 } } }, fnMap: { '0': { name: 'dateReviver', decl: { start: { line: 2, column: 24 }, end: { line: 2, column: 35 } }, loc: { start: { line: 2, column: 48 }, end: { line: 12, column: 1 } }, line: 2 } }, branchMap: { '0': { loc: { start: { line: 4, column: 2 }, end: { line: 10, column: 3 } }, type: 'if', locations: [{ start: { line: 4, column: 2 }, end: { line: 10, column: 3 } }, { start: { line: 4, column: 2 }, end: { line: 10, column: 3 } }], line: 4 }, '1': { loc: { start: { line: 7, column: 4 }, end: { line: 9, column: 5 } }, type: 'if', locations: [{ start: { line: 7, column: 4 }, end: { line: 9, column: 5 } }, { start: { line: 7, column: 4 }, end: { line: 9, column: 5 } }], line: 7 }, '2': { loc: { start: { line: 8, column: 103 }, end: { line: 8, column: 116 } }, type: 'binary-expr', locations: [{ start: { line: 8, column: 103 }, end: { line: 8, column: 111 } }, { start: { line: 8, column: 115 }, end: { line: 8, column: 116 } }], line: 8 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0 }, f: { '0': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
4068 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
4069 return coverage[path];
4070 }coverageData.hash = hash;return coverage[path] = coverageData;
4071}(); // use as 2nd parameter for JSON.parse to revive Date instances
4072var cov_21a97a3n44 = function () {
4073 var path = '/Users/benja/proj/jsondiffpatch/src/main.js',
4074 hash = 'bae27349c61262eea6c8eeba2b90d234b62b4662',
4075 global = new Function('return this')(),
4076 gcv = '__coverage__',
4077 coverageData = { path: '/Users/benja/proj/jsondiffpatch/src/main.js', statementMap: { '0': { start: { line: 11, column: 2 }, end: { line: 11, column: 34 } }, '1': { start: { line: 18, column: 22 }, end: { line: 18, column: 28 } }, '2': { start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }, '3': { start: { line: 22, column: 4 }, end: { line: 22, column: 40 } }, '4': { start: { line: 24, column: 2 }, end: { line: 24, column: 64 } }, '5': { start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }, '6': { start: { line: 29, column: 4 }, end: { line: 29, column: 40 } }, '7': { start: { line: 31, column: 2 }, end: { line: 31, column: 65 } }, '8': { start: { line: 35, column: 2 }, end: { line: 37, column: 3 } }, '9': { start: { line: 36, column: 4 }, end: { line: 36, column: 40 } }, '10': { start: { line: 38, column: 2 }, end: { line: 38, column: 67 } }, '11': { start: { line: 42, column: 2 }, end: { line: 44, column: 3 } }, '12': { start: { line: 43, column: 4 }, end: { line: 43, column: 40 } }, '13': { start: { line: 45, column: 2 }, end: { line: 45, column: 67 } }, '14': { start: { line: 49, column: 2 }, end: { line: 51, column: 3 } }, '15': { start: { line: 50, column: 4 }, end: { line: 50, column: 40 } }, '16': { start: { line: 52, column: 2 }, end: { line: 52, column: 65 } } }, fnMap: { '0': { name: 'create', decl: { start: { line: 10, column: 16 }, end: { line: 10, column: 22 } }, loc: { start: { line: 10, column: 32 }, end: { line: 12, column: 1 } }, line: 10 }, '1': { name: 'diff', decl: { start: { line: 20, column: 16 }, end: { line: 20, column: 20 } }, loc: { start: { line: 20, column: 23 }, end: { line: 25, column: 1 } }, line: 20 }, '2': { name: 'patch', decl: { start: { line: 27, column: 16 }, end: { line: 27, column: 21 } }, loc: { start: { line: 27, column: 24 }, end: { line: 32, column: 1 } }, line: 27 }, '3': { name: 'unpatch', decl: { start: { line: 34, column: 16 }, end: { line: 34, column: 23 } }, loc: { start: { line: 34, column: 26 }, end: { line: 39, column: 1 } }, line: 34 }, '4': { name: 'reverse', decl: { start: { line: 41, column: 16 }, end: { line: 41, column: 23 } }, loc: { start: { line: 41, column: 26 }, end: { line: 46, column: 1 } }, line: 41 }, '5': { name: 'clone', decl: { start: { line: 48, column: 16 }, end: { line: 48, column: 21 } }, loc: { start: { line: 48, column: 24 }, end: { line: 53, column: 1 } }, line: 48 } }, branchMap: { '0': { loc: { start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }, type: 'if', locations: [{ start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }, { start: { line: 21, column: 2 }, end: { line: 23, column: 3 } }], line: 21 }, '1': { loc: { start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }, type: 'if', locations: [{ start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }, { start: { line: 28, column: 2 }, end: { line: 30, column: 3 } }], line: 28 }, '2': { loc: { start: { line: 35, column: 2 }, end: { line: 37, column: 3 } }, type: 'if', locations: [{ start: { line: 35, column: 2 }, end: { line: 37, column: 3 } }, { start: { line: 35, column: 2 }, end: { line: 37, column: 3 } }], line: 35 }, '3': { loc: { start: { line: 42, column: 2 }, end: { line: 44, column: 3 } }, type: 'if', locations: [{ start: { line: 42, column: 2 }, end: { line: 44, column: 3 } }, { start: { line: 42, column: 2 }, end: { line: 44, column: 3 } }], line: 42 }, '4': { loc: { start: { line: 49, column: 2 }, end: { line: 51, column: 3 } }, type: 'if', locations: [{ start: { line: 49, column: 2 }, end: { line: 51, column: 3 } }, { start: { line: 49, column: 2 }, end: { line: 51, column: 3 } }], line: 49 } }, s: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '16': 0 }, f: { '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0 }, b: { '0': [0, 0], '1': [0, 0], '2': [0, 0], '3': [0, 0], '4': [0, 0] }, _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' },
4078 coverage = global[gcv] || (global[gcv] = {});if (coverage[path] && coverage[path].hash === hash) {
4079 return coverage[path];
4080 }coverageData.hash = hash;return coverage[path] = coverageData;
4081}();var defaultInstance$4 = (cov_21a97a3n44.s[1]++, void 0);function diff() {
4082 cov_21a97a3n44.f[1]++;cov_21a97a3n44.s[2]++;if (!defaultInstance$4) {
4083 cov_21a97a3n44.b[0][0]++;cov_21a97a3n44.s[3]++;defaultInstance$4 = new DiffPatcher();
4084 } else {
4085 cov_21a97a3n44.b[0][1]++;
4086 }cov_21a97a3n44.s[4]++;return defaultInstance$4.diff.apply(defaultInstance$4, arguments);
4087}function patch() {
4088 cov_21a97a3n44.f[2]++;cov_21a97a3n44.s[5]++;if (!defaultInstance$4) {
4089 cov_21a97a3n44.b[1][0]++;cov_21a97a3n44.s[6]++;defaultInstance$4 = new DiffPatcher();
4090 } else {
4091 cov_21a97a3n44.b[1][1]++;
4092 }cov_21a97a3n44.s[7]++;return defaultInstance$4.patch.apply(defaultInstance$4, arguments);
4093}function unpatch() {
4094 cov_21a97a3n44.f[3]++;cov_21a97a3n44.s[8]++;if (!defaultInstance$4) {
4095 cov_21a97a3n44.b[2][0]++;cov_21a97a3n44.s[9]++;defaultInstance$4 = new DiffPatcher();
4096 } else {
4097 cov_21a97a3n44.b[2][1]++;
4098 }cov_21a97a3n44.s[10]++;return defaultInstance$4.unpatch.apply(defaultInstance$4, arguments);
4099}function reverse() {
4100 cov_21a97a3n44.f[4]++;cov_21a97a3n44.s[11]++;if (!defaultInstance$4) {
4101 cov_21a97a3n44.b[3][0]++;cov_21a97a3n44.s[12]++;defaultInstance$4 = new DiffPatcher();
4102 } else {
4103 cov_21a97a3n44.b[3][1]++;
4104 }cov_21a97a3n44.s[13]++;return defaultInstance$4.reverse.apply(defaultInstance$4, arguments);
4105}function clone$1() {
4106 cov_21a97a3n44.f[5]++;cov_21a97a3n44.s[14]++;if (!defaultInstance$4) {
4107 cov_21a97a3n44.b[4][0]++;cov_21a97a3n44.s[15]++;defaultInstance$4 = new DiffPatcher();
4108 } else {
4109 cov_21a97a3n44.b[4][1]++;
4110 }cov_21a97a3n44.s[16]++;return defaultInstance$4.clone.apply(defaultInstance$4, arguments);
4111}
4112
4113var examples = {};
4114
4115var exampleDate = function exampleDate() {
4116 return new Date(2020, 10, 30, 15, 10, 3);
4117};
4118
4119/* jshint camelcase: false */
4120/* jshint multistr: true */
4121
4122examples.atomicValues = [
4123// undefined
4124{
4125 left: undefined,
4126 right: undefined,
4127 delta: undefined,
4128 reverse: undefined
4129}, {
4130 left: undefined,
4131 right: null,
4132 delta: [null],
4133 reverse: [null, 0, 0]
4134}, {
4135 left: undefined,
4136 right: false,
4137 delta: [false],
4138 reverse: [false, 0, 0]
4139}, {
4140 left: undefined,
4141 right: true,
4142 delta: [true],
4143 reverse: [true, 0, 0]
4144}, {
4145 left: undefined,
4146 right: 42,
4147 delta: [42],
4148 reverse: [42, 0, 0]
4149}, {
4150 left: undefined,
4151 right: 'some text',
4152 delta: ['some text'],
4153 reverse: ['some text', 0, 0]
4154}, {
4155 left: undefined,
4156 right: exampleDate(),
4157 delta: [exampleDate()],
4158 reverse: [exampleDate(), 0, 0]
4159}, {
4160 left: undefined,
4161 right: {
4162 a: 1,
4163 b: 2
4164 },
4165 delta: [{
4166 a: 1,
4167 b: 2
4168 }],
4169 reverse: [{
4170 a: 1,
4171 b: 2
4172 }, 0, 0]
4173}, {
4174 left: undefined,
4175 right: [1, 2, 3],
4176 delta: [[1, 2, 3]],
4177 reverse: [[1, 2, 3], 0, 0]
4178}, {
4179 left: undefined,
4180 right: function right(x) {
4181 return x * x;
4182 },
4183
4184 error: /not supported/
4185},
4186
4187// null
4188{
4189 left: null,
4190 right: null,
4191 delta: undefined,
4192 reverse: undefined
4193}, {
4194 left: null,
4195 right: false,
4196 delta: [null, false],
4197 reverse: [false, null]
4198}, {
4199 left: null,
4200 right: true,
4201 delta: [null, true],
4202 reverse: [true, null]
4203}, {
4204 left: null,
4205 right: 42,
4206 delta: [null, 42],
4207 reverse: [42, null]
4208}, {
4209 left: null,
4210 right: 'some text',
4211 delta: [null, 'some text'],
4212 reverse: ['some text', null]
4213}, {
4214 left: null,
4215 right: exampleDate(),
4216 delta: [null, exampleDate()],
4217 reverse: [exampleDate(), null]
4218}, {
4219 left: null,
4220 right: {
4221 a: 1,
4222 b: 2
4223 },
4224 delta: [null, {
4225 a: 1,
4226 b: 2
4227 }],
4228 reverse: [{
4229 a: 1,
4230 b: 2
4231 }, null]
4232}, {
4233 left: null,
4234 right: function right(x) {
4235 return x * x;
4236 },
4237
4238 error: /not supported/
4239},
4240
4241// false
4242{
4243 left: false,
4244 right: false,
4245 delta: undefined,
4246 reverse: undefined
4247}, {
4248 left: false,
4249 right: true,
4250 delta: [false, true],
4251 reverse: [true, false]
4252}, {
4253 left: false,
4254 right: 42,
4255 delta: [false, 42],
4256 reverse: [42, false]
4257}, {
4258 left: false,
4259 right: 'some text',
4260 delta: [false, 'some text'],
4261 reverse: ['some text', false]
4262}, {
4263 left: false,
4264 right: exampleDate(),
4265 delta: [false, exampleDate()],
4266 reverse: [exampleDate(), false]
4267}, {
4268 left: false,
4269 right: {
4270 a: 1,
4271 b: 2
4272 },
4273 delta: [false, {
4274 a: 1,
4275 b: 2
4276 }],
4277 reverse: [{
4278 a: 1,
4279 b: 2
4280 }, false]
4281}, {
4282 left: false,
4283 right: [1, 2, 3],
4284 delta: [false, [1, 2, 3]],
4285 reverse: [[1, 2, 3], false]
4286}, {
4287 left: false,
4288 right: function right(x) {
4289 return x * x;
4290 },
4291
4292 error: /not supported/
4293},
4294
4295// true
4296{
4297 left: true,
4298 right: true,
4299 delta: undefined,
4300 reverse: undefined
4301}, {
4302 left: true,
4303 right: 42,
4304 delta: [true, 42],
4305 reverse: [42, true]
4306}, {
4307 left: true,
4308 right: 'some text',
4309 delta: [true, 'some text'],
4310 reverse: ['some text', true]
4311}, {
4312 left: true,
4313 right: exampleDate(),
4314 delta: [true, exampleDate()],
4315 reverse: [exampleDate(), true]
4316}, {
4317 left: true,
4318 right: {
4319 a: 1,
4320 b: 2
4321 },
4322 delta: [true, {
4323 a: 1,
4324 b: 2
4325 }],
4326 reverse: [{
4327 a: 1,
4328 b: 2
4329 }, true]
4330}, {
4331 left: true,
4332 right: [1, 2, 3],
4333 delta: [true, [1, 2, 3]],
4334 reverse: [[1, 2, 3], true]
4335}, {
4336 left: true,
4337 right: function right(x) {
4338 return x * x;
4339 },
4340
4341 error: /not supported/
4342},
4343
4344// number
4345{
4346 name: 'number -> same number',
4347 left: 42,
4348 right: 42,
4349 delta: undefined,
4350 reverse: undefined
4351}, {
4352 left: 42,
4353 right: -1,
4354 delta: [42, -1],
4355 reverse: [-1, 42]
4356}, {
4357 left: 42,
4358 right: 'some text',
4359 delta: [42, 'some text'],
4360 reverse: ['some text', 42]
4361}, {
4362 left: 42,
4363 right: exampleDate(),
4364 delta: [42, exampleDate()],
4365 reverse: [exampleDate(), 42]
4366}, {
4367 left: 42,
4368 right: {
4369 a: 1,
4370 b: 2
4371 },
4372 delta: [42, {
4373 a: 1,
4374 b: 2
4375 }],
4376 reverse: [{
4377 a: 1,
4378 b: 2
4379 }, 42]
4380}, {
4381 left: 42,
4382 right: [1, 2, 3],
4383 delta: [42, [1, 2, 3]],
4384 reverse: [[1, 2, 3], 42]
4385}, {
4386 left: 42,
4387 right: function right(x) {
4388 return x * x;
4389 },
4390
4391 error: /not supported/
4392},
4393
4394// string
4395{
4396 name: 'string -> same string',
4397 left: 'some text',
4398 right: 'some text',
4399 delta: undefined,
4400 reverse: undefined
4401}, {
4402 left: 'some text',
4403 right: 'some fext',
4404 delta: ['some text', 'some fext'],
4405 reverse: ['some fext', 'some text']
4406}, {
4407 left: 'some text',
4408 right: exampleDate(),
4409 delta: ['some text', exampleDate()],
4410 reverse: [exampleDate(), 'some text']
4411}, {
4412 left: 'some text',
4413 right: {
4414 a: 1,
4415 b: 2
4416 },
4417 delta: ['some text', {
4418 a: 1,
4419 b: 2
4420 }],
4421 reverse: [{
4422 a: 1,
4423 b: 2
4424 }, 'some text']
4425}, {
4426 left: 'some text',
4427 right: [1, 2, 3],
4428 delta: ['some text', [1, 2, 3]],
4429 reverse: [[1, 2, 3], 'some text']
4430},
4431
4432// Date
4433{
4434 name: 'Date -> same Date',
4435 left: exampleDate(),
4436 right: exampleDate(),
4437 delta: undefined,
4438 reverse: undefined
4439}, {
4440 left: exampleDate(),
4441 right: new Date(2020, 5, 31, 15, 12, 30),
4442 delta: [exampleDate(), new Date(2020, 5, 31, 15, 12, 30)],
4443 reverse: [new Date(2020, 5, 31, 15, 12, 30), exampleDate()]
4444}, {
4445 left: exampleDate(),
4446 right: {
4447 a: 1,
4448 b: 2
4449 },
4450 delta: [exampleDate(), {
4451 a: 1,
4452 b: 2
4453 }],
4454 reverse: [{
4455 a: 1,
4456 b: 2
4457 }, exampleDate()]
4458}, {
4459 left: exampleDate(),
4460 right: [1, 2, 3],
4461 delta: [exampleDate(), [1, 2, 3]],
4462 reverse: [[1, 2, 3], exampleDate()]
4463}, {
4464 left: exampleDate(),
4465 right: function right(x) {
4466 return x * x;
4467 },
4468
4469 error: /not supported/
4470},
4471
4472// Function
4473{
4474 name: 'string -> Function',
4475 left: 'some text',
4476 right: function right(x) {
4477 return x * x;
4478 },
4479
4480 error: /not supported/
4481},
4482
4483// RegExp
4484{
4485 name: 'RegExp -> RegExp',
4486 left: /regex/g,
4487 right: /another regex/gi,
4488 delta: ['/regex/g', '/another regex/gi'],
4489 reverse: ['/another regex/gi', '/regex/g']
4490},
4491
4492// object
4493{
4494 name: 'object -> same object',
4495 left: {
4496 a: 1,
4497 b: 2
4498 },
4499 right: {
4500 a: 1,
4501 b: 2
4502 },
4503 delta: undefined,
4504 reverse: undefined
4505}, {
4506 left: {
4507 a: 1,
4508 b: 2
4509 },
4510 right: [1, 2, 3],
4511 delta: [{
4512 a: 1,
4513 b: 2
4514 }, [1, 2, 3]],
4515 reverse: [[1, 2, 3], {
4516 a: 1,
4517 b: 2
4518 }]
4519}, {
4520 left: {
4521 a: 1,
4522 b: 2
4523 },
4524 right: function right(x) {
4525 return x * x;
4526 },
4527
4528 error: /not supported/
4529},
4530
4531// array
4532{
4533 name: 'array -> same array',
4534 left: [1, 2, 3],
4535 right: [1, 2, 3],
4536 delta: undefined,
4537 reverse: undefined
4538}, {
4539 left: [1, 2, 3],
4540 right: function right(x) {
4541 return x * x;
4542 },
4543
4544 error: /not supported/
4545}, 0];
4546
4547var shortText = 'Madre,\ncuando yo sea grande\nquisiera hacer versos';
4548var largeText = '-Madre,\ncuando yo sea grande\nser\xE9 marinero.\n\nAhora estoy jugando\nque aquello es un puerto\ny que \xE9ste es un barco\ny \xE9stos son dos remos\ny por ese r\xEDo\nnavego y navego.\n\n(Agua, arena, piedras\ny dos palos viejos:\nun r\xEDo y un barco,\nun puerto y dos remos).\n\n-Madre,\ncuando yo sea grande\nser\xE9 jardinero.\n\nAhora estoy jugando\nque esto es un cantero,\naqu\xE9l un rosal,\n\xE9ste un jazminero\ny \xE9se es un camino\nque va por el medio.\n\n(Tierra, flores, hojas\ny unos tallos secos:\ncantero, camino,\nrosal, jazminero).\n\n-Madre,\ncuando yo sea grande\nquisiera hacer versos.\n\n-\xBFCon qu\xE9 est\xE1s jugando?\n\n-Madre, miro el cielo.\n\n(En dos ojos claros\ntodo el Universo).';
4549
4550examples.text = [{
4551 left: shortText,
4552 right: largeText,
4553 delta: [shortText, largeText],
4554 reverse: [largeText, shortText]
4555}, {
4556 left: largeText,
4557 right: largeText.replace(/jazminero/g, 'rosal'),
4558 delta: ['@@ -360,25 +360,21 @@\n %C3%A9ste un \n-jazminero\n+rosal' + '\n %0Ay %C3%A9se e\n@@ -479,17 +479,13 @@\n' + ' al, \n-jazminero\n+rosal\n ).%0A%0A\n', 0, 2],
4559 reverse: ['@@ -360,21 +360,25 @@\n %C3%A9ste un \n-rosal\n+jazminero\n %0Ay' + ' %C3%A9se e\n@@ -479,21 +479,25 @@\n %0Arosal,' + ' \n-rosal\n+jazminero\n ).%0A%0A-Mad\n', 0, 2],
4560 exactReverse: false
4561}, {
4562 name: 'larger than min length',
4563 options: {
4564 textDiff: {
4565 minLength: 10
4566 }
4567 },
4568 left: largeText.substr(0, 10),
4569 right: largeText.substr(0, 11).replace(/Madre/g, 'Padre'),
4570 delta: ['@@ -1,10 +1,11 @@\n -\n-M\n+P\n adre,%0Acu\n+a\n', 0, 2],
4571 reverse: ['@@ -1,11 +1,10 @@\n -\n-P\n+M\n adre,%0Acu\n-a\n', 0, 2],
4572 exactReverse: false
4573}, {
4574 name: 'shorter than min length',
4575 options: {
4576 textDiff: {
4577 minLength: 10
4578 }
4579 },
4580 left: largeText.substr(0, 9),
4581 right: largeText.substr(0, 11).replace(/Madre/g, 'Padre'),
4582 delta: ['-Madre,\nc', '-Padre,\ncua'],
4583 reverse: ['-Padre,\ncua', '-Madre,\nc'],
4584 exactReverse: false
4585}, 0];
4586
4587examples.objects = [{
4588 name: 'first level',
4589 left: {
4590 a: 1,
4591 b: 2
4592 },
4593 right: {
4594 a: 42,
4595 b: 2
4596 },
4597 delta: {
4598 a: [1, 42]
4599 },
4600 reverse: {
4601 a: [42, 1]
4602 }
4603}, {
4604 name: 'deep level',
4605 left: {
4606 a: {
4607 j: {
4608 k: {
4609 l: {
4610 m: {
4611 n: {
4612 o: 3
4613 }
4614 }
4615 }
4616 }
4617 }
4618 },
4619 b: 2
4620 },
4621 right: {
4622 a: {
4623 j: {
4624 k: {
4625 l: {
4626 m: {
4627 n: {
4628 o: true
4629 }
4630 }
4631 }
4632 }
4633 }
4634 },
4635 b: 2
4636 },
4637 delta: {
4638 a: {
4639 j: {
4640 k: {
4641 l: {
4642 m: {
4643 n: {
4644 o: [3, true]
4645 }
4646 }
4647 }
4648 }
4649 }
4650 }
4651 },
4652 reverse: {
4653 a: {
4654 j: {
4655 k: {
4656 l: {
4657 m: {
4658 n: {
4659 o: [true, 3]
4660 }
4661 }
4662 }
4663 }
4664 }
4665 }
4666 }
4667}, {
4668 name: 'multiple changes',
4669 left: {
4670 a: {
4671 j: {
4672 k: {
4673 l: {
4674 m: {
4675 n: {
4676 o: 3
4677 }
4678 }
4679 }
4680 }
4681 }
4682 },
4683 b: 2,
4684 c: 5
4685 },
4686 right: {
4687 a: {
4688 j: {
4689 k: {
4690 l: {
4691 m: {
4692 n: {
4693 o: 5,
4694 w: 12
4695 }
4696 }
4697 }
4698 }
4699 }
4700 },
4701 b: 2
4702 },
4703 delta: {
4704 a: {
4705 j: {
4706 k: {
4707 l: {
4708 m: {
4709 n: {
4710 o: [3, 5],
4711 w: [12]
4712 }
4713 }
4714 }
4715 }
4716 }
4717 },
4718 c: [5, 0, 0]
4719 },
4720 reverse: {
4721 a: {
4722 j: {
4723 k: {
4724 l: {
4725 m: {
4726 n: {
4727 o: [5, 3],
4728 w: [12, 0, 0]
4729 }
4730 }
4731 }
4732 }
4733 }
4734 },
4735 c: [5]
4736 }
4737}, {
4738 name: 'key removed',
4739 left: {
4740 a: 1,
4741 b: 2
4742 },
4743 right: {
4744 a: 1
4745 },
4746 delta: {
4747 b: [2, 0, 0]
4748 },
4749 reverse: {
4750 b: [2]
4751 }
4752}, {
4753 name: 'hasOwnProperty',
4754 /* jshint ignore:start */
4755 left: {
4756 hasOwnProperty: true
4757 },
4758 right: {
4759 hasOwnProperty: true
4760 }
4761 /* jshint ignore:end */
4762}, 0];
4763
4764examples.arrays = [{
4765 name: 'simple values',
4766 left: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
4767 right: [1, 3, 4, 5, 8, 9, 9.1, 10],
4768 delta: {
4769 _t: 'a',
4770 _1: [2, 0, 0],
4771 _5: [6, 0, 0],
4772 _6: [7, 0, 0],
4773 6: [9.1]
4774 },
4775 reverse: {
4776 _t: 'a',
4777 1: [2],
4778 5: [6],
4779 6: [7],
4780 _6: [9.1, 0, 0]
4781 }
4782}, {
4783 name: 'added block',
4784 left: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
4785 right: [1, 2, 3, 4, 5, 5.1, 5.2, 5.3, 6, 7, 8, 9, 10],
4786 delta: {
4787 _t: 'a',
4788 5: [5.1],
4789 6: [5.2],
4790 7: [5.3]
4791 },
4792 reverse: {
4793 _t: 'a',
4794 _5: [5.1, 0, 0],
4795 _6: [5.2, 0, 0],
4796 _7: [5.3, 0, 0]
4797 }
4798}, {
4799 name: 'movements',
4800 left: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
4801 right: [1, 2, 3, 7, 5, 6, 8, 9, 4, 10],
4802 delta: {
4803 _t: 'a',
4804 _3: ['', 8, 3],
4805 _6: ['', 3, 3]
4806 },
4807 reverse: {
4808 _t: 'a',
4809 _3: ['', 6, 3],
4810 _8: ['', 3, 3]
4811 }
4812}, {
4813 name: 'movements(2)',
4814 left: [1, 2, 3, 4],
4815 right: [2, 4, 1, 3],
4816 delta: {
4817 _t: 'a',
4818 _1: ['', 0, 3],
4819 _3: ['', 1, 3]
4820 },
4821 reverse: {
4822 _t: 'a',
4823 _2: ['', 0, 3],
4824 _3: ['', 2, 3]
4825 },
4826 exactReverse: false
4827}, {
4828 name: 'nested',
4829 options: {
4830 objectHash: function objectHash(obj) {
4831 if (obj && obj.id) {
4832 return obj.id;
4833 }
4834 }
4835 },
4836 left: [1, 2, {
4837 id: 4,
4838 width: 10
4839 }, 4, {
4840 id: 'five',
4841 width: 4
4842 }, 6, 7, 8, 9, 10],
4843 right: [1, 2, {
4844 id: 4,
4845 width: 12
4846 }, 4, {
4847 id: 'five',
4848 width: 4
4849 }, 6, 7, 8, 9, 10],
4850 delta: {
4851 _t: 'a',
4852 2: {
4853 width: [10, 12]
4854 }
4855 },
4856 reverse: {
4857 _t: 'a',
4858 2: {
4859 width: [12, 10]
4860 }
4861 }
4862}, {
4863 name: 'nested with movement',
4864 options: {
4865 objectHash: function objectHash(obj) {
4866 if (obj && obj.id) {
4867 return obj.id;
4868 }
4869 }
4870 },
4871 left: [1, 2, 4, {
4872 id: 'five',
4873 width: 4
4874 }, 6, 7, 8, {
4875 id: 4,
4876 width: 10,
4877 height: 3
4878 }, 9, 10],
4879 right: [1, 2, {
4880 id: 4,
4881 width: 12
4882 }, 4, {
4883 id: 'five',
4884 width: 4
4885 }, 6, 7, 8, 9, 10],
4886 delta: {
4887 _t: 'a',
4888 2: {
4889 width: [10, 12],
4890 height: [3, 0, 0]
4891 },
4892 _7: ['', 2, 3]
4893 },
4894 reverse: {
4895 _t: 'a',
4896 7: {
4897 width: [12, 10],
4898 height: [3]
4899 },
4900 _2: ['', 7, 3]
4901 }
4902}, {
4903 name: 'nested changes among array insertions and deletions',
4904 options: {
4905 objectHash: function objectHash(obj) {
4906 if (obj && obj.id) {
4907 return obj.id;
4908 }
4909 }
4910 },
4911 left: [{
4912 id: 1
4913 }, {
4914 id: 2
4915 }, {
4916 id: 4
4917 }, {
4918 id: 5
4919 }, {
4920 id: 6,
4921 inner: {
4922 property: 'abc'
4923 }
4924 }, {
4925 id: 7
4926 }, {
4927 id: 8
4928 }, {
4929 id: 10
4930 }, {
4931 id: 11
4932 }, {
4933 id: 12
4934 }],
4935 right: [{
4936 id: 3
4937 }, {
4938 id: 4
4939 }, {
4940 id: 6,
4941 inner: {
4942 property: 'abcd'
4943 }
4944 }, {
4945 id: 9
4946 }],
4947 delta: {
4948 _t: 'a',
4949 0: [{ id: 3 }],
4950 2: {
4951 inner: {
4952 property: ['abc', 'abcd']
4953 }
4954 },
4955 3: [{ id: 9 }],
4956 _0: [{ id: 1 }, 0, 0],
4957 _1: [{ id: 2 }, 0, 0],
4958 _3: [{ id: 5 }, 0, 0],
4959 _5: [{ id: 7 }, 0, 0],
4960 _6: [{ id: 8 }, 0, 0],
4961 _7: [{ id: 10 }, 0, 0],
4962 _8: [{ id: 11 }, 0, 0],
4963 _9: [{ id: 12 }, 0, 0]
4964 },
4965 reverse: {
4966 _t: 'a',
4967 0: [{ id: 1 }],
4968 1: [{ id: 2 }],
4969 3: [{ id: 5 }],
4970 4: {
4971 inner: {
4972 property: ['abcd', 'abc']
4973 }
4974 },
4975 5: [{ id: 7 }],
4976 6: [{ id: 8 }],
4977 7: [{ id: 10 }],
4978 8: [{ id: 11 }],
4979 9: [{ id: 12 }],
4980 _0: [{ id: 3 }, 0, 0],
4981 _3: [{ id: 9 }, 0, 0]
4982 }
4983}, {
4984 name: 'nested change with item moved above',
4985 options: {
4986 objectHash: function objectHash(obj) {
4987 if (obj && obj.id) {
4988 return obj.id;
4989 }
4990 }
4991 },
4992 left: [{
4993 id: 1
4994 }, {
4995 id: 2
4996 }, {
4997 id: 3,
4998 inner: {
4999 property: 'abc'
5000 }
5001 }, {
5002 id: 4
5003 }, {
5004 id: 5
5005 }, {
5006 id: 6
5007 }],
5008 right: [{
5009 id: 1
5010 }, {
5011 id: 2
5012 }, {
5013 id: 6
5014 }, {
5015 id: 3,
5016 inner: {
5017 property: 'abcd'
5018 }
5019 }, {
5020 id: 4
5021 }, {
5022 id: 5
5023 }],
5024 delta: {
5025 _t: 'a',
5026 3: {
5027 inner: {
5028 property: ['abc', 'abcd']
5029 }
5030 },
5031 _5: ['', 2, 3]
5032 },
5033 reverse: {
5034 _t: 'a',
5035 2: {
5036 inner: {
5037 property: ['abcd', 'abc']
5038 }
5039 },
5040 _2: ['', 5, 3]
5041 }
5042}, {
5043 name: 'nested change with item moved right above',
5044 options: {
5045 objectHash: function objectHash(obj) {
5046 if (obj && obj.id) {
5047 return obj.id;
5048 }
5049 }
5050 },
5051 left: [{
5052 id: 1
5053 }, {
5054 id: 2,
5055 inner: {
5056 property: 'abc'
5057 }
5058 }, {
5059 id: 3
5060 }],
5061 right: [{
5062 id: 1
5063 }, {
5064 id: 3
5065 }, {
5066 id: 2,
5067 inner: {
5068 property: 'abcd'
5069 }
5070 }],
5071 delta: {
5072 _t: 'a',
5073 2: {
5074 inner: {
5075 property: ['abc', 'abcd']
5076 }
5077 },
5078 _2: ['', 1, 3]
5079 },
5080 reverse: {
5081 _t: 'a',
5082 1: {
5083 inner: {
5084 property: ['abcd', 'abc']
5085 }
5086 },
5087 _2: ['', 1, 3]
5088 },
5089 exactReverse: false
5090}, {
5091 name: 'nested change with item moved right below',
5092 options: {
5093 objectHash: function objectHash(obj) {
5094 if (obj && obj.id) {
5095 return obj.id;
5096 }
5097 }
5098 },
5099 left: [{
5100 id: 1
5101 }, {
5102 id: 2
5103 }, {
5104 id: 3,
5105 inner: {
5106 property: 'abc'
5107 }
5108 }, {
5109 id: 4
5110 }],
5111 right: [{
5112 id: 2
5113 }, {
5114 id: 3,
5115 inner: {
5116 property: 'abcd'
5117 }
5118 }, {
5119 id: 1
5120 }, {
5121 id: 4
5122 }],
5123 delta: {
5124 _t: 'a',
5125 1: {
5126 inner: {
5127 property: ['abc', 'abcd']
5128 }
5129 },
5130 _0: ['', 2, 3]
5131 },
5132 reverse: {
5133 _t: 'a',
5134 2: {
5135 inner: {
5136 property: ['abcd', 'abc']
5137 }
5138 },
5139 _2: ['', 0, 3]
5140 }
5141}, {
5142 name: 'nested with movements using custom objectHash',
5143 options: {
5144 objectHash: function objectHash(obj) {
5145 if (obj && obj.itemKey) {
5146 return obj.itemKey;
5147 }
5148 }
5149 },
5150 left: [1, 2, 4, {
5151 itemKey: 'five',
5152 width: 4
5153 }, 6, 7, 8, {
5154 itemKey: 4,
5155 width: 10,
5156 height: 3
5157 }, 9, 10],
5158 right: [1, 2, {
5159 itemKey: 4,
5160 width: 12
5161 }, 4, {
5162 itemKey: 'five',
5163 width: 4
5164 }, 6, 7, 8, 9, 10],
5165 delta: {
5166 _t: 'a',
5167 2: {
5168 width: [10, 12],
5169 height: [3, 0, 0]
5170 },
5171 _7: ['', 2, 3]
5172 },
5173 reverse: {
5174 _t: 'a',
5175 7: {
5176 width: [12, 10],
5177 height: [3]
5178 },
5179 _2: ['', 7, 3]
5180 }
5181}, {
5182 name: 'using property filter',
5183 options: {
5184 propertyFilter: function propertyFilter(name /*, context */) {
5185 return name.slice(0, 1) !== '$';
5186 }
5187 },
5188 left: {
5189 inner: {
5190 $volatileData: 345,
5191 $oldVolatileData: 422,
5192 nonVolatile: 432
5193 }
5194 },
5195 right: {
5196 inner: {
5197 $volatileData: 346,
5198 $newVolatileData: 32,
5199 nonVolatile: 431
5200 }
5201 },
5202 delta: {
5203 inner: {
5204 nonVolatile: [432, 431]
5205 }
5206 },
5207 reverse: {
5208 inner: {
5209 nonVolatile: [431, 432]
5210 }
5211 },
5212 noPatch: true
5213}, 0];
5214
5215/*!
5216 * assertion-error
5217 * Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
5218 * MIT Licensed
5219 */
5220
5221/*!
5222 * Return a function that will copy properties from
5223 * one object to another excluding any originally
5224 * listed. Returned function will create a new `{}`.
5225 *
5226 * @param {String} excluded properties ...
5227 * @return {Function}
5228 */
5229
5230function exclude () {
5231 var excludes = [].slice.call(arguments);
5232
5233 function excludeProps (res, obj) {
5234 Object.keys(obj).forEach(function (key) {
5235 if (!~excludes.indexOf(key)) res[key] = obj[key];
5236 });
5237 }
5238
5239 return function extendExclude () {
5240 var args = [].slice.call(arguments)
5241 , i = 0
5242 , res = {};
5243
5244 for (; i < args.length; i++) {
5245 excludeProps(res, args[i]);
5246 }
5247
5248 return res;
5249 };
5250}
5251
5252/*!
5253 * Primary Exports
5254 */
5255
5256var assertionError = AssertionError;
5257
5258/**
5259 * ### AssertionError
5260 *
5261 * An extension of the JavaScript `Error` constructor for
5262 * assertion and validation scenarios.
5263 *
5264 * @param {String} message
5265 * @param {Object} properties to include (optional)
5266 * @param {callee} start stack function (optional)
5267 */
5268
5269function AssertionError (message, _props, ssf) {
5270 var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')
5271 , props = extend(_props || {});
5272
5273 // default values
5274 this.message = message || 'Unspecified AssertionError';
5275 this.showDiff = false;
5276
5277 // copy from properties
5278 for (var key in props) {
5279 this[key] = props[key];
5280 }
5281
5282 // capture stack trace
5283 ssf = ssf || AssertionError;
5284 if (Error.captureStackTrace) {
5285 Error.captureStackTrace(this, ssf);
5286 } else {
5287 try {
5288 throw new Error();
5289 } catch(e) {
5290 this.stack = e.stack;
5291 }
5292 }
5293}
5294
5295/*!
5296 * Inherit from Error.prototype
5297 */
5298
5299AssertionError.prototype = Object.create(Error.prototype);
5300
5301/*!
5302 * Statically set name
5303 */
5304
5305AssertionError.prototype.name = 'AssertionError';
5306
5307/*!
5308 * Ensure correct constructor
5309 */
5310
5311AssertionError.prototype.constructor = AssertionError;
5312
5313/**
5314 * Allow errors to be converted to JSON for static transfer.
5315 *
5316 * @param {Boolean} include stack (default: `true`)
5317 * @return {Object} object that can be `JSON.stringify`
5318 */
5319
5320AssertionError.prototype.toJSON = function (stack) {
5321 var extend = exclude('constructor', 'toJSON', 'stack')
5322 , props = extend({ name: this.name }, this);
5323
5324 // include stack if exists and not turned off
5325 if (false !== stack && this.stack) {
5326 props.stack = this.stack;
5327 }
5328
5329 return props;
5330};
5331
5332/* !
5333 * Chai - pathval utility
5334 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
5335 * @see https://github.com/logicalparadox/filtr
5336 * MIT Licensed
5337 */
5338
5339/**
5340 * ### .hasProperty(object, name)
5341 *
5342 * This allows checking whether an object has own
5343 * or inherited from prototype chain named property.
5344 *
5345 * Basically does the same thing as the `in`
5346 * operator but works properly with null/undefined values
5347 * and other primitives.
5348 *
5349 * var obj = {
5350 * arr: ['a', 'b', 'c']
5351 * , str: 'Hello'
5352 * }
5353 *
5354 * The following would be the results.
5355 *
5356 * hasProperty(obj, 'str'); // true
5357 * hasProperty(obj, 'constructor'); // true
5358 * hasProperty(obj, 'bar'); // false
5359 *
5360 * hasProperty(obj.str, 'length'); // true
5361 * hasProperty(obj.str, 1); // true
5362 * hasProperty(obj.str, 5); // false
5363 *
5364 * hasProperty(obj.arr, 'length'); // true
5365 * hasProperty(obj.arr, 2); // true
5366 * hasProperty(obj.arr, 3); // false
5367 *
5368 * @param {Object} object
5369 * @param {String|Symbol} name
5370 * @returns {Boolean} whether it exists
5371 * @namespace Utils
5372 * @name hasProperty
5373 * @api public
5374 */
5375
5376function hasProperty(obj, name) {
5377 if (typeof obj === 'undefined' || obj === null) {
5378 return false;
5379 }
5380
5381 // The `in` operator does not work with primitives.
5382 return name in Object(obj);
5383}
5384
5385/* !
5386 * ## parsePath(path)
5387 *
5388 * Helper function used to parse string object
5389 * paths. Use in conjunction with `internalGetPathValue`.
5390 *
5391 * var parsed = parsePath('myobject.property.subprop');
5392 *
5393 * ### Paths:
5394 *
5395 * * Can be infinitely deep and nested.
5396 * * Arrays are also valid using the formal `myobject.document[3].property`.
5397 * * Literal dots and brackets (not delimiter) must be backslash-escaped.
5398 *
5399 * @param {String} path
5400 * @returns {Object} parsed
5401 * @api private
5402 */
5403
5404function parsePath(path) {
5405 var str = path.replace(/([^\\])\[/g, '$1.[');
5406 var parts = str.match(/(\\\.|[^.]+?)+/g);
5407 return parts.map(function mapMatches(value) {
5408 var regexp = /^\[(\d+)\]$/;
5409 var mArr = regexp.exec(value);
5410 var parsed = null;
5411 if (mArr) {
5412 parsed = { i: parseFloat(mArr[1]) };
5413 } else {
5414 parsed = { p: value.replace(/\\([.\[\]])/g, '$1') };
5415 }
5416
5417 return parsed;
5418 });
5419}
5420
5421/* !
5422 * ## internalGetPathValue(obj, parsed[, pathDepth])
5423 *
5424 * Helper companion function for `.parsePath` that returns
5425 * the value located at the parsed address.
5426 *
5427 * var value = getPathValue(obj, parsed);
5428 *
5429 * @param {Object} object to search against
5430 * @param {Object} parsed definition from `parsePath`.
5431 * @param {Number} depth (nesting level) of the property we want to retrieve
5432 * @returns {Object|Undefined} value
5433 * @api private
5434 */
5435
5436function internalGetPathValue(obj, parsed, pathDepth) {
5437 var temporaryValue = obj;
5438 var res = null;
5439 pathDepth = (typeof pathDepth === 'undefined' ? parsed.length : pathDepth);
5440
5441 for (var i = 0; i < pathDepth; i++) {
5442 var part = parsed[i];
5443 if (temporaryValue) {
5444 if (typeof part.p === 'undefined') {
5445 temporaryValue = temporaryValue[part.i];
5446 } else {
5447 temporaryValue = temporaryValue[part.p];
5448 }
5449
5450 if (i === (pathDepth - 1)) {
5451 res = temporaryValue;
5452 }
5453 }
5454 }
5455
5456 return res;
5457}
5458
5459/* !
5460 * ## internalSetPathValue(obj, value, parsed)
5461 *
5462 * Companion function for `parsePath` that sets
5463 * the value located at a parsed address.
5464 *
5465 * internalSetPathValue(obj, 'value', parsed);
5466 *
5467 * @param {Object} object to search and define on
5468 * @param {*} value to use upon set
5469 * @param {Object} parsed definition from `parsePath`
5470 * @api private
5471 */
5472
5473function internalSetPathValue(obj, val, parsed) {
5474 var tempObj = obj;
5475 var pathDepth = parsed.length;
5476 var part = null;
5477 // Here we iterate through every part of the path
5478 for (var i = 0; i < pathDepth; i++) {
5479 var propName = null;
5480 var propVal = null;
5481 part = parsed[i];
5482
5483 // If it's the last part of the path, we set the 'propName' value with the property name
5484 if (i === (pathDepth - 1)) {
5485 propName = typeof part.p === 'undefined' ? part.i : part.p;
5486 // Now we set the property with the name held by 'propName' on object with the desired val
5487 tempObj[propName] = val;
5488 } else if (typeof part.p !== 'undefined' && tempObj[part.p]) {
5489 tempObj = tempObj[part.p];
5490 } else if (typeof part.i !== 'undefined' && tempObj[part.i]) {
5491 tempObj = tempObj[part.i];
5492 } else {
5493 // If the obj doesn't have the property we create one with that name to define it
5494 var next = parsed[i + 1];
5495 // Here we set the name of the property which will be defined
5496 propName = typeof part.p === 'undefined' ? part.i : part.p;
5497 // Here we decide if this property will be an array or a new object
5498 propVal = typeof next.p === 'undefined' ? [] : {};
5499 tempObj[propName] = propVal;
5500 tempObj = tempObj[propName];
5501 }
5502 }
5503}
5504
5505/**
5506 * ### .getPathInfo(object, path)
5507 *
5508 * This allows the retrieval of property info in an
5509 * object given a string path.
5510 *
5511 * The path info consists of an object with the
5512 * following properties:
5513 *
5514 * * parent - The parent object of the property referenced by `path`
5515 * * name - The name of the final property, a number if it was an array indexer
5516 * * value - The value of the property, if it exists, otherwise `undefined`
5517 * * exists - Whether the property exists or not
5518 *
5519 * @param {Object} object
5520 * @param {String} path
5521 * @returns {Object} info
5522 * @namespace Utils
5523 * @name getPathInfo
5524 * @api public
5525 */
5526
5527function getPathInfo(obj, path) {
5528 var parsed = parsePath(path);
5529 var last = parsed[parsed.length - 1];
5530 var info = {
5531 parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,
5532 name: last.p || last.i,
5533 value: internalGetPathValue(obj, parsed),
5534 };
5535 info.exists = hasProperty(info.parent, info.name);
5536
5537 return info;
5538}
5539
5540/**
5541 * ### .getPathValue(object, path)
5542 *
5543 * This allows the retrieval of values in an
5544 * object given a string path.
5545 *
5546 * var obj = {
5547 * prop1: {
5548 * arr: ['a', 'b', 'c']
5549 * , str: 'Hello'
5550 * }
5551 * , prop2: {
5552 * arr: [ { nested: 'Universe' } ]
5553 * , str: 'Hello again!'
5554 * }
5555 * }
5556 *
5557 * The following would be the results.
5558 *
5559 * getPathValue(obj, 'prop1.str'); // Hello
5560 * getPathValue(obj, 'prop1.att[2]'); // b
5561 * getPathValue(obj, 'prop2.arr[0].nested'); // Universe
5562 *
5563 * @param {Object} object
5564 * @param {String} path
5565 * @returns {Object} value or `undefined`
5566 * @namespace Utils
5567 * @name getPathValue
5568 * @api public
5569 */
5570
5571function getPathValue(obj, path) {
5572 var info = getPathInfo(obj, path);
5573 return info.value;
5574}
5575
5576/**
5577 * ### .setPathValue(object, path, value)
5578 *
5579 * Define the value in an object at a given string path.
5580 *
5581 * ```js
5582 * var obj = {
5583 * prop1: {
5584 * arr: ['a', 'b', 'c']
5585 * , str: 'Hello'
5586 * }
5587 * , prop2: {
5588 * arr: [ { nested: 'Universe' } ]
5589 * , str: 'Hello again!'
5590 * }
5591 * };
5592 * ```
5593 *
5594 * The following would be acceptable.
5595 *
5596 * ```js
5597 * var properties = require('tea-properties');
5598 * properties.set(obj, 'prop1.str', 'Hello Universe!');
5599 * properties.set(obj, 'prop1.arr[2]', 'B');
5600 * properties.set(obj, 'prop2.arr[0].nested.value', { hello: 'universe' });
5601 * ```
5602 *
5603 * @param {Object} object
5604 * @param {String} path
5605 * @param {Mixed} value
5606 * @api private
5607 */
5608
5609function setPathValue(obj, path, val) {
5610 var parsed = parsePath(path);
5611 internalSetPathValue(obj, val, parsed);
5612 return obj;
5613}
5614
5615var pathval = {
5616 hasProperty: hasProperty,
5617 getPathInfo: getPathInfo,
5618 getPathValue: getPathValue,
5619 setPathValue: setPathValue,
5620};
5621
5622/*!
5623 * Chai - flag utility
5624 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
5625 * MIT Licensed
5626 */
5627
5628/**
5629 * ### .flag(object, key, [value])
5630 *
5631 * Get or set a flag value on an object. If a
5632 * value is provided it will be set, else it will
5633 * return the currently set value or `undefined` if
5634 * the value is not set.
5635 *
5636 * utils.flag(this, 'foo', 'bar'); // setter
5637 * utils.flag(this, 'foo'); // getter, returns `bar`
5638 *
5639 * @param {Object} object constructed Assertion
5640 * @param {String} key
5641 * @param {Mixed} value (optional)
5642 * @namespace Utils
5643 * @name flag
5644 * @api private
5645 */
5646
5647var flag = function flag(obj, key, value) {
5648 var flags = obj.__flags || (obj.__flags = Object.create(null));
5649 if (arguments.length === 3) {
5650 flags[key] = value;
5651 } else {
5652 return flags[key];
5653 }
5654};
5655
5656/*!
5657 * Chai - test utility
5658 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
5659 * MIT Licensed
5660 */
5661
5662/*!
5663 * Module dependancies
5664 */
5665
5666
5667
5668/**
5669 * ### .test(object, expression)
5670 *
5671 * Test and object for expression.
5672 *
5673 * @param {Object} object (constructed Assertion)
5674 * @param {Arguments} chai.Assertion.prototype.assert arguments
5675 * @namespace Utils
5676 * @name test
5677 */
5678
5679var test = function test(obj, args) {
5680 var negate = flag(obj, 'negate')
5681 , expr = args[0];
5682 return negate ? !expr : expr;
5683};
5684
5685var typeDetect = createCommonjsModule(function (module, exports) {
5686(function (global, factory) {
5687 module.exports = factory();
5688}(commonjsGlobal, (function () { var promiseExists = typeof Promise === 'function';
5689
5690/* eslint-disable no-undef */
5691var globalObject = typeof self === 'object' ? self : commonjsGlobal; // eslint-disable-line id-blacklist
5692
5693var symbolExists = typeof Symbol !== 'undefined';
5694var mapExists = typeof Map !== 'undefined';
5695var setExists = typeof Set !== 'undefined';
5696var weakMapExists = typeof WeakMap !== 'undefined';
5697var weakSetExists = typeof WeakSet !== 'undefined';
5698var dataViewExists = typeof DataView !== 'undefined';
5699var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
5700var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
5701var setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
5702var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
5703var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
5704var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
5705var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
5706var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
5707var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
5708var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
5709var toStringLeftSliceLength = 8;
5710var toStringRightSliceLength = -1;
5711/**
5712 * ### typeOf (obj)
5713 *
5714 * Uses `Object.prototype.toString` to determine the type of an object,
5715 * normalising behaviour across engine versions & well optimised.
5716 *
5717 * @param {Mixed} object
5718 * @return {String} object type
5719 * @api public
5720 */
5721function typeDetect(obj) {
5722 /* ! Speed optimisation
5723 * Pre:
5724 * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)
5725 * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)
5726 * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)
5727 * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)
5728 * function x 2,556,769 ops/sec ±1.73% (77 runs sampled)
5729 * Post:
5730 * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)
5731 * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)
5732 * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)
5733 * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)
5734 * function x 31,296,870 ops/sec ±0.96% (83 runs sampled)
5735 */
5736 var typeofObj = typeof obj;
5737 if (typeofObj !== 'object') {
5738 return typeofObj;
5739 }
5740
5741 /* ! Speed optimisation
5742 * Pre:
5743 * null x 28,645,765 ops/sec ±1.17% (82 runs sampled)
5744 * Post:
5745 * null x 36,428,962 ops/sec ±1.37% (84 runs sampled)
5746 */
5747 if (obj === null) {
5748 return 'null';
5749 }
5750
5751 /* ! Spec Conformance
5752 * Test: `Object.prototype.toString.call(window)``
5753 * - Node === "[object global]"
5754 * - Chrome === "[object global]"
5755 * - Firefox === "[object Window]"
5756 * - PhantomJS === "[object Window]"
5757 * - Safari === "[object Window]"
5758 * - IE 11 === "[object Window]"
5759 * - IE Edge === "[object Window]"
5760 * Test: `Object.prototype.toString.call(this)``
5761 * - Chrome Worker === "[object global]"
5762 * - Firefox Worker === "[object DedicatedWorkerGlobalScope]"
5763 * - Safari Worker === "[object DedicatedWorkerGlobalScope]"
5764 * - IE 11 Worker === "[object WorkerGlobalScope]"
5765 * - IE Edge Worker === "[object WorkerGlobalScope]"
5766 */
5767 if (obj === globalObject) {
5768 return 'global';
5769 }
5770
5771 /* ! Speed optimisation
5772 * Pre:
5773 * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)
5774 * Post:
5775 * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
5776 */
5777 if (
5778 Array.isArray(obj) &&
5779 (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))
5780 ) {
5781 return 'Array';
5782 }
5783
5784 // Not caching existence of `window` and related properties due to potential
5785 // for `window` to be unset before tests in quasi-browser environments.
5786 if (typeof window === 'object') {
5787 /* ! Spec Conformance
5788 * (https://html.spec.whatwg.org/multipage/browsers.html#location)
5789 * WhatWG HTML$7.7.3 - The `Location` interface
5790 * Test: `Object.prototype.toString.call(window.location)``
5791 * - IE <=11 === "[object Object]"
5792 * - IE Edge <=13 === "[object Object]"
5793 */
5794 if (typeof window.location === 'object' && obj === window.location) {
5795 return 'Location';
5796 }
5797
5798 /* ! Spec Conformance
5799 * (https://html.spec.whatwg.org/#document)
5800 * WhatWG HTML$3.1.1 - The `Document` object
5801 * Note: Most browsers currently adher to the W3C DOM Level 2 spec
5802 * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268)
5803 * which suggests that browsers should use HTMLTableCellElement for
5804 * both TD and TH elements. WhatWG separates these.
5805 * WhatWG HTML states:
5806 * > For historical reasons, Window objects must also have a
5807 * > writable, configurable, non-enumerable property named
5808 * > HTMLDocument whose value is the Document interface object.
5809 * Test: `Object.prototype.toString.call(document)``
5810 * - Chrome === "[object HTMLDocument]"
5811 * - Firefox === "[object HTMLDocument]"
5812 * - Safari === "[object HTMLDocument]"
5813 * - IE <=10 === "[object Document]"
5814 * - IE 11 === "[object HTMLDocument]"
5815 * - IE Edge <=13 === "[object HTMLDocument]"
5816 */
5817 if (typeof window.document === 'object' && obj === window.document) {
5818 return 'Document';
5819 }
5820
5821 if (typeof window.navigator === 'object') {
5822 /* ! Spec Conformance
5823 * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray)
5824 * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray
5825 * Test: `Object.prototype.toString.call(navigator.mimeTypes)``
5826 * - IE <=10 === "[object MSMimeTypesCollection]"
5827 */
5828 if (typeof window.navigator.mimeTypes === 'object' &&
5829 obj === window.navigator.mimeTypes) {
5830 return 'MimeTypeArray';
5831 }
5832
5833 /* ! Spec Conformance
5834 * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
5835 * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray
5836 * Test: `Object.prototype.toString.call(navigator.plugins)``
5837 * - IE <=10 === "[object MSPluginsCollection]"
5838 */
5839 if (typeof window.navigator.plugins === 'object' &&
5840 obj === window.navigator.plugins) {
5841 return 'PluginArray';
5842 }
5843 }
5844
5845 if ((typeof window.HTMLElement === 'function' ||
5846 typeof window.HTMLElement === 'object') &&
5847 obj instanceof window.HTMLElement) {
5848 /* ! Spec Conformance
5849 * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
5850 * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement`
5851 * Test: `Object.prototype.toString.call(document.createElement('blockquote'))``
5852 * - IE <=10 === "[object HTMLBlockElement]"
5853 */
5854 if (obj.tagName === 'BLOCKQUOTE') {
5855 return 'HTMLQuoteElement';
5856 }
5857
5858 /* ! Spec Conformance
5859 * (https://html.spec.whatwg.org/#htmltabledatacellelement)
5860 * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`
5861 * Note: Most browsers currently adher to the W3C DOM Level 2 spec
5862 * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
5863 * which suggests that browsers should use HTMLTableCellElement for
5864 * both TD and TH elements. WhatWG separates these.
5865 * Test: Object.prototype.toString.call(document.createElement('td'))
5866 * - Chrome === "[object HTMLTableCellElement]"
5867 * - Firefox === "[object HTMLTableCellElement]"
5868 * - Safari === "[object HTMLTableCellElement]"
5869 */
5870 if (obj.tagName === 'TD') {
5871 return 'HTMLTableDataCellElement';
5872 }
5873
5874 /* ! Spec Conformance
5875 * (https://html.spec.whatwg.org/#htmltableheadercellelement)
5876 * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`
5877 * Note: Most browsers currently adher to the W3C DOM Level 2 spec
5878 * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
5879 * which suggests that browsers should use HTMLTableCellElement for
5880 * both TD and TH elements. WhatWG separates these.
5881 * Test: Object.prototype.toString.call(document.createElement('th'))
5882 * - Chrome === "[object HTMLTableCellElement]"
5883 * - Firefox === "[object HTMLTableCellElement]"
5884 * - Safari === "[object HTMLTableCellElement]"
5885 */
5886 if (obj.tagName === 'TH') {
5887 return 'HTMLTableHeaderCellElement';
5888 }
5889 }
5890 }
5891
5892 /* ! Speed optimisation
5893 * Pre:
5894 * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)
5895 * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)
5896 * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)
5897 * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)
5898 * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)
5899 * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)
5900 * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)
5901 * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)
5902 * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)
5903 * Post:
5904 * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)
5905 * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)
5906 * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)
5907 * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)
5908 * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)
5909 * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)
5910 * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)
5911 * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)
5912 * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)
5913 */
5914 var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);
5915 if (typeof stringTag === 'string') {
5916 return stringTag;
5917 }
5918
5919 var objPrototype = Object.getPrototypeOf(obj);
5920 /* ! Speed optimisation
5921 * Pre:
5922 * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled)
5923 * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled)
5924 * Post:
5925 * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled)
5926 * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled)
5927 */
5928 if (objPrototype === RegExp.prototype) {
5929 return 'RegExp';
5930 }
5931
5932 /* ! Speed optimisation
5933 * Pre:
5934 * date x 2,130,074 ops/sec ±4.42% (68 runs sampled)
5935 * Post:
5936 * date x 3,953,779 ops/sec ±1.35% (77 runs sampled)
5937 */
5938 if (objPrototype === Date.prototype) {
5939 return 'Date';
5940 }
5941
5942 /* ! Spec Conformance
5943 * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag)
5944 * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise":
5945 * Test: `Object.prototype.toString.call(Promise.resolve())``
5946 * - Chrome <=47 === "[object Object]"
5947 * - Edge <=20 === "[object Object]"
5948 * - Firefox 29-Latest === "[object Promise]"
5949 * - Safari 7.1-Latest === "[object Promise]"
5950 */
5951 if (promiseExists && objPrototype === Promise.prototype) {
5952 return 'Promise';
5953 }
5954
5955 /* ! Speed optimisation
5956 * Pre:
5957 * set x 2,222,186 ops/sec ±1.31% (82 runs sampled)
5958 * Post:
5959 * set x 4,545,879 ops/sec ±1.13% (83 runs sampled)
5960 */
5961 if (setExists && objPrototype === Set.prototype) {
5962 return 'Set';
5963 }
5964
5965 /* ! Speed optimisation
5966 * Pre:
5967 * map x 2,396,842 ops/sec ±1.59% (81 runs sampled)
5968 * Post:
5969 * map x 4,183,945 ops/sec ±6.59% (82 runs sampled)
5970 */
5971 if (mapExists && objPrototype === Map.prototype) {
5972 return 'Map';
5973 }
5974
5975 /* ! Speed optimisation
5976 * Pre:
5977 * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled)
5978 * Post:
5979 * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled)
5980 */
5981 if (weakSetExists && objPrototype === WeakSet.prototype) {
5982 return 'WeakSet';
5983 }
5984
5985 /* ! Speed optimisation
5986 * Pre:
5987 * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled)
5988 * Post:
5989 * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled)
5990 */
5991 if (weakMapExists && objPrototype === WeakMap.prototype) {
5992 return 'WeakMap';
5993 }
5994
5995 /* ! Spec Conformance
5996 * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag)
5997 * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView":
5998 * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))``
5999 * - Edge <=13 === "[object Object]"
6000 */
6001 if (dataViewExists && objPrototype === DataView.prototype) {
6002 return 'DataView';
6003 }
6004
6005 /* ! Spec Conformance
6006 * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag)
6007 * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator":
6008 * Test: `Object.prototype.toString.call(new Map().entries())``
6009 * - Edge <=13 === "[object Object]"
6010 */
6011 if (mapExists && objPrototype === mapIteratorPrototype) {
6012 return 'Map Iterator';
6013 }
6014
6015 /* ! Spec Conformance
6016 * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag)
6017 * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator":
6018 * Test: `Object.prototype.toString.call(new Set().entries())``
6019 * - Edge <=13 === "[object Object]"
6020 */
6021 if (setExists && objPrototype === setIteratorPrototype) {
6022 return 'Set Iterator';
6023 }
6024
6025 /* ! Spec Conformance
6026 * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag)
6027 * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator":
6028 * Test: `Object.prototype.toString.call([][Symbol.iterator]())``
6029 * - Edge <=13 === "[object Object]"
6030 */
6031 if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
6032 return 'Array Iterator';
6033 }
6034
6035 /* ! Spec Conformance
6036 * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag)
6037 * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator":
6038 * Test: `Object.prototype.toString.call(''[Symbol.iterator]())``
6039 * - Edge <=13 === "[object Object]"
6040 */
6041 if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
6042 return 'String Iterator';
6043 }
6044
6045 /* ! Speed optimisation
6046 * Pre:
6047 * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled)
6048 * Post:
6049 * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled)
6050 */
6051 if (objPrototype === null) {
6052 return 'Object';
6053 }
6054
6055 return Object
6056 .prototype
6057 .toString
6058 .call(obj)
6059 .slice(toStringLeftSliceLength, toStringRightSliceLength);
6060}
6061
6062return typeDetect;
6063
6064})));
6065});
6066
6067/*!
6068 * Chai - expectTypes utility
6069 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
6070 * MIT Licensed
6071 */
6072
6073/**
6074 * ### .expectTypes(obj, types)
6075 *
6076 * Ensures that the object being tested against is of a valid type.
6077 *
6078 * utils.expectTypes(this, ['array', 'object', 'string']);
6079 *
6080 * @param {Mixed} obj constructed Assertion
6081 * @param {Array} type A list of allowed types for this assertion
6082 * @namespace Utils
6083 * @name expectTypes
6084 * @api public
6085 */
6086
6087
6088
6089
6090
6091var expectTypes = function expectTypes(obj, types) {
6092 var flagMsg = flag(obj, 'message');
6093 var ssfi = flag(obj, 'ssfi');
6094
6095 flagMsg = flagMsg ? flagMsg + ': ' : '';
6096
6097 obj = flag(obj, 'object');
6098 types = types.map(function (t) { return t.toLowerCase(); });
6099 types.sort();
6100
6101 // Transforms ['lorem', 'ipsum'] into 'a lorem, or an ipsum'
6102 var str = types.map(function (t, index) {
6103 var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a';
6104 var or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
6105 return or + art + ' ' + t;
6106 }).join(', ');
6107
6108 var objType = typeDetect(obj).toLowerCase();
6109
6110 if (!types.some(function (expected) { return objType === expected; })) {
6111 throw new assertionError(
6112 flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given',
6113 undefined,
6114 ssfi
6115 );
6116 }
6117};
6118
6119/*!
6120 * Chai - getActual utility
6121 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
6122 * MIT Licensed
6123 */
6124
6125/**
6126 * ### .getActual(object, [actual])
6127 *
6128 * Returns the `actual` value for an Assertion.
6129 *
6130 * @param {Object} object (constructed Assertion)
6131 * @param {Arguments} chai.Assertion.prototype.assert arguments
6132 * @namespace Utils
6133 * @name getActual
6134 */
6135
6136var getActual = function getActual(obj, args) {
6137 return args.length > 4 ? args[4] : obj._obj;
6138};
6139
6140/* !
6141 * Chai - getFuncName utility
6142 * Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com>
6143 * MIT Licensed
6144 */
6145
6146/**
6147 * ### .getFuncName(constructorFn)
6148 *
6149 * Returns the name of a function.
6150 * When a non-function instance is passed, returns `null`.
6151 * This also includes a polyfill function if `aFunc.name` is not defined.
6152 *
6153 * @name getFuncName
6154 * @param {Function} funct
6155 * @namespace Utils
6156 * @api public
6157 */
6158
6159var toString = Function.prototype.toString;
6160var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
6161function getFuncName(aFunc) {
6162 if (typeof aFunc !== 'function') {
6163 return null;
6164 }
6165
6166 var name = '';
6167 if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') {
6168 // Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined
6169 var match = toString.call(aFunc).match(functionNameMatch);
6170 if (match) {
6171 name = match[1];
6172 }
6173 } else {
6174 // If we've got a `name` property we just use it
6175 name = aFunc.name;
6176 }
6177
6178 return name;
6179}
6180
6181var getFuncName_1 = getFuncName;
6182
6183/*!
6184 * Chai - getProperties utility
6185 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
6186 * MIT Licensed
6187 */
6188
6189/**
6190 * ### .getProperties(object)
6191 *
6192 * This allows the retrieval of property names of an object, enumerable or not,
6193 * inherited or not.
6194 *
6195 * @param {Object} object
6196 * @returns {Array}
6197 * @namespace Utils
6198 * @name getProperties
6199 * @api public
6200 */
6201
6202var getProperties = function getProperties(object) {
6203 var result = Object.getOwnPropertyNames(object);
6204
6205 function addProperty(property) {
6206 if (result.indexOf(property) === -1) {
6207 result.push(property);
6208 }
6209 }
6210
6211 var proto = Object.getPrototypeOf(object);
6212 while (proto !== null) {
6213 Object.getOwnPropertyNames(proto).forEach(addProperty);
6214 proto = Object.getPrototypeOf(proto);
6215 }
6216
6217 return result;
6218};
6219
6220/*!
6221 * Chai - getEnumerableProperties utility
6222 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
6223 * MIT Licensed
6224 */
6225
6226/**
6227 * ### .getEnumerableProperties(object)
6228 *
6229 * This allows the retrieval of enumerable property names of an object,
6230 * inherited or not.
6231 *
6232 * @param {Object} object
6233 * @returns {Array}
6234 * @namespace Utils
6235 * @name getEnumerableProperties
6236 * @api public
6237 */
6238
6239var getEnumerableProperties = function getEnumerableProperties(object) {
6240 var result = [];
6241 for (var name in object) {
6242 result.push(name);
6243 }
6244 return result;
6245};
6246
6247var config = {
6248
6249 /**
6250 * ### config.includeStack
6251 *
6252 * User configurable property, influences whether stack trace
6253 * is included in Assertion error message. Default of false
6254 * suppresses stack trace in the error message.
6255 *
6256 * chai.config.includeStack = true; // enable stack on error
6257 *
6258 * @param {Boolean}
6259 * @api public
6260 */
6261
6262 includeStack: false,
6263
6264 /**
6265 * ### config.showDiff
6266 *
6267 * User configurable property, influences whether or not
6268 * the `showDiff` flag should be included in the thrown
6269 * AssertionErrors. `false` will always be `false`; `true`
6270 * will be true when the assertion has requested a diff
6271 * be shown.
6272 *
6273 * @param {Boolean}
6274 * @api public
6275 */
6276
6277 showDiff: true,
6278
6279 /**
6280 * ### config.truncateThreshold
6281 *
6282 * User configurable property, sets length threshold for actual and
6283 * expected values in assertion errors. If this threshold is exceeded, for
6284 * example for large data structures, the value is replaced with something
6285 * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.
6286 *
6287 * Set it to zero if you want to disable truncating altogether.
6288 *
6289 * This is especially userful when doing assertions on arrays: having this
6290 * set to a reasonable large value makes the failure messages readily
6291 * inspectable.
6292 *
6293 * chai.config.truncateThreshold = 0; // disable truncating
6294 *
6295 * @param {Number}
6296 * @api public
6297 */
6298
6299 truncateThreshold: 40,
6300
6301 /**
6302 * ### config.useProxy
6303 *
6304 * User configurable property, defines if chai will use a Proxy to throw
6305 * an error when a non-existent property is read, which protects users
6306 * from typos when using property-based assertions.
6307 *
6308 * Set it to false if you want to disable this feature.
6309 *
6310 * chai.config.useProxy = false; // disable use of Proxy
6311 *
6312 * This feature is automatically disabled regardless of this config value
6313 * in environments that don't support proxies.
6314 *
6315 * @param {Boolean}
6316 * @api public
6317 */
6318
6319 useProxy: true,
6320
6321 /**
6322 * ### config.proxyExcludedKeys
6323 *
6324 * User configurable property, defines which properties should be ignored
6325 * instead of throwing an error if they do not exist on the assertion.
6326 * This is only applied if the environment Chai is running in supports proxies and
6327 * if the `useProxy` configuration setting is enabled.
6328 * By default, `then` and `inspect` will not throw an error if they do not exist on the
6329 * assertion object because the `.inspect` property is read by `util.inspect` (for example, when
6330 * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.
6331 *
6332 * // By default these keys will not throw an error if they do not exist on the assertion object
6333 * chai.config.proxyExcludedKeys = ['then', 'inspect'];
6334 *
6335 * @param {Array}
6336 * @api public
6337 */
6338
6339 proxyExcludedKeys: ['then', 'inspect', 'toJSON']
6340};
6341
6342var inspect_1 = createCommonjsModule(function (module, exports) {
6343// This is (almost) directly from Node.js utils
6344// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
6345
6346
6347
6348
6349
6350
6351module.exports = inspect;
6352
6353/**
6354 * ### .inspect(obj, [showHidden], [depth], [colors])
6355 *
6356 * Echoes the value of a value. Tries to print the value out
6357 * in the best way possible given the different types.
6358 *
6359 * @param {Object} obj The object to print out.
6360 * @param {Boolean} showHidden Flag that shows hidden (not enumerable)
6361 * properties of objects. Default is false.
6362 * @param {Number} depth Depth in which to descend in object. Default is 2.
6363 * @param {Boolean} colors Flag to turn on ANSI escape codes to color the
6364 * output. Default is false (no coloring).
6365 * @namespace Utils
6366 * @name inspect
6367 */
6368function inspect(obj, showHidden, depth, colors) {
6369 var ctx = {
6370 showHidden: showHidden,
6371 seen: [],
6372 stylize: function (str) { return str; }
6373 };
6374 return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth));
6375}
6376
6377// Returns true if object is a DOM element.
6378var isDOMElement = function (object) {
6379 if (typeof HTMLElement === 'object') {
6380 return object instanceof HTMLElement;
6381 } else {
6382 return object &&
6383 typeof object === 'object' &&
6384 'nodeType' in object &&
6385 object.nodeType === 1 &&
6386 typeof object.nodeName === 'string';
6387 }
6388};
6389
6390function formatValue(ctx, value, recurseTimes) {
6391 // Provide a hook for user-specified inspect functions.
6392 // Check that value is an object with an inspect function on it
6393 if (value && typeof value.inspect === 'function' &&
6394 // Filter out the util module, it's inspect function is special
6395 value.inspect !== exports.inspect &&
6396 // Also filter out any prototype objects using the circular check.
6397 !(value.constructor && value.constructor.prototype === value)) {
6398 var ret = value.inspect(recurseTimes, ctx);
6399 if (typeof ret !== 'string') {
6400 ret = formatValue(ctx, ret, recurseTimes);
6401 }
6402 return ret;
6403 }
6404
6405 // Primitive types cannot have properties
6406 var primitive = formatPrimitive(ctx, value);
6407 if (primitive) {
6408 return primitive;
6409 }
6410
6411 // If this is a DOM element, try to get the outer HTML.
6412 if (isDOMElement(value)) {
6413 if ('outerHTML' in value) {
6414 return value.outerHTML;
6415 // This value does not have an outerHTML attribute,
6416 // it could still be an XML element
6417 } else {
6418 // Attempt to serialize it
6419 try {
6420 if (document.xmlVersion) {
6421 var xmlSerializer = new XMLSerializer();
6422 return xmlSerializer.serializeToString(value);
6423 } else {
6424 // Firefox 11- do not support outerHTML
6425 // It does, however, support innerHTML
6426 // Use the following to render the element
6427 var ns = "http://www.w3.org/1999/xhtml";
6428 var container = document.createElementNS(ns, '_');
6429
6430 container.appendChild(value.cloneNode(false));
6431 var html = container.innerHTML
6432 .replace('><', '>' + value.innerHTML + '<');
6433 container.innerHTML = '';
6434 return html;
6435 }
6436 } catch (err) {
6437 // This could be a non-native DOM implementation,
6438 // continue with the normal flow:
6439 // printing the element as if it is an object.
6440 }
6441 }
6442 }
6443
6444 // Look up the keys of the object.
6445 var visibleKeys = getEnumerableProperties(value);
6446 var keys = ctx.showHidden ? getProperties(value) : visibleKeys;
6447
6448 var name, nameSuffix;
6449
6450 // Some type of object without properties can be shortcutted.
6451 // In IE, errors have a single `stack` property, or if they are vanilla `Error`,
6452 // a `stack` plus `description` property; ignore those for consistency.
6453 if (keys.length === 0 || (isError(value) && (
6454 (keys.length === 1 && keys[0] === 'stack') ||
6455 (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack')
6456 ))) {
6457 if (typeof value === 'function') {
6458 name = getFuncName_1(value);
6459 nameSuffix = name ? ': ' + name : '';
6460 return ctx.stylize('[Function' + nameSuffix + ']', 'special');
6461 }
6462 if (isRegExp(value)) {
6463 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
6464 }
6465 if (isDate(value)) {
6466 return ctx.stylize(Date.prototype.toUTCString.call(value), 'date');
6467 }
6468 if (isError(value)) {
6469 return formatError(value);
6470 }
6471 }
6472
6473 var base = ''
6474 , array = false
6475 , typedArray = false
6476 , braces = ['{', '}'];
6477
6478 if (isTypedArray(value)) {
6479 typedArray = true;
6480 braces = ['[', ']'];
6481 }
6482
6483 // Make Array say that they are Array
6484 if (isArray(value)) {
6485 array = true;
6486 braces = ['[', ']'];
6487 }
6488
6489 // Make functions say that they are functions
6490 if (typeof value === 'function') {
6491 name = getFuncName_1(value);
6492 nameSuffix = name ? ': ' + name : '';
6493 base = ' [Function' + nameSuffix + ']';
6494 }
6495
6496 // Make RegExps say that they are RegExps
6497 if (isRegExp(value)) {
6498 base = ' ' + RegExp.prototype.toString.call(value);
6499 }
6500
6501 // Make dates with properties first say the date
6502 if (isDate(value)) {
6503 base = ' ' + Date.prototype.toUTCString.call(value);
6504 }
6505
6506 // Make error with message first say the error
6507 if (isError(value)) {
6508 return formatError(value);
6509 }
6510
6511 if (keys.length === 0 && (!array || value.length == 0)) {
6512 return braces[0] + base + braces[1];
6513 }
6514
6515 if (recurseTimes < 0) {
6516 if (isRegExp(value)) {
6517 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
6518 } else {
6519 return ctx.stylize('[Object]', 'special');
6520 }
6521 }
6522
6523 ctx.seen.push(value);
6524
6525 var output;
6526 if (array) {
6527 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
6528 } else if (typedArray) {
6529 return formatTypedArray(value);
6530 } else {
6531 output = keys.map(function(key) {
6532 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
6533 });
6534 }
6535
6536 ctx.seen.pop();
6537
6538 return reduceToSingleString(output, base, braces);
6539}
6540
6541
6542function formatPrimitive(ctx, value) {
6543 switch (typeof value) {
6544 case 'undefined':
6545 return ctx.stylize('undefined', 'undefined');
6546
6547 case 'string':
6548 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
6549 .replace(/'/g, "\\'")
6550 .replace(/\\"/g, '"') + '\'';
6551 return ctx.stylize(simple, 'string');
6552
6553 case 'number':
6554 if (value === 0 && (1/value) === -Infinity) {
6555 return ctx.stylize('-0', 'number');
6556 }
6557 return ctx.stylize('' + value, 'number');
6558
6559 case 'boolean':
6560 return ctx.stylize('' + value, 'boolean');
6561
6562 case 'symbol':
6563 return ctx.stylize(value.toString(), 'symbol');
6564 }
6565 // For some reason typeof null is "object", so special case here.
6566 if (value === null) {
6567 return ctx.stylize('null', 'null');
6568 }
6569}
6570
6571
6572function formatError(value) {
6573 return '[' + Error.prototype.toString.call(value) + ']';
6574}
6575
6576
6577function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
6578 var output = [];
6579 for (var i = 0, l = value.length; i < l; ++i) {
6580 if (Object.prototype.hasOwnProperty.call(value, String(i))) {
6581 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
6582 String(i), true));
6583 } else {
6584 output.push('');
6585 }
6586 }
6587
6588 keys.forEach(function(key) {
6589 if (!key.match(/^\d+$/)) {
6590 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
6591 key, true));
6592 }
6593 });
6594 return output;
6595}
6596
6597function formatTypedArray(value) {
6598 var str = '[ ';
6599
6600 for (var i = 0; i < value.length; ++i) {
6601 if (str.length >= config.truncateThreshold - 7) {
6602 str += '...';
6603 break;
6604 }
6605 str += value[i] + ', ';
6606 }
6607 str += ' ]';
6608
6609 // Removing trailing `, ` if the array was not truncated
6610 if (str.indexOf(', ]') !== -1) {
6611 str = str.replace(', ]', ' ]');
6612 }
6613
6614 return str;
6615}
6616
6617function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
6618 var name;
6619 var propDescriptor = Object.getOwnPropertyDescriptor(value, key);
6620 var str;
6621
6622 if (propDescriptor) {
6623 if (propDescriptor.get) {
6624 if (propDescriptor.set) {
6625 str = ctx.stylize('[Getter/Setter]', 'special');
6626 } else {
6627 str = ctx.stylize('[Getter]', 'special');
6628 }
6629 } else {
6630 if (propDescriptor.set) {
6631 str = ctx.stylize('[Setter]', 'special');
6632 }
6633 }
6634 }
6635 if (visibleKeys.indexOf(key) < 0) {
6636 name = '[' + key + ']';
6637 }
6638 if (!str) {
6639 if (ctx.seen.indexOf(value[key]) < 0) {
6640 if (recurseTimes === null) {
6641 str = formatValue(ctx, value[key], null);
6642 } else {
6643 str = formatValue(ctx, value[key], recurseTimes - 1);
6644 }
6645 if (str.indexOf('\n') > -1) {
6646 if (array) {
6647 str = str.split('\n').map(function(line) {
6648 return ' ' + line;
6649 }).join('\n').substr(2);
6650 } else {
6651 str = '\n' + str.split('\n').map(function(line) {
6652 return ' ' + line;
6653 }).join('\n');
6654 }
6655 }
6656 } else {
6657 str = ctx.stylize('[Circular]', 'special');
6658 }
6659 }
6660 if (typeof name === 'undefined') {
6661 if (array && key.match(/^\d+$/)) {
6662 return str;
6663 }
6664 name = JSON.stringify('' + key);
6665 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
6666 name = name.substr(1, name.length - 2);
6667 name = ctx.stylize(name, 'name');
6668 } else {
6669 name = name.replace(/'/g, "\\'")
6670 .replace(/\\"/g, '"')
6671 .replace(/(^"|"$)/g, "'");
6672 name = ctx.stylize(name, 'string');
6673 }
6674 }
6675
6676 return name + ': ' + str;
6677}
6678
6679
6680function reduceToSingleString(output, base, braces) {
6681 var numLinesEst = 0;
6682 var length = output.reduce(function(prev, cur) {
6683 numLinesEst++;
6684 if (cur.indexOf('\n') >= 0) numLinesEst++;
6685 return prev + cur.length + 1;
6686 }, 0);
6687
6688 if (length > 60) {
6689 return braces[0] +
6690 (base === '' ? '' : base + '\n ') +
6691 ' ' +
6692 output.join(',\n ') +
6693 ' ' +
6694 braces[1];
6695 }
6696
6697 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
6698}
6699
6700function isTypedArray(ar) {
6701 // Unfortunately there's no way to check if an object is a TypedArray
6702 // We have to check if it's one of these types
6703 return (typeof ar === 'object' && /\w+Array]$/.test(objectToString(ar)));
6704}
6705
6706function isArray(ar) {
6707 return Array.isArray(ar) ||
6708 (typeof ar === 'object' && objectToString(ar) === '[object Array]');
6709}
6710
6711function isRegExp(re) {
6712 return typeof re === 'object' && objectToString(re) === '[object RegExp]';
6713}
6714
6715function isDate(d) {
6716 return typeof d === 'object' && objectToString(d) === '[object Date]';
6717}
6718
6719function isError(e) {
6720 return typeof e === 'object' && objectToString(e) === '[object Error]';
6721}
6722
6723function objectToString(o) {
6724 return Object.prototype.toString.call(o);
6725}
6726});
6727
6728/*!
6729 * Chai - flag utility
6730 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
6731 * MIT Licensed
6732 */
6733
6734/*!
6735 * Module dependancies
6736 */
6737
6738
6739
6740
6741/**
6742 * ### .objDisplay(object)
6743 *
6744 * Determines if an object or an array matches
6745 * criteria to be inspected in-line for error
6746 * messages or should be truncated.
6747 *
6748 * @param {Mixed} javascript object to inspect
6749 * @name objDisplay
6750 * @namespace Utils
6751 * @api public
6752 */
6753
6754var objDisplay = function objDisplay(obj) {
6755 var str = inspect_1(obj)
6756 , type = Object.prototype.toString.call(obj);
6757
6758 if (config.truncateThreshold && str.length >= config.truncateThreshold) {
6759 if (type === '[object Function]') {
6760 return !obj.name || obj.name === ''
6761 ? '[Function]'
6762 : '[Function: ' + obj.name + ']';
6763 } else if (type === '[object Array]') {
6764 return '[ Array(' + obj.length + ') ]';
6765 } else if (type === '[object Object]') {
6766 var keys = Object.keys(obj)
6767 , kstr = keys.length > 2
6768 ? keys.splice(0, 2).join(', ') + ', ...'
6769 : keys.join(', ');
6770 return '{ Object (' + kstr + ') }';
6771 } else {
6772 return str;
6773 }
6774 } else {
6775 return str;
6776 }
6777};
6778
6779/*!
6780 * Chai - message composition utility
6781 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
6782 * MIT Licensed
6783 */
6784
6785/*!
6786 * Module dependancies
6787 */
6788
6789
6790
6791/**
6792 * ### .getMessage(object, message, negateMessage)
6793 *
6794 * Construct the error message based on flags
6795 * and template tags. Template tags will return
6796 * a stringified inspection of the object referenced.
6797 *
6798 * Message template tags:
6799 * - `#{this}` current asserted object
6800 * - `#{act}` actual value
6801 * - `#{exp}` expected value
6802 *
6803 * @param {Object} object (constructed Assertion)
6804 * @param {Arguments} chai.Assertion.prototype.assert arguments
6805 * @namespace Utils
6806 * @name getMessage
6807 * @api public
6808 */
6809
6810var getMessage = function getMessage(obj, args) {
6811 var negate = flag(obj, 'negate')
6812 , val = flag(obj, 'object')
6813 , expected = args[3]
6814 , actual = getActual(obj, args)
6815 , msg = negate ? args[2] : args[1]
6816 , flagMsg = flag(obj, 'message');
6817
6818 if(typeof msg === "function") msg = msg();
6819 msg = msg || '';
6820 msg = msg
6821 .replace(/#\{this\}/g, function () { return objDisplay(val); })
6822 .replace(/#\{act\}/g, function () { return objDisplay(actual); })
6823 .replace(/#\{exp\}/g, function () { return objDisplay(expected); });
6824
6825 return flagMsg ? flagMsg + ': ' + msg : msg;
6826};
6827
6828/*!
6829 * Chai - transferFlags utility
6830 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
6831 * MIT Licensed
6832 */
6833
6834/**
6835 * ### .transferFlags(assertion, object, includeAll = true)
6836 *
6837 * Transfer all the flags for `assertion` to `object`. If
6838 * `includeAll` is set to `false`, then the base Chai
6839 * assertion flags (namely `object`, `ssfi`, `lockSsfi`,
6840 * and `message`) will not be transferred.
6841 *
6842 *
6843 * var newAssertion = new Assertion();
6844 * utils.transferFlags(assertion, newAssertion);
6845 *
6846 * var anotherAsseriton = new Assertion(myObj);
6847 * utils.transferFlags(assertion, anotherAssertion, false);
6848 *
6849 * @param {Assertion} assertion the assertion to transfer the flags from
6850 * @param {Object} object the object to transfer the flags to; usually a new assertion
6851 * @param {Boolean} includeAll
6852 * @namespace Utils
6853 * @name transferFlags
6854 * @api private
6855 */
6856
6857var transferFlags = function transferFlags(assertion, object, includeAll) {
6858 var flags = assertion.__flags || (assertion.__flags = Object.create(null));
6859
6860 if (!object.__flags) {
6861 object.__flags = Object.create(null);
6862 }
6863
6864 includeAll = arguments.length === 3 ? includeAll : true;
6865
6866 for (var flag in flags) {
6867 if (includeAll ||
6868 (flag !== 'object' && flag !== 'ssfi' && flag !== 'lockSsfi' && flag != 'message')) {
6869 object.__flags[flag] = flags[flag];
6870 }
6871 }
6872};
6873
6874/* globals Symbol: false, Uint8Array: false, WeakMap: false */
6875/*!
6876 * deep-eql
6877 * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
6878 * MIT Licensed
6879 */
6880
6881
6882function FakeMap() {
6883 this._key = 'chai/deep-eql__' + Math.random() + Date.now();
6884}
6885
6886FakeMap.prototype = {
6887 get: function getMap(key) {
6888 return key[this._key];
6889 },
6890 set: function setMap(key, value) {
6891 if (Object.isExtensible(key)) {
6892 Object.defineProperty(key, this._key, {
6893 value: value,
6894 configurable: true,
6895 });
6896 }
6897 },
6898};
6899
6900var MemoizeMap = typeof WeakMap === 'function' ? WeakMap : FakeMap;
6901/*!
6902 * Check to see if the MemoizeMap has recorded a result of the two operands
6903 *
6904 * @param {Mixed} leftHandOperand
6905 * @param {Mixed} rightHandOperand
6906 * @param {MemoizeMap} memoizeMap
6907 * @returns {Boolean|null} result
6908*/
6909function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
6910 // Technically, WeakMap keys can *only* be objects, not primitives.
6911 if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
6912 return null;
6913 }
6914 var leftHandMap = memoizeMap.get(leftHandOperand);
6915 if (leftHandMap) {
6916 var result = leftHandMap.get(rightHandOperand);
6917 if (typeof result === 'boolean') {
6918 return result;
6919 }
6920 }
6921 return null;
6922}
6923
6924/*!
6925 * Set the result of the equality into the MemoizeMap
6926 *
6927 * @param {Mixed} leftHandOperand
6928 * @param {Mixed} rightHandOperand
6929 * @param {MemoizeMap} memoizeMap
6930 * @param {Boolean} result
6931*/
6932function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
6933 // Technically, WeakMap keys can *only* be objects, not primitives.
6934 if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
6935 return;
6936 }
6937 var leftHandMap = memoizeMap.get(leftHandOperand);
6938 if (leftHandMap) {
6939 leftHandMap.set(rightHandOperand, result);
6940 } else {
6941 leftHandMap = new MemoizeMap();
6942 leftHandMap.set(rightHandOperand, result);
6943 memoizeMap.set(leftHandOperand, leftHandMap);
6944 }
6945}
6946
6947/*!
6948 * Primary Export
6949 */
6950
6951var deepEql = deepEqual;
6952var MemoizeMap_1 = MemoizeMap;
6953
6954/**
6955 * Assert deeply nested sameValue equality between two objects of any type.
6956 *
6957 * @param {Mixed} leftHandOperand
6958 * @param {Mixed} rightHandOperand
6959 * @param {Object} [options] (optional) Additional options
6960 * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
6961 * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
6962 complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
6963 references to blow the stack.
6964 * @return {Boolean} equal match
6965 */
6966function deepEqual(leftHandOperand, rightHandOperand, options) {
6967 // If we have a comparator, we can't assume anything; so bail to its check first.
6968 if (options && options.comparator) {
6969 return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
6970 }
6971
6972 var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
6973 if (simpleResult !== null) {
6974 return simpleResult;
6975 }
6976
6977 // Deeper comparisons are pushed through to a larger function
6978 return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
6979}
6980
6981/**
6982 * Many comparisons can be canceled out early via simple equality or primitive checks.
6983 * @param {Mixed} leftHandOperand
6984 * @param {Mixed} rightHandOperand
6985 * @return {Boolean|null} equal match
6986 */
6987function simpleEqual(leftHandOperand, rightHandOperand) {
6988 // Equal references (except for Numbers) can be returned early
6989 if (leftHandOperand === rightHandOperand) {
6990 // Handle +-0 cases
6991 return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
6992 }
6993
6994 // handle NaN cases
6995 if (
6996 leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare
6997 rightHandOperand !== rightHandOperand // eslint-disable-line no-self-compare
6998 ) {
6999 return true;
7000 }
7001
7002 // Anything that is not an 'object', i.e. symbols, functions, booleans, numbers,
7003 // strings, and undefined, can be compared by reference.
7004 if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
7005 // Easy out b/c it would have passed the first equality check
7006 return false;
7007 }
7008 return null;
7009}
7010
7011/*!
7012 * The main logic of the `deepEqual` function.
7013 *
7014 * @param {Mixed} leftHandOperand
7015 * @param {Mixed} rightHandOperand
7016 * @param {Object} [options] (optional) Additional options
7017 * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
7018 * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
7019 complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
7020 references to blow the stack.
7021 * @return {Boolean} equal match
7022*/
7023function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
7024 options = options || {};
7025 options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap();
7026 var comparator = options && options.comparator;
7027
7028 // Check if a memoized result exists.
7029 var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
7030 if (memoizeResultLeft !== null) {
7031 return memoizeResultLeft;
7032 }
7033 var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
7034 if (memoizeResultRight !== null) {
7035 return memoizeResultRight;
7036 }
7037
7038 // If a comparator is present, use it.
7039 if (comparator) {
7040 var comparatorResult = comparator(leftHandOperand, rightHandOperand);
7041 // Comparators may return null, in which case we want to go back to default behavior.
7042 if (comparatorResult === false || comparatorResult === true) {
7043 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
7044 return comparatorResult;
7045 }
7046 // To allow comparators to override *any* behavior, we ran them first. Since it didn't decide
7047 // what to do, we need to make sure to return the basic tests first before we move on.
7048 var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
7049 if (simpleResult !== null) {
7050 // Don't memoize this, it takes longer to set/retrieve than to just compare.
7051 return simpleResult;
7052 }
7053 }
7054
7055 var leftHandType = typeDetect(leftHandOperand);
7056 if (leftHandType !== typeDetect(rightHandOperand)) {
7057 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
7058 return false;
7059 }
7060
7061 // Temporarily set the operands in the memoize object to prevent blowing the stack
7062 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
7063
7064 var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
7065 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
7066 return result;
7067}
7068
7069function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
7070 switch (leftHandType) {
7071 case 'String':
7072 case 'Number':
7073 case 'Boolean':
7074 case 'Date':
7075 // If these types are their instance types (e.g. `new Number`) then re-deepEqual against their values
7076 return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
7077 case 'Promise':
7078 case 'Symbol':
7079 case 'function':
7080 case 'WeakMap':
7081 case 'WeakSet':
7082 case 'Error':
7083 return leftHandOperand === rightHandOperand;
7084 case 'Arguments':
7085 case 'Int8Array':
7086 case 'Uint8Array':
7087 case 'Uint8ClampedArray':
7088 case 'Int16Array':
7089 case 'Uint16Array':
7090 case 'Int32Array':
7091 case 'Uint32Array':
7092 case 'Float32Array':
7093 case 'Float64Array':
7094 case 'Array':
7095 return iterableEqual(leftHandOperand, rightHandOperand, options);
7096 case 'RegExp':
7097 return regexpEqual(leftHandOperand, rightHandOperand);
7098 case 'Generator':
7099 return generatorEqual(leftHandOperand, rightHandOperand, options);
7100 case 'DataView':
7101 return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
7102 case 'ArrayBuffer':
7103 return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
7104 case 'Set':
7105 return entriesEqual(leftHandOperand, rightHandOperand, options);
7106 case 'Map':
7107 return entriesEqual(leftHandOperand, rightHandOperand, options);
7108 default:
7109 return objectEqual(leftHandOperand, rightHandOperand, options);
7110 }
7111}
7112
7113/*!
7114 * Compare two Regular Expressions for equality.
7115 *
7116 * @param {RegExp} leftHandOperand
7117 * @param {RegExp} rightHandOperand
7118 * @return {Boolean} result
7119 */
7120
7121function regexpEqual(leftHandOperand, rightHandOperand) {
7122 return leftHandOperand.toString() === rightHandOperand.toString();
7123}
7124
7125/*!
7126 * Compare two Sets/Maps for equality. Faster than other equality functions.
7127 *
7128 * @param {Set} leftHandOperand
7129 * @param {Set} rightHandOperand
7130 * @param {Object} [options] (Optional)
7131 * @return {Boolean} result
7132 */
7133
7134function entriesEqual(leftHandOperand, rightHandOperand, options) {
7135 // IE11 doesn't support Set#entries or Set#@@iterator, so we need manually populate using Set#forEach
7136 if (leftHandOperand.size !== rightHandOperand.size) {
7137 return false;
7138 }
7139 if (leftHandOperand.size === 0) {
7140 return true;
7141 }
7142 var leftHandItems = [];
7143 var rightHandItems = [];
7144 leftHandOperand.forEach(function gatherEntries(key, value) {
7145 leftHandItems.push([ key, value ]);
7146 });
7147 rightHandOperand.forEach(function gatherEntries(key, value) {
7148 rightHandItems.push([ key, value ]);
7149 });
7150 return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
7151}
7152
7153/*!
7154 * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
7155 *
7156 * @param {Iterable} leftHandOperand
7157 * @param {Iterable} rightHandOperand
7158 * @param {Object} [options] (Optional)
7159 * @return {Boolean} result
7160 */
7161
7162function iterableEqual(leftHandOperand, rightHandOperand, options) {
7163 var length = leftHandOperand.length;
7164 if (length !== rightHandOperand.length) {
7165 return false;
7166 }
7167 if (length === 0) {
7168 return true;
7169 }
7170 var index = -1;
7171 while (++index < length) {
7172 if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
7173 return false;
7174 }
7175 }
7176 return true;
7177}
7178
7179/*!
7180 * Simple equality for generator objects such as those returned by generator functions.
7181 *
7182 * @param {Iterable} leftHandOperand
7183 * @param {Iterable} rightHandOperand
7184 * @param {Object} [options] (Optional)
7185 * @return {Boolean} result
7186 */
7187
7188function generatorEqual(leftHandOperand, rightHandOperand, options) {
7189 return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
7190}
7191
7192/*!
7193 * Determine if the given object has an @@iterator function.
7194 *
7195 * @param {Object} target
7196 * @return {Boolean} `true` if the object has an @@iterator function.
7197 */
7198function hasIteratorFunction(target) {
7199 return typeof Symbol !== 'undefined' &&
7200 typeof target === 'object' &&
7201 typeof Symbol.iterator !== 'undefined' &&
7202 typeof target[Symbol.iterator] === 'function';
7203}
7204
7205/*!
7206 * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
7207 * This will consume the iterator - which could have side effects depending on the @@iterator implementation.
7208 *
7209 * @param {Object} target
7210 * @returns {Array} an array of entries from the @@iterator function
7211 */
7212function getIteratorEntries(target) {
7213 if (hasIteratorFunction(target)) {
7214 try {
7215 return getGeneratorEntries(target[Symbol.iterator]());
7216 } catch (iteratorError) {
7217 return [];
7218 }
7219 }
7220 return [];
7221}
7222
7223/*!
7224 * Gets all entries from a Generator. This will consume the generator - which could have side effects.
7225 *
7226 * @param {Generator} target
7227 * @returns {Array} an array of entries from the Generator.
7228 */
7229function getGeneratorEntries(generator) {
7230 var generatorResult = generator.next();
7231 var accumulator = [ generatorResult.value ];
7232 while (generatorResult.done === false) {
7233 generatorResult = generator.next();
7234 accumulator.push(generatorResult.value);
7235 }
7236 return accumulator;
7237}
7238
7239/*!
7240 * Gets all own and inherited enumerable keys from a target.
7241 *
7242 * @param {Object} target
7243 * @returns {Array} an array of own and inherited enumerable keys from the target.
7244 */
7245function getEnumerableKeys(target) {
7246 var keys = [];
7247 for (var key in target) {
7248 keys.push(key);
7249 }
7250 return keys;
7251}
7252
7253/*!
7254 * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
7255 * each key. If any value of the given key is not equal, the function will return false (early).
7256 *
7257 * @param {Mixed} leftHandOperand
7258 * @param {Mixed} rightHandOperand
7259 * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
7260 * @param {Object} [options] (Optional)
7261 * @return {Boolean} result
7262 */
7263function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
7264 var length = keys.length;
7265 if (length === 0) {
7266 return true;
7267 }
7268 for (var i = 0; i < length; i += 1) {
7269 if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
7270 return false;
7271 }
7272 }
7273 return true;
7274}
7275
7276/*!
7277 * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
7278 * for each enumerable key in the object.
7279 *
7280 * @param {Mixed} leftHandOperand
7281 * @param {Mixed} rightHandOperand
7282 * @param {Object} [options] (Optional)
7283 * @return {Boolean} result
7284 */
7285
7286function objectEqual(leftHandOperand, rightHandOperand, options) {
7287 var leftHandKeys = getEnumerableKeys(leftHandOperand);
7288 var rightHandKeys = getEnumerableKeys(rightHandOperand);
7289 if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
7290 leftHandKeys.sort();
7291 rightHandKeys.sort();
7292 if (iterableEqual(leftHandKeys, rightHandKeys) === false) {
7293 return false;
7294 }
7295 return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
7296 }
7297
7298 var leftHandEntries = getIteratorEntries(leftHandOperand);
7299 var rightHandEntries = getIteratorEntries(rightHandOperand);
7300 if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
7301 leftHandEntries.sort();
7302 rightHandEntries.sort();
7303 return iterableEqual(leftHandEntries, rightHandEntries, options);
7304 }
7305
7306 if (leftHandKeys.length === 0 &&
7307 leftHandEntries.length === 0 &&
7308 rightHandKeys.length === 0 &&
7309 rightHandEntries.length === 0) {
7310 return true;
7311 }
7312
7313 return false;
7314}
7315
7316/*!
7317 * Returns true if the argument is a primitive.
7318 *
7319 * This intentionally returns true for all objects that can be compared by reference,
7320 * including functions and symbols.
7321 *
7322 * @param {Mixed} value
7323 * @return {Boolean} result
7324 */
7325function isPrimitive(value) {
7326 return value === null || typeof value !== 'object';
7327}
7328
7329deepEql.MemoizeMap = MemoizeMap_1;
7330
7331/*!
7332 * Chai - isProxyEnabled helper
7333 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7334 * MIT Licensed
7335 */
7336
7337/**
7338 * ### .isProxyEnabled()
7339 *
7340 * Helper function to check if Chai's proxy protection feature is enabled. If
7341 * proxies are unsupported or disabled via the user's Chai config, then return
7342 * false. Otherwise, return true.
7343 *
7344 * @namespace Utils
7345 * @name isProxyEnabled
7346 */
7347
7348var isProxyEnabled = function isProxyEnabled() {
7349 return config.useProxy &&
7350 typeof Proxy !== 'undefined' &&
7351 typeof Reflect !== 'undefined';
7352};
7353
7354/*!
7355 * Chai - addProperty utility
7356 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7357 * MIT Licensed
7358 */
7359
7360
7361
7362
7363
7364
7365/**
7366 * ### .addProperty(ctx, name, getter)
7367 *
7368 * Adds a property to the prototype of an object.
7369 *
7370 * utils.addProperty(chai.Assertion.prototype, 'foo', function () {
7371 * var obj = utils.flag(this, 'object');
7372 * new chai.Assertion(obj).to.be.instanceof(Foo);
7373 * });
7374 *
7375 * Can also be accessed directly from `chai.Assertion`.
7376 *
7377 * chai.Assertion.addProperty('foo', fn);
7378 *
7379 * Then can be used as any other assertion.
7380 *
7381 * expect(myFoo).to.be.foo;
7382 *
7383 * @param {Object} ctx object to which the property is added
7384 * @param {String} name of property to add
7385 * @param {Function} getter function to be used for name
7386 * @namespace Utils
7387 * @name addProperty
7388 * @api public
7389 */
7390
7391var addProperty = function addProperty(ctx, name, getter) {
7392 getter = getter === undefined ? function () {} : getter;
7393
7394 Object.defineProperty(ctx, name,
7395 { get: function propertyGetter() {
7396 // Setting the `ssfi` flag to `propertyGetter` causes this function to
7397 // be the starting point for removing implementation frames from the
7398 // stack trace of a failed assertion.
7399 //
7400 // However, we only want to use this function as the starting point if
7401 // the `lockSsfi` flag isn't set and proxy protection is disabled.
7402 //
7403 // If the `lockSsfi` flag is set, then either this assertion has been
7404 // overwritten by another assertion, or this assertion is being invoked
7405 // from inside of another assertion. In the first case, the `ssfi` flag
7406 // has already been set by the overwriting assertion. In the second
7407 // case, the `ssfi` flag has already been set by the outer assertion.
7408 //
7409 // If proxy protection is enabled, then the `ssfi` flag has already been
7410 // set by the proxy getter.
7411 if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
7412 flag(this, 'ssfi', propertyGetter);
7413 }
7414
7415 var result = getter.call(this);
7416 if (result !== undefined)
7417 return result;
7418
7419 var newAssertion = new chai.Assertion();
7420 transferFlags(this, newAssertion);
7421 return newAssertion;
7422 }
7423 , configurable: true
7424 });
7425};
7426
7427var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');
7428
7429/*!
7430 * Chai - addLengthGuard utility
7431 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7432 * MIT Licensed
7433 */
7434
7435/**
7436 * ### .addLengthGuard(fn, assertionName, isChainable)
7437 *
7438 * Define `length` as a getter on the given uninvoked method assertion. The
7439 * getter acts as a guard against chaining `length` directly off of an uninvoked
7440 * method assertion, which is a problem because it references `function`'s
7441 * built-in `length` property instead of Chai's `length` assertion. When the
7442 * getter catches the user making this mistake, it throws an error with a
7443 * helpful message.
7444 *
7445 * There are two ways in which this mistake can be made. The first way is by
7446 * chaining the `length` assertion directly off of an uninvoked chainable
7447 * method. In this case, Chai suggests that the user use `lengthOf` instead. The
7448 * second way is by chaining the `length` assertion directly off of an uninvoked
7449 * non-chainable method. Non-chainable methods must be invoked prior to
7450 * chaining. In this case, Chai suggests that the user consult the docs for the
7451 * given assertion.
7452 *
7453 * If the `length` property of functions is unconfigurable, then return `fn`
7454 * without modification.
7455 *
7456 * Note that in ES6, the function's `length` property is configurable, so once
7457 * support for legacy environments is dropped, Chai's `length` property can
7458 * replace the built-in function's `length` property, and this length guard will
7459 * no longer be necessary. In the mean time, maintaining consistency across all
7460 * environments is the priority.
7461 *
7462 * @param {Function} fn
7463 * @param {String} assertionName
7464 * @param {Boolean} isChainable
7465 * @namespace Utils
7466 * @name addLengthGuard
7467 */
7468
7469var addLengthGuard = function addLengthGuard (fn, assertionName, isChainable) {
7470 if (!fnLengthDesc.configurable) return fn;
7471
7472 Object.defineProperty(fn, 'length', {
7473 get: function () {
7474 if (isChainable) {
7475 throw Error('Invalid Chai property: ' + assertionName + '.length. Due' +
7476 ' to a compatibility issue, "length" cannot directly follow "' +
7477 assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
7478 }
7479
7480 throw Error('Invalid Chai property: ' + assertionName + '.length. See' +
7481 ' docs for proper usage of "' + assertionName + '".');
7482 }
7483 });
7484
7485 return fn;
7486};
7487
7488/*!
7489 * Chai - proxify utility
7490 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7491 * MIT Licensed
7492 */
7493
7494/**
7495 * ### .proxify(object)
7496 *
7497 * Return a proxy of given object that throws an error when a non-existent
7498 * property is read. By default, the root cause is assumed to be a misspelled
7499 * property, and thus an attempt is made to offer a reasonable suggestion from
7500 * the list of existing properties. However, if a nonChainableMethodName is
7501 * provided, then the root cause is instead a failure to invoke a non-chainable
7502 * method prior to reading the non-existent property.
7503 *
7504 * If proxies are unsupported or disabled via the user's Chai config, then
7505 * return object without modification.
7506 *
7507 * @param {Object} obj
7508 * @param {String} nonChainableMethodName
7509 * @namespace Utils
7510 * @name proxify
7511 */
7512
7513var builtins = ['__flags', '__methods', '_obj', 'assert'];
7514
7515var proxify = function proxify(obj, nonChainableMethodName) {
7516 if (!isProxyEnabled()) return obj;
7517
7518 return new Proxy(obj, {
7519 get: function proxyGetter(target, property) {
7520 // This check is here because we should not throw errors on Symbol properties
7521 // such as `Symbol.toStringTag`.
7522 // The values for which an error should be thrown can be configured using
7523 // the `config.proxyExcludedKeys` setting.
7524 if (typeof property === 'string' &&
7525 config.proxyExcludedKeys.indexOf(property) === -1 &&
7526 !Reflect.has(target, property)) {
7527 // Special message for invalid property access of non-chainable methods.
7528 if (nonChainableMethodName) {
7529 throw Error('Invalid Chai property: ' + nonChainableMethodName + '.' +
7530 property + '. See docs for proper usage of "' +
7531 nonChainableMethodName + '".');
7532 }
7533
7534 var orderedProperties = getProperties(target).filter(function(property) {
7535 return !Object.prototype.hasOwnProperty(property) &&
7536 builtins.indexOf(property) === -1;
7537 }).sort(function(a, b) {
7538 return stringDistance(property, a) - stringDistance(property, b);
7539 });
7540
7541 if (orderedProperties.length &&
7542 stringDistance(orderedProperties[0], property) < 4) {
7543 // If the property is reasonably close to an existing Chai property,
7544 // suggest that property to the user.
7545 throw Error('Invalid Chai property: ' + property +
7546 '. Did you mean "' + orderedProperties[0] + '"?');
7547 } else {
7548 throw Error('Invalid Chai property: ' + property);
7549 }
7550 }
7551
7552 // Use this proxy getter as the starting point for removing implementation
7553 // frames from the stack trace of a failed assertion. For property
7554 // assertions, this prevents the proxy getter from showing up in the stack
7555 // trace since it's invoked before the property getter. For method and
7556 // chainable method assertions, this flag will end up getting changed to
7557 // the method wrapper, which is good since this frame will no longer be in
7558 // the stack once the method is invoked. Note that Chai builtin assertion
7559 // properties such as `__flags` are skipped since this is only meant to
7560 // capture the starting point of an assertion. This step is also skipped
7561 // if the `lockSsfi` flag is set, thus indicating that this assertion is
7562 // being called from within another assertion. In that case, the `ssfi`
7563 // flag is already set to the outer assertion's starting point.
7564 if (builtins.indexOf(property) === -1 && !flag(target, 'lockSsfi')) {
7565 flag(target, 'ssfi', proxyGetter);
7566 }
7567
7568 return Reflect.get(target, property);
7569 }
7570 });
7571};
7572
7573/**
7574 * # stringDistance(strA, strB)
7575 * Return the Levenshtein distance between two strings.
7576 * @param {string} strA
7577 * @param {string} strB
7578 * @return {number} the string distance between strA and strB
7579 * @api private
7580 */
7581
7582function stringDistance(strA, strB, memo) {
7583 if (!memo) {
7584 // `memo` is a two-dimensional array containing a cache of distances
7585 // memo[i][j] is the distance between strA.slice(0, i) and
7586 // strB.slice(0, j).
7587 memo = [];
7588 for (var i = 0; i <= strA.length; i++) {
7589 memo[i] = [];
7590 }
7591 }
7592
7593 if (!memo[strA.length] || !memo[strA.length][strB.length]) {
7594 if (strA.length === 0 || strB.length === 0) {
7595 memo[strA.length][strB.length] = Math.max(strA.length, strB.length);
7596 } else {
7597 memo[strA.length][strB.length] = Math.min(
7598 stringDistance(strA.slice(0, -1), strB, memo) + 1,
7599 stringDistance(strA, strB.slice(0, -1), memo) + 1,
7600 stringDistance(strA.slice(0, -1), strB.slice(0, -1), memo) +
7601 (strA.slice(-1) === strB.slice(-1) ? 0 : 1)
7602 );
7603 }
7604 }
7605
7606 return memo[strA.length][strB.length];
7607}
7608
7609/*!
7610 * Chai - addMethod utility
7611 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7612 * MIT Licensed
7613 */
7614
7615
7616
7617
7618
7619
7620
7621/**
7622 * ### .addMethod(ctx, name, method)
7623 *
7624 * Adds a method to the prototype of an object.
7625 *
7626 * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
7627 * var obj = utils.flag(this, 'object');
7628 * new chai.Assertion(obj).to.be.equal(str);
7629 * });
7630 *
7631 * Can also be accessed directly from `chai.Assertion`.
7632 *
7633 * chai.Assertion.addMethod('foo', fn);
7634 *
7635 * Then can be used as any other assertion.
7636 *
7637 * expect(fooStr).to.be.foo('bar');
7638 *
7639 * @param {Object} ctx object to which the method is added
7640 * @param {String} name of method to add
7641 * @param {Function} method function to be used for name
7642 * @namespace Utils
7643 * @name addMethod
7644 * @api public
7645 */
7646
7647var addMethod = function addMethod(ctx, name, method) {
7648 var methodWrapper = function () {
7649 // Setting the `ssfi` flag to `methodWrapper` causes this function to be the
7650 // starting point for removing implementation frames from the stack trace of
7651 // a failed assertion.
7652 //
7653 // However, we only want to use this function as the starting point if the
7654 // `lockSsfi` flag isn't set.
7655 //
7656 // If the `lockSsfi` flag is set, then either this assertion has been
7657 // overwritten by another assertion, or this assertion is being invoked from
7658 // inside of another assertion. In the first case, the `ssfi` flag has
7659 // already been set by the overwriting assertion. In the second case, the
7660 // `ssfi` flag has already been set by the outer assertion.
7661 if (!flag(this, 'lockSsfi')) {
7662 flag(this, 'ssfi', methodWrapper);
7663 }
7664
7665 var result = method.apply(this, arguments);
7666 if (result !== undefined)
7667 return result;
7668
7669 var newAssertion = new chai.Assertion();
7670 transferFlags(this, newAssertion);
7671 return newAssertion;
7672 };
7673
7674 addLengthGuard(methodWrapper, name, false);
7675 ctx[name] = proxify(methodWrapper, name);
7676};
7677
7678/*!
7679 * Chai - overwriteProperty utility
7680 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7681 * MIT Licensed
7682 */
7683
7684
7685
7686
7687
7688
7689/**
7690 * ### .overwriteProperty(ctx, name, fn)
7691 *
7692 * Overwites an already existing property getter and provides
7693 * access to previous value. Must return function to use as getter.
7694 *
7695 * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {
7696 * return function () {
7697 * var obj = utils.flag(this, 'object');
7698 * if (obj instanceof Foo) {
7699 * new chai.Assertion(obj.name).to.equal('bar');
7700 * } else {
7701 * _super.call(this);
7702 * }
7703 * }
7704 * });
7705 *
7706 *
7707 * Can also be accessed directly from `chai.Assertion`.
7708 *
7709 * chai.Assertion.overwriteProperty('foo', fn);
7710 *
7711 * Then can be used as any other assertion.
7712 *
7713 * expect(myFoo).to.be.ok;
7714 *
7715 * @param {Object} ctx object whose property is to be overwritten
7716 * @param {String} name of property to overwrite
7717 * @param {Function} getter function that returns a getter function to be used for name
7718 * @namespace Utils
7719 * @name overwriteProperty
7720 * @api public
7721 */
7722
7723var overwriteProperty = function overwriteProperty(ctx, name, getter) {
7724 var _get = Object.getOwnPropertyDescriptor(ctx, name)
7725 , _super = function () {};
7726
7727 if (_get && 'function' === typeof _get.get)
7728 _super = _get.get;
7729
7730 Object.defineProperty(ctx, name,
7731 { get: function overwritingPropertyGetter() {
7732 // Setting the `ssfi` flag to `overwritingPropertyGetter` causes this
7733 // function to be the starting point for removing implementation frames
7734 // from the stack trace of a failed assertion.
7735 //
7736 // However, we only want to use this function as the starting point if
7737 // the `lockSsfi` flag isn't set and proxy protection is disabled.
7738 //
7739 // If the `lockSsfi` flag is set, then either this assertion has been
7740 // overwritten by another assertion, or this assertion is being invoked
7741 // from inside of another assertion. In the first case, the `ssfi` flag
7742 // has already been set by the overwriting assertion. In the second
7743 // case, the `ssfi` flag has already been set by the outer assertion.
7744 //
7745 // If proxy protection is enabled, then the `ssfi` flag has already been
7746 // set by the proxy getter.
7747 if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
7748 flag(this, 'ssfi', overwritingPropertyGetter);
7749 }
7750
7751 // Setting the `lockSsfi` flag to `true` prevents the overwritten
7752 // assertion from changing the `ssfi` flag. By this point, the `ssfi`
7753 // flag is already set to the correct starting point for this assertion.
7754 var origLockSsfi = flag(this, 'lockSsfi');
7755 flag(this, 'lockSsfi', true);
7756 var result = getter(_super).call(this);
7757 flag(this, 'lockSsfi', origLockSsfi);
7758
7759 if (result !== undefined) {
7760 return result;
7761 }
7762
7763 var newAssertion = new chai.Assertion();
7764 transferFlags(this, newAssertion);
7765 return newAssertion;
7766 }
7767 , configurable: true
7768 });
7769};
7770
7771/*!
7772 * Chai - overwriteMethod utility
7773 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7774 * MIT Licensed
7775 */
7776
7777
7778
7779
7780
7781
7782
7783/**
7784 * ### .overwriteMethod(ctx, name, fn)
7785 *
7786 * Overwites an already existing method and provides
7787 * access to previous function. Must return function
7788 * to be used for name.
7789 *
7790 * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
7791 * return function (str) {
7792 * var obj = utils.flag(this, 'object');
7793 * if (obj instanceof Foo) {
7794 * new chai.Assertion(obj.value).to.equal(str);
7795 * } else {
7796 * _super.apply(this, arguments);
7797 * }
7798 * }
7799 * });
7800 *
7801 * Can also be accessed directly from `chai.Assertion`.
7802 *
7803 * chai.Assertion.overwriteMethod('foo', fn);
7804 *
7805 * Then can be used as any other assertion.
7806 *
7807 * expect(myFoo).to.equal('bar');
7808 *
7809 * @param {Object} ctx object whose method is to be overwritten
7810 * @param {String} name of method to overwrite
7811 * @param {Function} method function that returns a function to be used for name
7812 * @namespace Utils
7813 * @name overwriteMethod
7814 * @api public
7815 */
7816
7817var overwriteMethod = function overwriteMethod(ctx, name, method) {
7818 var _method = ctx[name]
7819 , _super = function () {
7820 throw new Error(name + ' is not a function');
7821 };
7822
7823 if (_method && 'function' === typeof _method)
7824 _super = _method;
7825
7826 var overwritingMethodWrapper = function () {
7827 // Setting the `ssfi` flag to `overwritingMethodWrapper` causes this
7828 // function to be the starting point for removing implementation frames from
7829 // the stack trace of a failed assertion.
7830 //
7831 // However, we only want to use this function as the starting point if the
7832 // `lockSsfi` flag isn't set.
7833 //
7834 // If the `lockSsfi` flag is set, then either this assertion has been
7835 // overwritten by another assertion, or this assertion is being invoked from
7836 // inside of another assertion. In the first case, the `ssfi` flag has
7837 // already been set by the overwriting assertion. In the second case, the
7838 // `ssfi` flag has already been set by the outer assertion.
7839 if (!flag(this, 'lockSsfi')) {
7840 flag(this, 'ssfi', overwritingMethodWrapper);
7841 }
7842
7843 // Setting the `lockSsfi` flag to `true` prevents the overwritten assertion
7844 // from changing the `ssfi` flag. By this point, the `ssfi` flag is already
7845 // set to the correct starting point for this assertion.
7846 var origLockSsfi = flag(this, 'lockSsfi');
7847 flag(this, 'lockSsfi', true);
7848 var result = method(_super).apply(this, arguments);
7849 flag(this, 'lockSsfi', origLockSsfi);
7850
7851 if (result !== undefined) {
7852 return result;
7853 }
7854
7855 var newAssertion = new chai.Assertion();
7856 transferFlags(this, newAssertion);
7857 return newAssertion;
7858 };
7859
7860 addLengthGuard(overwritingMethodWrapper, name, false);
7861 ctx[name] = proxify(overwritingMethodWrapper, name);
7862};
7863
7864/*!
7865 * Chai - addChainingMethod utility
7866 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
7867 * MIT Licensed
7868 */
7869
7870/*!
7871 * Module dependencies
7872 */
7873
7874
7875
7876
7877
7878
7879
7880/*!
7881 * Module variables
7882 */
7883
7884// Check whether `Object.setPrototypeOf` is supported
7885var canSetPrototype = typeof Object.setPrototypeOf === 'function';
7886
7887// Without `Object.setPrototypeOf` support, this module will need to add properties to a function.
7888// However, some of functions' own props are not configurable and should be skipped.
7889var testFn = function() {};
7890var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
7891 var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
7892
7893 // Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties,
7894 // but then returns `undefined` as the property descriptor for `callee`. As a
7895 // workaround, we perform an otherwise unnecessary type-check for `propDesc`,
7896 // and then filter it out if it's not an object as it should be.
7897 if (typeof propDesc !== 'object')
7898 return true;
7899
7900 return !propDesc.configurable;
7901});
7902
7903// Cache `Function` properties
7904var call = Function.prototype.call;
7905var apply = Function.prototype.apply;
7906
7907/**
7908 * ### .addChainableMethod(ctx, name, method, chainingBehavior)
7909 *
7910 * Adds a method to an object, such that the method can also be chained.
7911 *
7912 * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
7913 * var obj = utils.flag(this, 'object');
7914 * new chai.Assertion(obj).to.be.equal(str);
7915 * });
7916 *
7917 * Can also be accessed directly from `chai.Assertion`.
7918 *
7919 * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);
7920 *
7921 * The result can then be used as both a method assertion, executing both `method` and
7922 * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.
7923 *
7924 * expect(fooStr).to.be.foo('bar');
7925 * expect(fooStr).to.be.foo.equal('foo');
7926 *
7927 * @param {Object} ctx object to which the method is added
7928 * @param {String} name of method to add
7929 * @param {Function} method function to be used for `name`, when called
7930 * @param {Function} chainingBehavior function to be called every time the property is accessed
7931 * @namespace Utils
7932 * @name addChainableMethod
7933 * @api public
7934 */
7935
7936var addChainableMethod = function addChainableMethod(ctx, name, method, chainingBehavior) {
7937 if (typeof chainingBehavior !== 'function') {
7938 chainingBehavior = function () { };
7939 }
7940
7941 var chainableBehavior = {
7942 method: method
7943 , chainingBehavior: chainingBehavior
7944 };
7945
7946 // save the methods so we can overwrite them later, if we need to.
7947 if (!ctx.__methods) {
7948 ctx.__methods = {};
7949 }
7950 ctx.__methods[name] = chainableBehavior;
7951
7952 Object.defineProperty(ctx, name,
7953 { get: function chainableMethodGetter() {
7954 chainableBehavior.chainingBehavior.call(this);
7955
7956 var chainableMethodWrapper = function () {
7957 // Setting the `ssfi` flag to `chainableMethodWrapper` causes this
7958 // function to be the starting point for removing implementation
7959 // frames from the stack trace of a failed assertion.
7960 //
7961 // However, we only want to use this function as the starting point if
7962 // the `lockSsfi` flag isn't set.
7963 //
7964 // If the `lockSsfi` flag is set, then this assertion is being
7965 // invoked from inside of another assertion. In this case, the `ssfi`
7966 // flag has already been set by the outer assertion.
7967 //
7968 // Note that overwriting a chainable method merely replaces the saved
7969 // methods in `ctx.__methods` instead of completely replacing the
7970 // overwritten assertion. Therefore, an overwriting assertion won't
7971 // set the `ssfi` or `lockSsfi` flags.
7972 if (!flag(this, 'lockSsfi')) {
7973 flag(this, 'ssfi', chainableMethodWrapper);
7974 }
7975
7976 var result = chainableBehavior.method.apply(this, arguments);
7977 if (result !== undefined) {
7978 return result;
7979 }
7980
7981 var newAssertion = new chai.Assertion();
7982 transferFlags(this, newAssertion);
7983 return newAssertion;
7984 };
7985
7986 addLengthGuard(chainableMethodWrapper, name, true);
7987
7988 // Use `Object.setPrototypeOf` if available
7989 if (canSetPrototype) {
7990 // Inherit all properties from the object by replacing the `Function` prototype
7991 var prototype = Object.create(this);
7992 // Restore the `call` and `apply` methods from `Function`
7993 prototype.call = call;
7994 prototype.apply = apply;
7995 Object.setPrototypeOf(chainableMethodWrapper, prototype);
7996 }
7997 // Otherwise, redefine all properties (slow!)
7998 else {
7999 var asserterNames = Object.getOwnPropertyNames(ctx);
8000 asserterNames.forEach(function (asserterName) {
8001 if (excludeNames.indexOf(asserterName) !== -1) {
8002 return;
8003 }
8004
8005 var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
8006 Object.defineProperty(chainableMethodWrapper, asserterName, pd);
8007 });
8008 }
8009
8010 transferFlags(this, chainableMethodWrapper);
8011 return proxify(chainableMethodWrapper);
8012 }
8013 , configurable: true
8014 });
8015};
8016
8017/*!
8018 * Chai - overwriteChainableMethod utility
8019 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
8020 * MIT Licensed
8021 */
8022
8023
8024
8025
8026/**
8027 * ### .overwriteChainableMethod(ctx, name, method, chainingBehavior)
8028 *
8029 * Overwites an already existing chainable method
8030 * and provides access to the previous function or
8031 * property. Must return functions to be used for
8032 * name.
8033 *
8034 * utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf',
8035 * function (_super) {
8036 * }
8037 * , function (_super) {
8038 * }
8039 * );
8040 *
8041 * Can also be accessed directly from `chai.Assertion`.
8042 *
8043 * chai.Assertion.overwriteChainableMethod('foo', fn, fn);
8044 *
8045 * Then can be used as any other assertion.
8046 *
8047 * expect(myFoo).to.have.lengthOf(3);
8048 * expect(myFoo).to.have.lengthOf.above(3);
8049 *
8050 * @param {Object} ctx object whose method / property is to be overwritten
8051 * @param {String} name of method / property to overwrite
8052 * @param {Function} method function that returns a function to be used for name
8053 * @param {Function} chainingBehavior function that returns a function to be used for property
8054 * @namespace Utils
8055 * @name overwriteChainableMethod
8056 * @api public
8057 */
8058
8059var overwriteChainableMethod = function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
8060 var chainableBehavior = ctx.__methods[name];
8061
8062 var _chainingBehavior = chainableBehavior.chainingBehavior;
8063 chainableBehavior.chainingBehavior = function overwritingChainableMethodGetter() {
8064 var result = chainingBehavior(_chainingBehavior).call(this);
8065 if (result !== undefined) {
8066 return result;
8067 }
8068
8069 var newAssertion = new chai.Assertion();
8070 transferFlags(this, newAssertion);
8071 return newAssertion;
8072 };
8073
8074 var _method = chainableBehavior.method;
8075 chainableBehavior.method = function overwritingChainableMethodWrapper() {
8076 var result = method(_method).apply(this, arguments);
8077 if (result !== undefined) {
8078 return result;
8079 }
8080
8081 var newAssertion = new chai.Assertion();
8082 transferFlags(this, newAssertion);
8083 return newAssertion;
8084 };
8085};
8086
8087/*!
8088 * Chai - compareByInspect utility
8089 * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
8090 * MIT Licensed
8091 */
8092
8093/*!
8094 * Module dependancies
8095 */
8096
8097
8098
8099/**
8100 * ### .compareByInspect(mixed, mixed)
8101 *
8102 * To be used as a compareFunction with Array.prototype.sort. Compares elements
8103 * using inspect instead of default behavior of using toString so that Symbols
8104 * and objects with irregular/missing toString can still be sorted without a
8105 * TypeError.
8106 *
8107 * @param {Mixed} first element to compare
8108 * @param {Mixed} second element to compare
8109 * @returns {Number} -1 if 'a' should come before 'b'; otherwise 1
8110 * @name compareByInspect
8111 * @namespace Utils
8112 * @api public
8113 */
8114
8115var compareByInspect = function compareByInspect(a, b) {
8116 return inspect_1(a) < inspect_1(b) ? -1 : 1;
8117};
8118
8119/*!
8120 * Chai - getOwnEnumerablePropertySymbols utility
8121 * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
8122 * MIT Licensed
8123 */
8124
8125/**
8126 * ### .getOwnEnumerablePropertySymbols(object)
8127 *
8128 * This allows the retrieval of directly-owned enumerable property symbols of an
8129 * object. This function is necessary because Object.getOwnPropertySymbols
8130 * returns both enumerable and non-enumerable property symbols.
8131 *
8132 * @param {Object} object
8133 * @returns {Array}
8134 * @namespace Utils
8135 * @name getOwnEnumerablePropertySymbols
8136 * @api public
8137 */
8138
8139var getOwnEnumerablePropertySymbols = function getOwnEnumerablePropertySymbols(obj) {
8140 if (typeof Object.getOwnPropertySymbols !== 'function') return [];
8141
8142 return Object.getOwnPropertySymbols(obj).filter(function (sym) {
8143 return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
8144 });
8145};
8146
8147/*!
8148 * Chai - getOwnEnumerableProperties utility
8149 * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
8150 * MIT Licensed
8151 */
8152
8153/*!
8154 * Module dependancies
8155 */
8156
8157
8158
8159/**
8160 * ### .getOwnEnumerableProperties(object)
8161 *
8162 * This allows the retrieval of directly-owned enumerable property names and
8163 * symbols of an object. This function is necessary because Object.keys only
8164 * returns enumerable property names, not enumerable property symbols.
8165 *
8166 * @param {Object} object
8167 * @returns {Array}
8168 * @namespace Utils
8169 * @name getOwnEnumerableProperties
8170 * @api public
8171 */
8172
8173var getOwnEnumerableProperties = function getOwnEnumerableProperties(obj) {
8174 return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
8175};
8176
8177/* !
8178 * Chai - checkError utility
8179 * Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com>
8180 * MIT Licensed
8181 */
8182
8183/**
8184 * ### .checkError
8185 *
8186 * Checks that an error conforms to a given set of criteria and/or retrieves information about it.
8187 *
8188 * @api public
8189 */
8190
8191/**
8192 * ### .compatibleInstance(thrown, errorLike)
8193 *
8194 * Checks if two instances are compatible (strict equal).
8195 * Returns false if errorLike is not an instance of Error, because instances
8196 * can only be compatible if they're both error instances.
8197 *
8198 * @name compatibleInstance
8199 * @param {Error} thrown error
8200 * @param {Error|ErrorConstructor} errorLike object to compare against
8201 * @namespace Utils
8202 * @api public
8203 */
8204
8205function compatibleInstance(thrown, errorLike) {
8206 return errorLike instanceof Error && thrown === errorLike;
8207}
8208
8209/**
8210 * ### .compatibleConstructor(thrown, errorLike)
8211 *
8212 * Checks if two constructors are compatible.
8213 * This function can receive either an error constructor or
8214 * an error instance as the `errorLike` argument.
8215 * Constructors are compatible if they're the same or if one is
8216 * an instance of another.
8217 *
8218 * @name compatibleConstructor
8219 * @param {Error} thrown error
8220 * @param {Error|ErrorConstructor} errorLike object to compare against
8221 * @namespace Utils
8222 * @api public
8223 */
8224
8225function compatibleConstructor(thrown, errorLike) {
8226 if (errorLike instanceof Error) {
8227 // If `errorLike` is an instance of any error we compare their constructors
8228 return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
8229 } else if (errorLike.prototype instanceof Error || errorLike === Error) {
8230 // If `errorLike` is a constructor that inherits from Error, we compare `thrown` to `errorLike` directly
8231 return thrown.constructor === errorLike || thrown instanceof errorLike;
8232 }
8233
8234 return false;
8235}
8236
8237/**
8238 * ### .compatibleMessage(thrown, errMatcher)
8239 *
8240 * Checks if an error's message is compatible with a matcher (String or RegExp).
8241 * If the message contains the String or passes the RegExp test,
8242 * it is considered compatible.
8243 *
8244 * @name compatibleMessage
8245 * @param {Error} thrown error
8246 * @param {String|RegExp} errMatcher to look for into the message
8247 * @namespace Utils
8248 * @api public
8249 */
8250
8251function compatibleMessage(thrown, errMatcher) {
8252 var comparisonString = typeof thrown === 'string' ? thrown : thrown.message;
8253 if (errMatcher instanceof RegExp) {
8254 return errMatcher.test(comparisonString);
8255 } else if (typeof errMatcher === 'string') {
8256 return comparisonString.indexOf(errMatcher) !== -1; // eslint-disable-line no-magic-numbers
8257 }
8258
8259 return false;
8260}
8261
8262/**
8263 * ### .getFunctionName(constructorFn)
8264 *
8265 * Returns the name of a function.
8266 * This also includes a polyfill function if `constructorFn.name` is not defined.
8267 *
8268 * @name getFunctionName
8269 * @param {Function} constructorFn
8270 * @namespace Utils
8271 * @api private
8272 */
8273
8274var functionNameMatch$1 = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\(\/]+)/;
8275function getFunctionName(constructorFn) {
8276 var name = '';
8277 if (typeof constructorFn.name === 'undefined') {
8278 // Here we run a polyfill if constructorFn.name is not defined
8279 var match = String(constructorFn).match(functionNameMatch$1);
8280 if (match) {
8281 name = match[1];
8282 }
8283 } else {
8284 name = constructorFn.name;
8285 }
8286
8287 return name;
8288}
8289
8290/**
8291 * ### .getConstructorName(errorLike)
8292 *
8293 * Gets the constructor name for an Error instance or constructor itself.
8294 *
8295 * @name getConstructorName
8296 * @param {Error|ErrorConstructor} errorLike
8297 * @namespace Utils
8298 * @api public
8299 */
8300
8301function getConstructorName(errorLike) {
8302 var constructorName = errorLike;
8303 if (errorLike instanceof Error) {
8304 constructorName = getFunctionName(errorLike.constructor);
8305 } else if (typeof errorLike === 'function') {
8306 // If `err` is not an instance of Error it is an error constructor itself or another function.
8307 // If we've got a common function we get its name, otherwise we may need to create a new instance
8308 // of the error just in case it's a poorly-constructed error. Please see chaijs/chai/issues/45 to know more.
8309 constructorName = getFunctionName(errorLike).trim() ||
8310 getFunctionName(new errorLike()); // eslint-disable-line new-cap
8311 }
8312
8313 return constructorName;
8314}
8315
8316/**
8317 * ### .getMessage(errorLike)
8318 *
8319 * Gets the error message from an error.
8320 * If `err` is a String itself, we return it.
8321 * If the error has no message, we return an empty string.
8322 *
8323 * @name getMessage
8324 * @param {Error|String} errorLike
8325 * @namespace Utils
8326 * @api public
8327 */
8328
8329function getMessage$2(errorLike) {
8330 var msg = '';
8331 if (errorLike && errorLike.message) {
8332 msg = errorLike.message;
8333 } else if (typeof errorLike === 'string') {
8334 msg = errorLike;
8335 }
8336
8337 return msg;
8338}
8339
8340var checkError = {
8341 compatibleInstance: compatibleInstance,
8342 compatibleConstructor: compatibleConstructor,
8343 compatibleMessage: compatibleMessage,
8344 getMessage: getMessage$2,
8345 getConstructorName: getConstructorName,
8346};
8347
8348/*!
8349 * Chai - isNaN utility
8350 * Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
8351 * MIT Licensed
8352 */
8353
8354/**
8355 * ### .isNaN(value)
8356 *
8357 * Checks if the given value is NaN or not.
8358 *
8359 * utils.isNaN(NaN); // true
8360 *
8361 * @param {Value} The value which has to be checked if it is NaN
8362 * @name isNaN
8363 * @api private
8364 */
8365
8366function isNaN$1(value) {
8367 // Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number
8368 // section's NOTE.
8369 return value !== value;
8370}
8371
8372// If ECMAScript 6's Number.isNaN is present, prefer that.
8373var _isNaN = Number.isNaN || isNaN$1;
8374
8375/*!
8376 * chai
8377 * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
8378 * MIT Licensed
8379 */
8380
8381/*!
8382 * Dependencies that are used for multiple exports are required here only once
8383 */
8384
8385
8386
8387/*!
8388 * test utility
8389 */
8390
8391var test$2 = test;
8392
8393/*!
8394 * type utility
8395 */
8396
8397var type = typeDetect;
8398
8399/*!
8400 * expectTypes utility
8401 */
8402var expectTypes$2 = expectTypes;
8403
8404/*!
8405 * message utility
8406 */
8407
8408var getMessage$3 = getMessage;
8409
8410/*!
8411 * actual utility
8412 */
8413
8414var getActual$2 = getActual;
8415
8416/*!
8417 * Inspect util
8418 */
8419
8420var inspect = inspect_1;
8421
8422/*!
8423 * Object Display util
8424 */
8425
8426var objDisplay$2 = objDisplay;
8427
8428/*!
8429 * Flag utility
8430 */
8431
8432var flag$2 = flag;
8433
8434/*!
8435 * Flag transferring utility
8436 */
8437
8438var transferFlags$2 = transferFlags;
8439
8440/*!
8441 * Deep equal utility
8442 */
8443
8444var eql = deepEql;
8445
8446/*!
8447 * Deep path info
8448 */
8449
8450var getPathInfo$1 = pathval.getPathInfo;
8451
8452/*!
8453 * Check if a property exists
8454 */
8455
8456var hasProperty$1 = pathval.hasProperty;
8457
8458/*!
8459 * Function name
8460 */
8461
8462var getName = getFuncName_1;
8463
8464/*!
8465 * add Property
8466 */
8467
8468var addProperty$2 = addProperty;
8469
8470/*!
8471 * add Method
8472 */
8473
8474var addMethod$2 = addMethod;
8475
8476/*!
8477 * overwrite Property
8478 */
8479
8480var overwriteProperty$2 = overwriteProperty;
8481
8482/*!
8483 * overwrite Method
8484 */
8485
8486var overwriteMethod$2 = overwriteMethod;
8487
8488/*!
8489 * Add a chainable method
8490 */
8491
8492var addChainableMethod$2 = addChainableMethod;
8493
8494/*!
8495 * Overwrite chainable method
8496 */
8497
8498var overwriteChainableMethod$2 = overwriteChainableMethod;
8499
8500/*!
8501 * Compare by inspect method
8502 */
8503
8504var compareByInspect$2 = compareByInspect;
8505
8506/*!
8507 * Get own enumerable property symbols method
8508 */
8509
8510var getOwnEnumerablePropertySymbols$2 = getOwnEnumerablePropertySymbols;
8511
8512/*!
8513 * Get own enumerable properties method
8514 */
8515
8516var getOwnEnumerableProperties$2 = getOwnEnumerableProperties;
8517
8518/*!
8519 * Checks error against a given set of criteria
8520 */
8521
8522var checkError$2 = checkError;
8523
8524/*!
8525 * Proxify util
8526 */
8527
8528var proxify$2 = proxify;
8529
8530/*!
8531 * addLengthGuard util
8532 */
8533
8534var addLengthGuard$2 = addLengthGuard;
8535
8536/*!
8537 * isProxyEnabled helper
8538 */
8539
8540var isProxyEnabled$2 = isProxyEnabled;
8541
8542/*!
8543 * isNaN method
8544 */
8545
8546var isNaN$2 = _isNaN;
8547
8548var utils = {
8549 test: test$2,
8550 type: type,
8551 expectTypes: expectTypes$2,
8552 getMessage: getMessage$3,
8553 getActual: getActual$2,
8554 inspect: inspect,
8555 objDisplay: objDisplay$2,
8556 flag: flag$2,
8557 transferFlags: transferFlags$2,
8558 eql: eql,
8559 getPathInfo: getPathInfo$1,
8560 hasProperty: hasProperty$1,
8561 getName: getName,
8562 addProperty: addProperty$2,
8563 addMethod: addMethod$2,
8564 overwriteProperty: overwriteProperty$2,
8565 overwriteMethod: overwriteMethod$2,
8566 addChainableMethod: addChainableMethod$2,
8567 overwriteChainableMethod: overwriteChainableMethod$2,
8568 compareByInspect: compareByInspect$2,
8569 getOwnEnumerablePropertySymbols: getOwnEnumerablePropertySymbols$2,
8570 getOwnEnumerableProperties: getOwnEnumerableProperties$2,
8571 checkError: checkError$2,
8572 proxify: proxify$2,
8573 addLengthGuard: addLengthGuard$2,
8574 isProxyEnabled: isProxyEnabled$2,
8575 isNaN: isNaN$2
8576};
8577
8578/*!
8579 * chai
8580 * http://chaijs.com
8581 * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
8582 * MIT Licensed
8583 */
8584
8585
8586
8587var assertion = function (_chai, util) {
8588 /*!
8589 * Module dependencies.
8590 */
8591
8592 var AssertionError = _chai.AssertionError
8593 , flag = util.flag;
8594
8595 /*!
8596 * Module export.
8597 */
8598
8599 _chai.Assertion = Assertion;
8600
8601 /*!
8602 * Assertion Constructor
8603 *
8604 * Creates object for chaining.
8605 *
8606 * `Assertion` objects contain metadata in the form of flags. Three flags can
8607 * be assigned during instantiation by passing arguments to this constructor:
8608 *
8609 * - `object`: This flag contains the target of the assertion. For example, in
8610 * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
8611 * contain `numKittens` so that the `equal` assertion can reference it when
8612 * needed.
8613 *
8614 * - `message`: This flag contains an optional custom error message to be
8615 * prepended to the error message that's generated by the assertion when it
8616 * fails.
8617 *
8618 * - `ssfi`: This flag stands for "start stack function indicator". It
8619 * contains a function reference that serves as the starting point for
8620 * removing frames from the stack trace of the error that's created by the
8621 * assertion when it fails. The goal is to provide a cleaner stack trace to
8622 * end users by removing Chai's internal functions. Note that it only works
8623 * in environments that support `Error.captureStackTrace`, and only when
8624 * `Chai.config.includeStack` hasn't been set to `false`.
8625 *
8626 * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
8627 * should retain its current value, even as assertions are chained off of
8628 * this object. This is usually set to `true` when creating a new assertion
8629 * from within another assertion. It's also temporarily set to `true` before
8630 * an overwritten assertion gets called by the overwriting assertion.
8631 *
8632 * @param {Mixed} obj target of the assertion
8633 * @param {String} msg (optional) custom error message
8634 * @param {Function} ssfi (optional) starting point for removing stack frames
8635 * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked
8636 * @api private
8637 */
8638
8639 function Assertion (obj, msg, ssfi, lockSsfi) {
8640 flag(this, 'ssfi', ssfi || Assertion);
8641 flag(this, 'lockSsfi', lockSsfi);
8642 flag(this, 'object', obj);
8643 flag(this, 'message', msg);
8644
8645 return util.proxify(this);
8646 }
8647
8648 Object.defineProperty(Assertion, 'includeStack', {
8649 get: function() {
8650 console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
8651 return config.includeStack;
8652 },
8653 set: function(value) {
8654 console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
8655 config.includeStack = value;
8656 }
8657 });
8658
8659 Object.defineProperty(Assertion, 'showDiff', {
8660 get: function() {
8661 console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
8662 return config.showDiff;
8663 },
8664 set: function(value) {
8665 console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
8666 config.showDiff = value;
8667 }
8668 });
8669
8670 Assertion.addProperty = function (name, fn) {
8671 util.addProperty(this.prototype, name, fn);
8672 };
8673
8674 Assertion.addMethod = function (name, fn) {
8675 util.addMethod(this.prototype, name, fn);
8676 };
8677
8678 Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
8679 util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
8680 };
8681
8682 Assertion.overwriteProperty = function (name, fn) {
8683 util.overwriteProperty(this.prototype, name, fn);
8684 };
8685
8686 Assertion.overwriteMethod = function (name, fn) {
8687 util.overwriteMethod(this.prototype, name, fn);
8688 };
8689
8690 Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
8691 util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
8692 };
8693
8694 /**
8695 * ### .assert(expression, message, negateMessage, expected, actual, showDiff)
8696 *
8697 * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
8698 *
8699 * @name assert
8700 * @param {Philosophical} expression to be tested
8701 * @param {String|Function} message or function that returns message to display if expression fails
8702 * @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails
8703 * @param {Mixed} expected value (remember to check for negation)
8704 * @param {Mixed} actual (optional) will default to `this.obj`
8705 * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
8706 * @api private
8707 */
8708
8709 Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
8710 var ok = util.test(this, arguments);
8711 if (false !== showDiff) showDiff = true;
8712 if (undefined === expected && undefined === _actual) showDiff = false;
8713 if (true !== config.showDiff) showDiff = false;
8714
8715 if (!ok) {
8716 msg = util.getMessage(this, arguments);
8717 var actual = util.getActual(this, arguments);
8718 throw new AssertionError(msg, {
8719 actual: actual
8720 , expected: expected
8721 , showDiff: showDiff
8722 }, (config.includeStack) ? this.assert : flag(this, 'ssfi'));
8723 }
8724 };
8725
8726 /*!
8727 * ### ._obj
8728 *
8729 * Quick reference to stored `actual` value for plugin developers.
8730 *
8731 * @api private
8732 */
8733
8734 Object.defineProperty(Assertion.prototype, '_obj',
8735 { get: function () {
8736 return flag(this, 'object');
8737 }
8738 , set: function (val) {
8739 flag(this, 'object', val);
8740 }
8741 });
8742};
8743
8744/*!
8745 * chai
8746 * http://chaijs.com
8747 * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
8748 * MIT Licensed
8749 */
8750
8751var assertions = function (chai, _) {
8752 var Assertion = chai.Assertion
8753 , AssertionError = chai.AssertionError
8754 , flag = _.flag;
8755
8756 /**
8757 * ### Language Chains
8758 *
8759 * The following are provided as chainable getters to improve the readability
8760 * of your assertions.
8761 *
8762 * **Chains**
8763 *
8764 * - to
8765 * - be
8766 * - been
8767 * - is
8768 * - that
8769 * - which
8770 * - and
8771 * - has
8772 * - have
8773 * - with
8774 * - at
8775 * - of
8776 * - same
8777 * - but
8778 * - does
8779 *
8780 * @name language chains
8781 * @namespace BDD
8782 * @api public
8783 */
8784
8785 [ 'to', 'be', 'been'
8786 , 'is', 'and', 'has', 'have'
8787 , 'with', 'that', 'which', 'at'
8788 , 'of', 'same', 'but', 'does' ].forEach(function (chain) {
8789 Assertion.addProperty(chain);
8790 });
8791
8792 /**
8793 * ### .not
8794 *
8795 * Negates all assertions that follow in the chain.
8796 *
8797 * expect(function () {}).to.not.throw();
8798 * expect({a: 1}).to.not.have.property('b');
8799 * expect([1, 2]).to.be.an('array').that.does.not.include(3);
8800 *
8801 * Just because you can negate any assertion with `.not` doesn't mean you
8802 * should. With great power comes great responsibility. It's often best to
8803 * assert that the one expected output was produced, rather than asserting
8804 * that one of countless unexpected outputs wasn't produced. See individual
8805 * assertions for specific guidance.
8806 *
8807 * expect(2).to.equal(2); // Recommended
8808 * expect(2).to.not.equal(1); // Not recommended
8809 *
8810 * @name not
8811 * @namespace BDD
8812 * @api public
8813 */
8814
8815 Assertion.addProperty('not', function () {
8816 flag(this, 'negate', true);
8817 });
8818
8819 /**
8820 * ### .deep
8821 *
8822 * Causes all `.equal`, `.include`, `.members`, `.keys`, and `.property`
8823 * assertions that follow in the chain to use deep equality instead of strict
8824 * (`===`) equality. See the `deep-eql` project page for info on the deep
8825 * equality algorithm: https://github.com/chaijs/deep-eql.
8826 *
8827 * // Target object deeply (but not strictly) equals `{a: 1}`
8828 * expect({a: 1}).to.deep.equal({a: 1});
8829 * expect({a: 1}).to.not.equal({a: 1});
8830 *
8831 * // Target array deeply (but not strictly) includes `{a: 1}`
8832 * expect([{a: 1}]).to.deep.include({a: 1});
8833 * expect([{a: 1}]).to.not.include({a: 1});
8834 *
8835 * // Target object deeply (but not strictly) includes `x: {a: 1}`
8836 * expect({x: {a: 1}}).to.deep.include({x: {a: 1}});
8837 * expect({x: {a: 1}}).to.not.include({x: {a: 1}});
8838 *
8839 * // Target array deeply (but not strictly) has member `{a: 1}`
8840 * expect([{a: 1}]).to.have.deep.members([{a: 1}]);
8841 * expect([{a: 1}]).to.not.have.members([{a: 1}]);
8842 *
8843 * // Target set deeply (but not strictly) has key `{a: 1}`
8844 * expect(new Set([{a: 1}])).to.have.deep.keys([{a: 1}]);
8845 * expect(new Set([{a: 1}])).to.not.have.keys([{a: 1}]);
8846 *
8847 * // Target object deeply (but not strictly) has property `x: {a: 1}`
8848 * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1});
8849 * expect({x: {a: 1}}).to.not.have.property('x', {a: 1});
8850 *
8851 * @name deep
8852 * @namespace BDD
8853 * @api public
8854 */
8855
8856 Assertion.addProperty('deep', function () {
8857 flag(this, 'deep', true);
8858 });
8859
8860 /**
8861 * ### .nested
8862 *
8863 * Enables dot- and bracket-notation in all `.property` and `.include`
8864 * assertions that follow in the chain.
8865 *
8866 * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]');
8867 * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'});
8868 *
8869 * If `.` or `[]` are part of an actual property name, they can be escaped by
8870 * adding two backslashes before them.
8871 *
8872 * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]');
8873 * expect({'.a': {'[b]': 'x'}}).to.nested.include({'\\.a.\\[b\\]': 'x'});
8874 *
8875 * `.nested` cannot be combined with `.own`.
8876 *
8877 * @name nested
8878 * @namespace BDD
8879 * @api public
8880 */
8881
8882 Assertion.addProperty('nested', function () {
8883 flag(this, 'nested', true);
8884 });
8885
8886 /**
8887 * ### .own
8888 *
8889 * Causes all `.property` and `.include` assertions that follow in the chain
8890 * to ignore inherited properties.
8891 *
8892 * Object.prototype.b = 2;
8893 *
8894 * expect({a: 1}).to.have.own.property('a');
8895 * expect({a: 1}).to.have.property('b').but.not.own.property('b');
8896 *
8897 * expect({a: 1}).to.own.include({a: 1});
8898 * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2});
8899 *
8900 * `.own` cannot be combined with `.nested`.
8901 *
8902 * @name own
8903 * @namespace BDD
8904 * @api public
8905 */
8906
8907 Assertion.addProperty('own', function () {
8908 flag(this, 'own', true);
8909 });
8910
8911 /**
8912 * ### .ordered
8913 *
8914 * Causes all `.members` assertions that follow in the chain to require that
8915 * members be in the same order.
8916 *
8917 * expect([1, 2]).to.have.ordered.members([1, 2])
8918 * .but.not.have.ordered.members([2, 1]);
8919 *
8920 * When `.include` and `.ordered` are combined, the ordering begins at the
8921 * start of both arrays.
8922 *
8923 * expect([1, 2, 3]).to.include.ordered.members([1, 2])
8924 * .but.not.include.ordered.members([2, 3]);
8925 *
8926 * @name ordered
8927 * @namespace BDD
8928 * @api public
8929 */
8930
8931 Assertion.addProperty('ordered', function () {
8932 flag(this, 'ordered', true);
8933 });
8934
8935 /**
8936 * ### .any
8937 *
8938 * Causes all `.keys` assertions that follow in the chain to only require that
8939 * the target have at least one of the given keys. This is the opposite of
8940 * `.all`, which requires that the target have all of the given keys.
8941 *
8942 * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd');
8943 *
8944 * See the `.keys` doc for guidance on when to use `.any` or `.all`.
8945 *
8946 * @name any
8947 * @namespace BDD
8948 * @api public
8949 */
8950
8951 Assertion.addProperty('any', function () {
8952 flag(this, 'any', true);
8953 flag(this, 'all', false);
8954 });
8955
8956
8957 /**
8958 * ### .all
8959 *
8960 * Causes all `.keys` assertions that follow in the chain to require that the
8961 * target have all of the given keys. This is the opposite of `.any`, which
8962 * only requires that the target have at least one of the given keys.
8963 *
8964 * expect({a: 1, b: 2}).to.have.all.keys('a', 'b');
8965 *
8966 * Note that `.all` is used by default when neither `.all` nor `.any` are
8967 * added earlier in the chain. However, it's often best to add `.all` anyway
8968 * because it improves readability.
8969 *
8970 * See the `.keys` doc for guidance on when to use `.any` or `.all`.
8971 *
8972 * @name all
8973 * @namespace BDD
8974 * @api public
8975 */
8976
8977 Assertion.addProperty('all', function () {
8978 flag(this, 'all', true);
8979 flag(this, 'any', false);
8980 });
8981
8982 /**
8983 * ### .a(type[, msg])
8984 *
8985 * Asserts that the target's type is equal to the given string `type`. Types
8986 * are case insensitive. See the `type-detect` project page for info on the
8987 * type detection algorithm: https://github.com/chaijs/type-detect.
8988 *
8989 * expect('foo').to.be.a('string');
8990 * expect({a: 1}).to.be.an('object');
8991 * expect(null).to.be.a('null');
8992 * expect(undefined).to.be.an('undefined');
8993 * expect(new Error).to.be.an('error');
8994 * expect(Promise.resolve()).to.be.a('promise');
8995 * expect(new Float32Array).to.be.a('float32array');
8996 * expect(Symbol()).to.be.a('symbol');
8997 *
8998 * `.a` supports objects that have a custom type set via `Symbol.toStringTag`.
8999 *
9000 * var myObj = {
9001 * [Symbol.toStringTag]: 'myCustomType'
9002 * };
9003 *
9004 * expect(myObj).to.be.a('myCustomType').but.not.an('object');
9005 *
9006 * It's often best to use `.a` to check a target's type before making more
9007 * assertions on the same target. That way, you avoid unexpected behavior from
9008 * any assertion that does different things based on the target's type.
9009 *
9010 * expect([1, 2, 3]).to.be.an('array').that.includes(2);
9011 * expect([]).to.be.an('array').that.is.empty;
9012 *
9013 * Add `.not` earlier in the chain to negate `.a`. However, it's often best to
9014 * assert that the target is the expected type, rather than asserting that it
9015 * isn't one of many unexpected types.
9016 *
9017 * expect('foo').to.be.a('string'); // Recommended
9018 * expect('foo').to.not.be.an('array'); // Not recommended
9019 *
9020 * `.a` accepts an optional `msg` argument which is a custom error message to
9021 * show when the assertion fails. The message can also be given as the second
9022 * argument to `expect`.
9023 *
9024 * expect(1).to.be.a('string', 'nooo why fail??');
9025 * expect(1, 'nooo why fail??').to.be.a('string');
9026 *
9027 * `.a` can also be used as a language chain to improve the readability of
9028 * your assertions.
9029 *
9030 * expect({b: 2}).to.have.a.property('b');
9031 *
9032 * The alias `.an` can be used interchangeably with `.a`.
9033 *
9034 * @name a
9035 * @alias an
9036 * @param {String} type
9037 * @param {String} msg _optional_
9038 * @namespace BDD
9039 * @api public
9040 */
9041
9042 function an (type, msg) {
9043 if (msg) flag(this, 'message', msg);
9044 type = type.toLowerCase();
9045 var obj = flag(this, 'object')
9046 , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a ';
9047
9048 this.assert(
9049 type === _.type(obj).toLowerCase()
9050 , 'expected #{this} to be ' + article + type
9051 , 'expected #{this} not to be ' + article + type
9052 );
9053 }
9054
9055 Assertion.addChainableMethod('an', an);
9056 Assertion.addChainableMethod('a', an);
9057
9058 /**
9059 * ### .include(val[, msg])
9060 *
9061 * When the target is a string, `.include` asserts that the given string `val`
9062 * is a substring of the target.
9063 *
9064 * expect('foobar').to.include('foo');
9065 *
9066 * When the target is an array, `.include` asserts that the given `val` is a
9067 * member of the target.
9068 *
9069 * expect([1, 2, 3]).to.include(2);
9070 *
9071 * When the target is an object, `.include` asserts that the given object
9072 * `val`'s properties are a subset of the target's properties.
9073 *
9074 * expect({a: 1, b: 2, c: 3}).to.include({a: 1, b: 2});
9075 *
9076 * When the target is a Set or WeakSet, `.include` asserts that the given `val` is a
9077 * member of the target. SameValueZero equality algorithm is used.
9078 *
9079 * expect(new Set([1, 2])).to.include(2);
9080 *
9081 * When the target is a Map, `.include` asserts that the given `val` is one of
9082 * the values of the target. SameValueZero equality algorithm is used.
9083 *
9084 * expect(new Map([['a', 1], ['b', 2]])).to.include(2);
9085 *
9086 * Because `.include` does different things based on the target's type, it's
9087 * important to check the target's type before using `.include`. See the `.a`
9088 * doc for info on testing a target's type.
9089 *
9090 * expect([1, 2, 3]).to.be.an('array').that.includes(2);
9091 *
9092 * By default, strict (`===`) equality is used to compare array members and
9093 * object properties. Add `.deep` earlier in the chain to use deep equality
9094 * instead (WeakSet targets are not supported). See the `deep-eql` project
9095 * page for info on the deep equality algorithm: https://github.com/chaijs/deep-eql.
9096 *
9097 * // Target array deeply (but not strictly) includes `{a: 1}`
9098 * expect([{a: 1}]).to.deep.include({a: 1});
9099 * expect([{a: 1}]).to.not.include({a: 1});
9100 *
9101 * // Target object deeply (but not strictly) includes `x: {a: 1}`
9102 * expect({x: {a: 1}}).to.deep.include({x: {a: 1}});
9103 * expect({x: {a: 1}}).to.not.include({x: {a: 1}});
9104 *
9105 * By default, all of the target's properties are searched when working with
9106 * objects. This includes properties that are inherited and/or non-enumerable.
9107 * Add `.own` earlier in the chain to exclude the target's inherited
9108 * properties from the search.
9109 *
9110 * Object.prototype.b = 2;
9111 *
9112 * expect({a: 1}).to.own.include({a: 1});
9113 * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2});
9114 *
9115 * Note that a target object is always only searched for `val`'s own
9116 * enumerable properties.
9117 *
9118 * `.deep` and `.own` can be combined.
9119 *
9120 * expect({a: {b: 2}}).to.deep.own.include({a: {b: 2}});
9121 *
9122 * Add `.nested` earlier in the chain to enable dot- and bracket-notation when
9123 * referencing nested properties.
9124 *
9125 * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'});
9126 *
9127 * If `.` or `[]` are part of an actual property name, they can be escaped by
9128 * adding two backslashes before them.
9129 *
9130 * expect({'.a': {'[b]': 2}}).to.nested.include({'\\.a.\\[b\\]': 2});
9131 *
9132 * `.deep` and `.nested` can be combined.
9133 *
9134 * expect({a: {b: [{c: 3}]}}).to.deep.nested.include({'a.b[0]': {c: 3}});
9135 *
9136 * `.own` and `.nested` cannot be combined.
9137 *
9138 * Add `.not` earlier in the chain to negate `.include`.
9139 *
9140 * expect('foobar').to.not.include('taco');
9141 * expect([1, 2, 3]).to.not.include(4);
9142 *
9143 * However, it's dangerous to negate `.include` when the target is an object.
9144 * The problem is that it creates uncertain expectations by asserting that the
9145 * target object doesn't have all of `val`'s key/value pairs but may or may
9146 * not have some of them. It's often best to identify the exact output that's
9147 * expected, and then write an assertion that only accepts that exact output.
9148 *
9149 * When the target object isn't even expected to have `val`'s keys, it's
9150 * often best to assert exactly that.
9151 *
9152 * expect({c: 3}).to.not.have.any.keys('a', 'b'); // Recommended
9153 * expect({c: 3}).to.not.include({a: 1, b: 2}); // Not recommended
9154 *
9155 * When the target object is expected to have `val`'s keys, it's often best to
9156 * assert that each of the properties has its expected value, rather than
9157 * asserting that each property doesn't have one of many unexpected values.
9158 *
9159 * expect({a: 3, b: 4}).to.include({a: 3, b: 4}); // Recommended
9160 * expect({a: 3, b: 4}).to.not.include({a: 1, b: 2}); // Not recommended
9161 *
9162 * `.include` accepts an optional `msg` argument which is a custom error
9163 * message to show when the assertion fails. The message can also be given as
9164 * the second argument to `expect`.
9165 *
9166 * expect([1, 2, 3]).to.include(4, 'nooo why fail??');
9167 * expect([1, 2, 3], 'nooo why fail??').to.include(4);
9168 *
9169 * `.include` can also be used as a language chain, causing all `.members` and
9170 * `.keys` assertions that follow in the chain to require the target to be a
9171 * superset of the expected set, rather than an identical set. Note that
9172 * `.members` ignores duplicates in the subset when `.include` is added.
9173 *
9174 * // Target object's keys are a superset of ['a', 'b'] but not identical
9175 * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b');
9176 * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b');
9177 *
9178 * // Target array is a superset of [1, 2] but not identical
9179 * expect([1, 2, 3]).to.include.members([1, 2]);
9180 * expect([1, 2, 3]).to.not.have.members([1, 2]);
9181 *
9182 * // Duplicates in the subset are ignored
9183 * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]);
9184 *
9185 * Note that adding `.any` earlier in the chain causes the `.keys` assertion
9186 * to ignore `.include`.
9187 *
9188 * // Both assertions are identical
9189 * expect({a: 1}).to.include.any.keys('a', 'b');
9190 * expect({a: 1}).to.have.any.keys('a', 'b');
9191 *
9192 * The aliases `.includes`, `.contain`, and `.contains` can be used
9193 * interchangeably with `.include`.
9194 *
9195 * @name include
9196 * @alias contain
9197 * @alias includes
9198 * @alias contains
9199 * @param {Mixed} val
9200 * @param {String} msg _optional_
9201 * @namespace BDD
9202 * @api public
9203 */
9204
9205 function SameValueZero(a, b) {
9206 return (_.isNaN(a) && _.isNaN(b)) || a === b;
9207 }
9208
9209 function includeChainingBehavior () {
9210 flag(this, 'contains', true);
9211 }
9212
9213 function include (val, msg) {
9214 if (msg) flag(this, 'message', msg);
9215
9216 var obj = flag(this, 'object')
9217 , objType = _.type(obj).toLowerCase()
9218 , flagMsg = flag(this, 'message')
9219 , negate = flag(this, 'negate')
9220 , ssfi = flag(this, 'ssfi')
9221 , isDeep = flag(this, 'deep')
9222 , descriptor = isDeep ? 'deep ' : '';
9223
9224 flagMsg = flagMsg ? flagMsg + ': ' : '';
9225
9226 var included = false;
9227
9228 switch (objType) {
9229 case 'string':
9230 included = obj.indexOf(val) !== -1;
9231 break;
9232
9233 case 'weakset':
9234 if (isDeep) {
9235 throw new AssertionError(
9236 flagMsg + 'unable to use .deep.include with WeakSet',
9237 undefined,
9238 ssfi
9239 );
9240 }
9241
9242 included = obj.has(val);
9243 break;
9244
9245 case 'map':
9246 var isEql = isDeep ? _.eql : SameValueZero;
9247 obj.forEach(function (item) {
9248 included = included || isEql(item, val);
9249 });
9250 break;
9251
9252 case 'set':
9253 if (isDeep) {
9254 obj.forEach(function (item) {
9255 included = included || _.eql(item, val);
9256 });
9257 } else {
9258 included = obj.has(val);
9259 }
9260 break;
9261
9262 case 'array':
9263 if (isDeep) {
9264 included = obj.some(function (item) {
9265 return _.eql(item, val);
9266 });
9267 } else {
9268 included = obj.indexOf(val) !== -1;
9269 }
9270 break;
9271
9272 default:
9273 // This block is for asserting a subset of properties in an object.
9274 // `_.expectTypes` isn't used here because `.include` should work with
9275 // objects with a custom `@@toStringTag`.
9276 if (val !== Object(val)) {
9277 throw new AssertionError(
9278 flagMsg + 'object tested must be an array, a map, an object,'
9279 + ' a set, a string, or a weakset, but ' + objType + ' given',
9280 undefined,
9281 ssfi
9282 );
9283 }
9284
9285 var props = Object.keys(val)
9286 , firstErr = null
9287 , numErrs = 0;
9288
9289 props.forEach(function (prop) {
9290 var propAssertion = new Assertion(obj);
9291 _.transferFlags(this, propAssertion, true);
9292 flag(propAssertion, 'lockSsfi', true);
9293
9294 if (!negate || props.length === 1) {
9295 propAssertion.property(prop, val[prop]);
9296 return;
9297 }
9298
9299 try {
9300 propAssertion.property(prop, val[prop]);
9301 } catch (err) {
9302 if (!_.checkError.compatibleConstructor(err, AssertionError)) {
9303 throw err;
9304 }
9305 if (firstErr === null) firstErr = err;
9306 numErrs++;
9307 }
9308 }, this);
9309
9310 // When validating .not.include with multiple properties, we only want
9311 // to throw an assertion error if all of the properties are included,
9312 // in which case we throw the first property assertion error that we
9313 // encountered.
9314 if (negate && props.length > 1 && numErrs === props.length) {
9315 throw firstErr;
9316 }
9317 return;
9318 }
9319
9320 // Assert inclusion in collection or substring in a string.
9321 this.assert(
9322 included
9323 , 'expected #{this} to ' + descriptor + 'include ' + _.inspect(val)
9324 , 'expected #{this} to not ' + descriptor + 'include ' + _.inspect(val));
9325 }
9326
9327 Assertion.addChainableMethod('include', include, includeChainingBehavior);
9328 Assertion.addChainableMethod('contain', include, includeChainingBehavior);
9329 Assertion.addChainableMethod('contains', include, includeChainingBehavior);
9330 Assertion.addChainableMethod('includes', include, includeChainingBehavior);
9331
9332 /**
9333 * ### .ok
9334 *
9335 * Asserts that the target is loosely (`==`) equal to `true`. However, it's
9336 * often best to assert that the target is strictly (`===`) or deeply equal to
9337 * its expected value.
9338 *
9339 * expect(1).to.equal(1); // Recommended
9340 * expect(1).to.be.ok; // Not recommended
9341 *
9342 * expect(true).to.be.true; // Recommended
9343 * expect(true).to.be.ok; // Not recommended
9344 *
9345 * Add `.not` earlier in the chain to negate `.ok`.
9346 *
9347 * expect(0).to.equal(0); // Recommended
9348 * expect(0).to.not.be.ok; // Not recommended
9349 *
9350 * expect(false).to.be.false; // Recommended
9351 * expect(false).to.not.be.ok; // Not recommended
9352 *
9353 * expect(null).to.be.null; // Recommended
9354 * expect(null).to.not.be.ok; // Not recommended
9355 *
9356 * expect(undefined).to.be.undefined; // Recommended
9357 * expect(undefined).to.not.be.ok; // Not recommended
9358 *
9359 * A custom error message can be given as the second argument to `expect`.
9360 *
9361 * expect(false, 'nooo why fail??').to.be.ok;
9362 *
9363 * @name ok
9364 * @namespace BDD
9365 * @api public
9366 */
9367
9368 Assertion.addProperty('ok', function () {
9369 this.assert(
9370 flag(this, 'object')
9371 , 'expected #{this} to be truthy'
9372 , 'expected #{this} to be falsy');
9373 });
9374
9375 /**
9376 * ### .true
9377 *
9378 * Asserts that the target is strictly (`===`) equal to `true`.
9379 *
9380 * expect(true).to.be.true;
9381 *
9382 * Add `.not` earlier in the chain to negate `.true`. However, it's often best
9383 * to assert that the target is equal to its expected value, rather than not
9384 * equal to `true`.
9385 *
9386 * expect(false).to.be.false; // Recommended
9387 * expect(false).to.not.be.true; // Not recommended
9388 *
9389 * expect(1).to.equal(1); // Recommended
9390 * expect(1).to.not.be.true; // Not recommended
9391 *
9392 * A custom error message can be given as the second argument to `expect`.
9393 *
9394 * expect(false, 'nooo why fail??').to.be.true;
9395 *
9396 * @name true
9397 * @namespace BDD
9398 * @api public
9399 */
9400
9401 Assertion.addProperty('true', function () {
9402 this.assert(
9403 true === flag(this, 'object')
9404 , 'expected #{this} to be true'
9405 , 'expected #{this} to be false'
9406 , flag(this, 'negate') ? false : true
9407 );
9408 });
9409
9410 /**
9411 * ### .false
9412 *
9413 * Asserts that the target is strictly (`===`) equal to `false`.
9414 *
9415 * expect(false).to.be.false;
9416 *
9417 * Add `.not` earlier in the chain to negate `.false`. However, it's often
9418 * best to assert that the target is equal to its expected value, rather than
9419 * not equal to `false`.
9420 *
9421 * expect(true).to.be.true; // Recommended
9422 * expect(true).to.not.be.false; // Not recommended
9423 *
9424 * expect(1).to.equal(1); // Recommended
9425 * expect(1).to.not.be.false; // Not recommended
9426 *
9427 * A custom error message can be given as the second argument to `expect`.
9428 *
9429 * expect(true, 'nooo why fail??').to.be.false;
9430 *
9431 * @name false
9432 * @namespace BDD
9433 * @api public
9434 */
9435
9436 Assertion.addProperty('false', function () {
9437 this.assert(
9438 false === flag(this, 'object')
9439 , 'expected #{this} to be false'
9440 , 'expected #{this} to be true'
9441 , flag(this, 'negate') ? true : false
9442 );
9443 });
9444
9445 /**
9446 * ### .null
9447 *
9448 * Asserts that the target is strictly (`===`) equal to `null`.
9449 *
9450 * expect(null).to.be.null;
9451 *
9452 * Add `.not` earlier in the chain to negate `.null`. However, it's often best
9453 * to assert that the target is equal to its expected value, rather than not
9454 * equal to `null`.
9455 *
9456 * expect(1).to.equal(1); // Recommended
9457 * expect(1).to.not.be.null; // Not recommended
9458 *
9459 * A custom error message can be given as the second argument to `expect`.
9460 *
9461 * expect(42, 'nooo why fail??').to.be.null;
9462 *
9463 * @name null
9464 * @namespace BDD
9465 * @api public
9466 */
9467
9468 Assertion.addProperty('null', function () {
9469 this.assert(
9470 null === flag(this, 'object')
9471 , 'expected #{this} to be null'
9472 , 'expected #{this} not to be null'
9473 );
9474 });
9475
9476 /**
9477 * ### .undefined
9478 *
9479 * Asserts that the target is strictly (`===`) equal to `undefined`.
9480 *
9481 * expect(undefined).to.be.undefined;
9482 *
9483 * Add `.not` earlier in the chain to negate `.undefined`. However, it's often
9484 * best to assert that the target is equal to its expected value, rather than
9485 * not equal to `undefined`.
9486 *
9487 * expect(1).to.equal(1); // Recommended
9488 * expect(1).to.not.be.undefined; // Not recommended
9489 *
9490 * A custom error message can be given as the second argument to `expect`.
9491 *
9492 * expect(42, 'nooo why fail??').to.be.undefined;
9493 *
9494 * @name undefined
9495 * @namespace BDD
9496 * @api public
9497 */
9498
9499 Assertion.addProperty('undefined', function () {
9500 this.assert(
9501 undefined === flag(this, 'object')
9502 , 'expected #{this} to be undefined'
9503 , 'expected #{this} not to be undefined'
9504 );
9505 });
9506
9507 /**
9508 * ### .NaN
9509 *
9510 * Asserts that the target is exactly `NaN`.
9511 *
9512 * expect(NaN).to.be.NaN;
9513 *
9514 * Add `.not` earlier in the chain to negate `.NaN`. However, it's often best
9515 * to assert that the target is equal to its expected value, rather than not
9516 * equal to `NaN`.
9517 *
9518 * expect('foo').to.equal('foo'); // Recommended
9519 * expect('foo').to.not.be.NaN; // Not recommended
9520 *
9521 * A custom error message can be given as the second argument to `expect`.
9522 *
9523 * expect(42, 'nooo why fail??').to.be.NaN;
9524 *
9525 * @name NaN
9526 * @namespace BDD
9527 * @api public
9528 */
9529
9530 Assertion.addProperty('NaN', function () {
9531 this.assert(
9532 _.isNaN(flag(this, 'object'))
9533 , 'expected #{this} to be NaN'
9534 , 'expected #{this} not to be NaN'
9535 );
9536 });
9537
9538 /**
9539 * ### .exist
9540 *
9541 * Asserts that the target is not strictly (`===`) equal to either `null` or
9542 * `undefined`. However, it's often best to assert that the target is equal to
9543 * its expected value.
9544 *
9545 * expect(1).to.equal(1); // Recommended
9546 * expect(1).to.exist; // Not recommended
9547 *
9548 * expect(0).to.equal(0); // Recommended
9549 * expect(0).to.exist; // Not recommended
9550 *
9551 * Add `.not` earlier in the chain to negate `.exist`.
9552 *
9553 * expect(null).to.be.null; // Recommended
9554 * expect(null).to.not.exist; // Not recommended
9555 *
9556 * expect(undefined).to.be.undefined; // Recommended
9557 * expect(undefined).to.not.exist; // Not recommended
9558 *
9559 * A custom error message can be given as the second argument to `expect`.
9560 *
9561 * expect(null, 'nooo why fail??').to.exist;
9562 *
9563 * @name exist
9564 * @namespace BDD
9565 * @api public
9566 */
9567
9568 Assertion.addProperty('exist', function () {
9569 var val = flag(this, 'object');
9570 this.assert(
9571 val !== null && val !== undefined
9572 , 'expected #{this} to exist'
9573 , 'expected #{this} to not exist'
9574 );
9575 });
9576
9577 /**
9578 * ### .empty
9579 *
9580 * When the target is a string or array, `.empty` asserts that the target's
9581 * `length` property is strictly (`===`) equal to `0`.
9582 *
9583 * expect([]).to.be.empty;
9584 * expect('').to.be.empty;
9585 *
9586 * When the target is a map or set, `.empty` asserts that the target's `size`
9587 * property is strictly equal to `0`.
9588 *
9589 * expect(new Set()).to.be.empty;
9590 * expect(new Map()).to.be.empty;
9591 *
9592 * When the target is a non-function object, `.empty` asserts that the target
9593 * doesn't have any own enumerable properties. Properties with Symbol-based
9594 * keys are excluded from the count.
9595 *
9596 * expect({}).to.be.empty;
9597 *
9598 * Because `.empty` does different things based on the target's type, it's
9599 * important to check the target's type before using `.empty`. See the `.a`
9600 * doc for info on testing a target's type.
9601 *
9602 * expect([]).to.be.an('array').that.is.empty;
9603 *
9604 * Add `.not` earlier in the chain to negate `.empty`. However, it's often
9605 * best to assert that the target contains its expected number of values,
9606 * rather than asserting that it's not empty.
9607 *
9608 * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended
9609 * expect([1, 2, 3]).to.not.be.empty; // Not recommended
9610 *
9611 * expect(new Set([1, 2, 3])).to.have.property('size', 3); // Recommended
9612 * expect(new Set([1, 2, 3])).to.not.be.empty; // Not recommended
9613 *
9614 * expect(Object.keys({a: 1})).to.have.lengthOf(1); // Recommended
9615 * expect({a: 1}).to.not.be.empty; // Not recommended
9616 *
9617 * A custom error message can be given as the second argument to `expect`.
9618 *
9619 * expect([1, 2, 3], 'nooo why fail??').to.be.empty;
9620 *
9621 * @name empty
9622 * @namespace BDD
9623 * @api public
9624 */
9625
9626 Assertion.addProperty('empty', function () {
9627 var val = flag(this, 'object')
9628 , ssfi = flag(this, 'ssfi')
9629 , flagMsg = flag(this, 'message')
9630 , itemsCount;
9631
9632 flagMsg = flagMsg ? flagMsg + ': ' : '';
9633
9634 switch (_.type(val).toLowerCase()) {
9635 case 'array':
9636 case 'string':
9637 itemsCount = val.length;
9638 break;
9639 case 'map':
9640 case 'set':
9641 itemsCount = val.size;
9642 break;
9643 case 'weakmap':
9644 case 'weakset':
9645 throw new AssertionError(
9646 flagMsg + '.empty was passed a weak collection',
9647 undefined,
9648 ssfi
9649 );
9650 case 'function':
9651 var msg = flagMsg + '.empty was passed a function ' + _.getName(val);
9652 throw new AssertionError(msg.trim(), undefined, ssfi);
9653 default:
9654 if (val !== Object(val)) {
9655 throw new AssertionError(
9656 flagMsg + '.empty was passed non-string primitive ' + _.inspect(val),
9657 undefined,
9658 ssfi
9659 );
9660 }
9661 itemsCount = Object.keys(val).length;
9662 }
9663
9664 this.assert(
9665 0 === itemsCount
9666 , 'expected #{this} to be empty'
9667 , 'expected #{this} not to be empty'
9668 );
9669 });
9670
9671 /**
9672 * ### .arguments
9673 *
9674 * Asserts that the target is an `arguments` object.
9675 *
9676 * function test () {
9677 * expect(arguments).to.be.arguments;
9678 * }
9679 *
9680 * test();
9681 *
9682 * Add `.not` earlier in the chain to negate `.arguments`. However, it's often
9683 * best to assert which type the target is expected to be, rather than
9684 * asserting that its not an `arguments` object.
9685 *
9686 * expect('foo').to.be.a('string'); // Recommended
9687 * expect('foo').to.not.be.arguments; // Not recommended
9688 *
9689 * A custom error message can be given as the second argument to `expect`.
9690 *
9691 * expect({}, 'nooo why fail??').to.be.arguments;
9692 *
9693 * The alias `.Arguments` can be used interchangeably with `.arguments`.
9694 *
9695 * @name arguments
9696 * @alias Arguments
9697 * @namespace BDD
9698 * @api public
9699 */
9700
9701 function checkArguments () {
9702 var obj = flag(this, 'object')
9703 , type = _.type(obj);
9704 this.assert(
9705 'Arguments' === type
9706 , 'expected #{this} to be arguments but got ' + type
9707 , 'expected #{this} to not be arguments'
9708 );
9709 }
9710
9711 Assertion.addProperty('arguments', checkArguments);
9712 Assertion.addProperty('Arguments', checkArguments);
9713
9714 /**
9715 * ### .equal(val[, msg])
9716 *
9717 * Asserts that the target is strictly (`===`) equal to the given `val`.
9718 *
9719 * expect(1).to.equal(1);
9720 * expect('foo').to.equal('foo');
9721 *
9722 * Add `.deep` earlier in the chain to use deep equality instead. See the
9723 * `deep-eql` project page for info on the deep equality algorithm:
9724 * https://github.com/chaijs/deep-eql.
9725 *
9726 * // Target object deeply (but not strictly) equals `{a: 1}`
9727 * expect({a: 1}).to.deep.equal({a: 1});
9728 * expect({a: 1}).to.not.equal({a: 1});
9729 *
9730 * // Target array deeply (but not strictly) equals `[1, 2]`
9731 * expect([1, 2]).to.deep.equal([1, 2]);
9732 * expect([1, 2]).to.not.equal([1, 2]);
9733 *
9734 * Add `.not` earlier in the chain to negate `.equal`. However, it's often
9735 * best to assert that the target is equal to its expected value, rather than
9736 * not equal to one of countless unexpected values.
9737 *
9738 * expect(1).to.equal(1); // Recommended
9739 * expect(1).to.not.equal(2); // Not recommended
9740 *
9741 * `.equal` accepts an optional `msg` argument which is a custom error message
9742 * to show when the assertion fails. The message can also be given as the
9743 * second argument to `expect`.
9744 *
9745 * expect(1).to.equal(2, 'nooo why fail??');
9746 * expect(1, 'nooo why fail??').to.equal(2);
9747 *
9748 * The aliases `.equals` and `eq` can be used interchangeably with `.equal`.
9749 *
9750 * @name equal
9751 * @alias equals
9752 * @alias eq
9753 * @param {Mixed} val
9754 * @param {String} msg _optional_
9755 * @namespace BDD
9756 * @api public
9757 */
9758
9759 function assertEqual (val, msg) {
9760 if (msg) flag(this, 'message', msg);
9761 var obj = flag(this, 'object');
9762 if (flag(this, 'deep')) {
9763 return this.eql(val);
9764 } else {
9765 this.assert(
9766 val === obj
9767 , 'expected #{this} to equal #{exp}'
9768 , 'expected #{this} to not equal #{exp}'
9769 , val
9770 , this._obj
9771 , true
9772 );
9773 }
9774 }
9775
9776 Assertion.addMethod('equal', assertEqual);
9777 Assertion.addMethod('equals', assertEqual);
9778 Assertion.addMethod('eq', assertEqual);
9779
9780 /**
9781 * ### .eql(obj[, msg])
9782 *
9783 * Asserts that the target is deeply equal to the given `obj`. See the
9784 * `deep-eql` project page for info on the deep equality algorithm:
9785 * https://github.com/chaijs/deep-eql.
9786 *
9787 * // Target object is deeply (but not strictly) equal to {a: 1}
9788 * expect({a: 1}).to.eql({a: 1}).but.not.equal({a: 1});
9789 *
9790 * // Target array is deeply (but not strictly) equal to [1, 2]
9791 * expect([1, 2]).to.eql([1, 2]).but.not.equal([1, 2]);
9792 *
9793 * Add `.not` earlier in the chain to negate `.eql`. However, it's often best
9794 * to assert that the target is deeply equal to its expected value, rather
9795 * than not deeply equal to one of countless unexpected values.
9796 *
9797 * expect({a: 1}).to.eql({a: 1}); // Recommended
9798 * expect({a: 1}).to.not.eql({b: 2}); // Not recommended
9799 *
9800 * `.eql` accepts an optional `msg` argument which is a custom error message
9801 * to show when the assertion fails. The message can also be given as the
9802 * second argument to `expect`.
9803 *
9804 * expect({a: 1}).to.eql({b: 2}, 'nooo why fail??');
9805 * expect({a: 1}, 'nooo why fail??').to.eql({b: 2});
9806 *
9807 * The alias `.eqls` can be used interchangeably with `.eql`.
9808 *
9809 * The `.deep.equal` assertion is almost identical to `.eql` but with one
9810 * difference: `.deep.equal` causes deep equality comparisons to also be used
9811 * for any other assertions that follow in the chain.
9812 *
9813 * @name eql
9814 * @alias eqls
9815 * @param {Mixed} obj
9816 * @param {String} msg _optional_
9817 * @namespace BDD
9818 * @api public
9819 */
9820
9821 function assertEql(obj, msg) {
9822 if (msg) flag(this, 'message', msg);
9823 this.assert(
9824 _.eql(obj, flag(this, 'object'))
9825 , 'expected #{this} to deeply equal #{exp}'
9826 , 'expected #{this} to not deeply equal #{exp}'
9827 , obj
9828 , this._obj
9829 , true
9830 );
9831 }
9832
9833 Assertion.addMethod('eql', assertEql);
9834 Assertion.addMethod('eqls', assertEql);
9835
9836 /**
9837 * ### .above(n[, msg])
9838 *
9839 * Asserts that the target is a number or a date greater than the given number or date `n` respectively.
9840 * However, it's often best to assert that the target is equal to its expected
9841 * value.
9842 *
9843 * expect(2).to.equal(2); // Recommended
9844 * expect(2).to.be.above(1); // Not recommended
9845 *
9846 * Add `.lengthOf` earlier in the chain to assert that the value of the
9847 * target's `length` property is greater than the given number `n`.
9848 *
9849 * expect('foo').to.have.lengthOf(3); // Recommended
9850 * expect('foo').to.have.lengthOf.above(2); // Not recommended
9851 *
9852 * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended
9853 * expect([1, 2, 3]).to.have.lengthOf.above(2); // Not recommended
9854 *
9855 * Add `.not` earlier in the chain to negate `.above`.
9856 *
9857 * expect(2).to.equal(2); // Recommended
9858 * expect(1).to.not.be.above(2); // Not recommended
9859 *
9860 * `.above` accepts an optional `msg` argument which is a custom error message
9861 * to show when the assertion fails. The message can also be given as the
9862 * second argument to `expect`.
9863 *
9864 * expect(1).to.be.above(2, 'nooo why fail??');
9865 * expect(1, 'nooo why fail??').to.be.above(2);
9866 *
9867 * The aliases `.gt` and `.greaterThan` can be used interchangeably with
9868 * `.above`.
9869 *
9870 * @name above
9871 * @alias gt
9872 * @alias greaterThan
9873 * @param {Number} n
9874 * @param {String} msg _optional_
9875 * @namespace BDD
9876 * @api public
9877 */
9878
9879 function assertAbove (n, msg) {
9880 if (msg) flag(this, 'message', msg);
9881 var obj = flag(this, 'object')
9882 , doLength = flag(this, 'doLength')
9883 , flagMsg = flag(this, 'message')
9884 , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
9885 , ssfi = flag(this, 'ssfi')
9886 , objType = _.type(obj).toLowerCase()
9887 , nType = _.type(n).toLowerCase()
9888 , shouldThrow = true;
9889
9890 if (doLength) {
9891 new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
9892 }
9893
9894 if (!doLength && (objType === 'date' && nType !== 'date')) {
9895 errorMessage = msgPrefix + 'the argument to above must be a date';
9896 } else if (nType !== 'number' && (doLength || objType === 'number')) {
9897 errorMessage = msgPrefix + 'the argument to above must be a number';
9898 } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
9899 var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
9900 errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
9901 } else {
9902 shouldThrow = false;
9903 }
9904
9905 if (shouldThrow) {
9906 throw new AssertionError(errorMessage, undefined, ssfi);
9907 }
9908
9909 if (doLength) {
9910 var len = obj.length;
9911 this.assert(
9912 len > n
9913 , 'expected #{this} to have a length above #{exp} but got #{act}'
9914 , 'expected #{this} to not have a length above #{exp}'
9915 , n
9916 , len
9917 );
9918 } else {
9919 this.assert(
9920 obj > n
9921 , 'expected #{this} to be above #{exp}'
9922 , 'expected #{this} to be at most #{exp}'
9923 , n
9924 );
9925 }
9926 }
9927
9928 Assertion.addMethod('above', assertAbove);
9929 Assertion.addMethod('gt', assertAbove);
9930 Assertion.addMethod('greaterThan', assertAbove);
9931
9932 /**
9933 * ### .least(n[, msg])
9934 *
9935 * Asserts that the target is a number or a date greater than or equal to the given
9936 * number or date `n` respectively. However, it's often best to assert that the target is equal to
9937 * its expected value.
9938 *
9939 * expect(2).to.equal(2); // Recommended
9940 * expect(2).to.be.at.least(1); // Not recommended
9941 * expect(2).to.be.at.least(2); // Not recommended
9942 *
9943 * Add `.lengthOf` earlier in the chain to assert that the value of the
9944 * target's `length` property is greater than or equal to the given number
9945 * `n`.
9946 *
9947 * expect('foo').to.have.lengthOf(3); // Recommended
9948 * expect('foo').to.have.lengthOf.at.least(2); // Not recommended
9949 *
9950 * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended
9951 * expect([1, 2, 3]).to.have.lengthOf.at.least(2); // Not recommended
9952 *
9953 * Add `.not` earlier in the chain to negate `.least`.
9954 *
9955 * expect(1).to.equal(1); // Recommended
9956 * expect(1).to.not.be.at.least(2); // Not recommended
9957 *
9958 * `.least` accepts an optional `msg` argument which is a custom error message
9959 * to show when the assertion fails. The message can also be given as the
9960 * second argument to `expect`.
9961 *
9962 * expect(1).to.be.at.least(2, 'nooo why fail??');
9963 * expect(1, 'nooo why fail??').to.be.at.least(2);
9964 *
9965 * The alias `.gte` can be used interchangeably with `.least`.
9966 *
9967 * @name least
9968 * @alias gte
9969 * @param {Number} n
9970 * @param {String} msg _optional_
9971 * @namespace BDD
9972 * @api public
9973 */
9974
9975 function assertLeast (n, msg) {
9976 if (msg) flag(this, 'message', msg);
9977 var obj = flag(this, 'object')
9978 , doLength = flag(this, 'doLength')
9979 , flagMsg = flag(this, 'message')
9980 , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
9981 , ssfi = flag(this, 'ssfi')
9982 , objType = _.type(obj).toLowerCase()
9983 , nType = _.type(n).toLowerCase()
9984 , shouldThrow = true;
9985
9986 if (doLength) {
9987 new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
9988 }
9989
9990 if (!doLength && (objType === 'date' && nType !== 'date')) {
9991 errorMessage = msgPrefix + 'the argument to least must be a date';
9992 } else if (nType !== 'number' && (doLength || objType === 'number')) {
9993 errorMessage = msgPrefix + 'the argument to least must be a number';
9994 } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
9995 var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
9996 errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
9997 } else {
9998 shouldThrow = false;
9999 }
10000
10001 if (shouldThrow) {
10002 throw new AssertionError(errorMessage, undefined, ssfi);
10003 }
10004
10005 if (doLength) {
10006 var len = obj.length;
10007 this.assert(
10008 len >= n
10009 , 'expected #{this} to have a length at least #{exp} but got #{act}'
10010 , 'expected #{this} to have a length below #{exp}'
10011 , n
10012 , len
10013 );
10014 } else {
10015 this.assert(
10016 obj >= n
10017 , 'expected #{this} to be at least #{exp}'
10018 , 'expected #{this} to be below #{exp}'
10019 , n
10020 );
10021 }
10022 }
10023
10024 Assertion.addMethod('least', assertLeast);
10025 Assertion.addMethod('gte', assertLeast);
10026
10027 /**
10028 * ### .below(n[, msg])
10029 *
10030 * Asserts that the target is a number or a date less than the given number or date `n` respectively.
10031 * However, it's often best to assert that the target is equal to its expected
10032 * value.
10033 *
10034 * expect(1).to.equal(1); // Recommended
10035 * expect(1).to.be.below(2); // Not recommended
10036 *
10037 * Add `.lengthOf` earlier in the chain to assert that the value of the
10038 * target's `length` property is less than the given number `n`.
10039 *
10040 * expect('foo').to.have.lengthOf(3); // Recommended
10041 * expect('foo').to.have.lengthOf.below(4); // Not recommended
10042 *
10043 * expect([1, 2, 3]).to.have.length(3); // Recommended
10044 * expect([1, 2, 3]).to.have.lengthOf.below(4); // Not recommended
10045 *
10046 * Add `.not` earlier in the chain to negate `.below`.
10047 *
10048 * expect(2).to.equal(2); // Recommended
10049 * expect(2).to.not.be.below(1); // Not recommended
10050 *
10051 * `.below` accepts an optional `msg` argument which is a custom error message
10052 * to show when the assertion fails. The message can also be given as the
10053 * second argument to `expect`.
10054 *
10055 * expect(2).to.be.below(1, 'nooo why fail??');
10056 * expect(2, 'nooo why fail??').to.be.below(1);
10057 *
10058 * The aliases `.lt` and `.lessThan` can be used interchangeably with
10059 * `.below`.
10060 *
10061 * @name below
10062 * @alias lt
10063 * @alias lessThan
10064 * @param {Number} n
10065 * @param {String} msg _optional_
10066 * @namespace BDD
10067 * @api public
10068 */
10069
10070 function assertBelow (n, msg) {
10071 if (msg) flag(this, 'message', msg);
10072 var obj = flag(this, 'object')
10073 , doLength = flag(this, 'doLength')
10074 , flagMsg = flag(this, 'message')
10075 , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
10076 , ssfi = flag(this, 'ssfi')
10077 , objType = _.type(obj).toLowerCase()
10078 , nType = _.type(n).toLowerCase()
10079 , shouldThrow = true;
10080
10081 if (doLength) {
10082 new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
10083 }
10084
10085 if (!doLength && (objType === 'date' && nType !== 'date')) {
10086 errorMessage = msgPrefix + 'the argument to below must be a date';
10087 } else if (nType !== 'number' && (doLength || objType === 'number')) {
10088 errorMessage = msgPrefix + 'the argument to below must be a number';
10089 } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
10090 var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
10091 errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
10092 } else {
10093 shouldThrow = false;
10094 }
10095
10096 if (shouldThrow) {
10097 throw new AssertionError(errorMessage, undefined, ssfi);
10098 }
10099
10100 if (doLength) {
10101 var len = obj.length;
10102 this.assert(
10103 len < n
10104 , 'expected #{this} to have a length below #{exp} but got #{act}'
10105 , 'expected #{this} to not have a length below #{exp}'
10106 , n
10107 , len
10108 );
10109 } else {
10110 this.assert(
10111 obj < n
10112 , 'expected #{this} to be below #{exp}'
10113 , 'expected #{this} to be at least #{exp}'
10114 , n
10115 );
10116 }
10117 }
10118
10119 Assertion.addMethod('below', assertBelow);
10120 Assertion.addMethod('lt', assertBelow);
10121 Assertion.addMethod('lessThan', assertBelow);
10122
10123 /**
10124 * ### .most(n[, msg])
10125 *
10126 * Asserts that the target is a number or a date less than or equal to the given number
10127 * or date `n` respectively. However, it's often best to assert that the target is equal to its
10128 * expected value.
10129 *
10130 * expect(1).to.equal(1); // Recommended
10131 * expect(1).to.be.at.most(2); // Not recommended
10132 * expect(1).to.be.at.most(1); // Not recommended
10133 *
10134 * Add `.lengthOf` earlier in the chain to assert that the value of the
10135 * target's `length` property is less than or equal to the given number `n`.
10136 *
10137 * expect('foo').to.have.lengthOf(3); // Recommended
10138 * expect('foo').to.have.lengthOf.at.most(4); // Not recommended
10139 *
10140 * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended
10141 * expect([1, 2, 3]).to.have.lengthOf.at.most(4); // Not recommended
10142 *
10143 * Add `.not` earlier in the chain to negate `.most`.
10144 *
10145 * expect(2).to.equal(2); // Recommended
10146 * expect(2).to.not.be.at.most(1); // Not recommended
10147 *
10148 * `.most` accepts an optional `msg` argument which is a custom error message
10149 * to show when the assertion fails. The message can also be given as the
10150 * second argument to `expect`.
10151 *
10152 * expect(2).to.be.at.most(1, 'nooo why fail??');
10153 * expect(2, 'nooo why fail??').to.be.at.most(1);
10154 *
10155 * The alias `.lte` can be used interchangeably with `.most`.
10156 *
10157 * @name most
10158 * @alias lte
10159 * @param {Number} n
10160 * @param {String} msg _optional_
10161 * @namespace BDD
10162 * @api public
10163 */
10164
10165 function assertMost (n, msg) {
10166 if (msg) flag(this, 'message', msg);
10167 var obj = flag(this, 'object')
10168 , doLength = flag(this, 'doLength')
10169 , flagMsg = flag(this, 'message')
10170 , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
10171 , ssfi = flag(this, 'ssfi')
10172 , objType = _.type(obj).toLowerCase()
10173 , nType = _.type(n).toLowerCase()
10174 , shouldThrow = true;
10175
10176 if (doLength) {
10177 new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
10178 }
10179
10180 if (!doLength && (objType === 'date' && nType !== 'date')) {
10181 errorMessage = msgPrefix + 'the argument to most must be a date';
10182 } else if (nType !== 'number' && (doLength || objType === 'number')) {
10183 errorMessage = msgPrefix + 'the argument to most must be a number';
10184 } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
10185 var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
10186 errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
10187 } else {
10188 shouldThrow = false;
10189 }
10190
10191 if (shouldThrow) {
10192 throw new AssertionError(errorMessage, undefined, ssfi);
10193 }
10194
10195 if (doLength) {
10196 var len = obj.length;
10197 this.assert(
10198 len <= n
10199 , 'expected #{this} to have a length at most #{exp} but got #{act}'
10200 , 'expected #{this} to have a length above #{exp}'
10201 , n
10202 , len
10203 );
10204 } else {
10205 this.assert(
10206 obj <= n
10207 , 'expected #{this} to be at most #{exp}'
10208 , 'expected #{this} to be above #{exp}'
10209 , n
10210 );
10211 }
10212 }
10213
10214 Assertion.addMethod('most', assertMost);
10215 Assertion.addMethod('lte', assertMost);
10216
10217 /**
10218 * ### .within(start, finish[, msg])
10219 *
10220 * Asserts that the target is a number or a date greater than or equal to the given
10221 * number or date `start`, and less than or equal to the given number or date `finish` respectively.
10222 * However, it's often best to assert that the target is equal to its expected
10223 * value.
10224 *
10225 * expect(2).to.equal(2); // Recommended
10226 * expect(2).to.be.within(1, 3); // Not recommended
10227 * expect(2).to.be.within(2, 3); // Not recommended
10228 * expect(2).to.be.within(1, 2); // Not recommended
10229 *
10230 * Add `.lengthOf` earlier in the chain to assert that the value of the
10231 * target's `length` property is greater than or equal to the given number
10232 * `start`, and less than or equal to the given number `finish`.
10233 *
10234 * expect('foo').to.have.lengthOf(3); // Recommended
10235 * expect('foo').to.have.lengthOf.within(2, 4); // Not recommended
10236 *
10237 * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended
10238 * expect([1, 2, 3]).to.have.lengthOf.within(2, 4); // Not recommended
10239 *
10240 * Add `.not` earlier in the chain to negate `.within`.
10241 *
10242 * expect(1).to.equal(1); // Recommended
10243 * expect(1).to.not.be.within(2, 4); // Not recommended
10244 *
10245 * `.within` accepts an optional `msg` argument which is a custom error
10246 * message to show when the assertion fails. The message can also be given as
10247 * the second argument to `expect`.
10248 *
10249 * expect(4).to.be.within(1, 3, 'nooo why fail??');
10250 * expect(4, 'nooo why fail??').to.be.within(1, 3);
10251 *
10252 * @name within
10253 * @param {Number} start lower bound inclusive
10254 * @param {Number} finish upper bound inclusive
10255 * @param {String} msg _optional_
10256 * @namespace BDD
10257 * @api public
10258 */
10259
10260 Assertion.addMethod('within', function (start, finish, msg) {
10261 if (msg) flag(this, 'message', msg);
10262 var obj = flag(this, 'object')
10263 , doLength = flag(this, 'doLength')
10264 , flagMsg = flag(this, 'message')
10265 , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
10266 , ssfi = flag(this, 'ssfi')
10267 , objType = _.type(obj).toLowerCase()
10268 , startType = _.type(start).toLowerCase()
10269 , finishType = _.type(finish).toLowerCase()
10270 , shouldThrow = true
10271 , range = (startType === 'date' && finishType === 'date')
10272 ? start.toUTCString() + '..' + finish.toUTCString()
10273 : start + '..' + finish;
10274
10275 if (doLength) {
10276 new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
10277 }
10278
10279 if (!doLength && (objType === 'date' && (startType !== 'date' || finishType !== 'date'))) {
10280 errorMessage = msgPrefix + 'the arguments to within must be dates';
10281 } else if ((startType !== 'number' || finishType !== 'number') && (doLength || objType === 'number')) {
10282 errorMessage = msgPrefix + 'the arguments to within must be numbers';
10283 } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
10284 var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
10285 errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
10286 } else {
10287 shouldThrow = false;
10288 }
10289
10290 if (shouldThrow) {
10291 throw new AssertionError(errorMessage, undefined, ssfi);
10292 }
10293
10294 if (doLength) {
10295 var len = obj.length;
10296 this.assert(
10297 len >= start && len <= finish
10298 , 'expected #{this} to have a length within ' + range
10299 , 'expected #{this} to not have a length within ' + range
10300 );
10301 } else {
10302 this.assert(
10303 obj >= start && obj <= finish
10304 , 'expected #{this} to be within ' + range
10305 , 'expected #{this} to not be within ' + range
10306 );
10307 }
10308 });
10309
10310 /**
10311 * ### .instanceof(constructor[, msg])
10312 *
10313 * Asserts that the target is an instance of the given `constructor`.
10314 *
10315 * function Cat () { }
10316 *
10317 * expect(new Cat()).to.be.an.instanceof(Cat);
10318 * expect([1, 2]).to.be.an.instanceof(Array);
10319 *
10320 * Add `.not` earlier in the chain to negate `.instanceof`.
10321 *
10322 * expect({a: 1}).to.not.be.an.instanceof(Array);
10323 *
10324 * `.instanceof` accepts an optional `msg` argument which is a custom error
10325 * message to show when the assertion fails. The message can also be given as
10326 * the second argument to `expect`.
10327 *
10328 * expect(1).to.be.an.instanceof(Array, 'nooo why fail??');
10329 * expect(1, 'nooo why fail??').to.be.an.instanceof(Array);
10330 *
10331 * Due to limitations in ES5, `.instanceof` may not always work as expected
10332 * when using a transpiler such as Babel or TypeScript. In particular, it may
10333 * produce unexpected results when subclassing built-in object such as
10334 * `Array`, `Error`, and `Map`. See your transpiler's docs for details:
10335 *
10336 * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes))
10337 * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work))
10338 *
10339 * The alias `.instanceOf` can be used interchangeably with `.instanceof`.
10340 *
10341 * @name instanceof
10342 * @param {Constructor} constructor
10343 * @param {String} msg _optional_
10344 * @alias instanceOf
10345 * @namespace BDD
10346 * @api public
10347 */
10348
10349 function assertInstanceOf (constructor, msg) {
10350 if (msg) flag(this, 'message', msg);
10351
10352 var target = flag(this, 'object');
10353 var ssfi = flag(this, 'ssfi');
10354 var flagMsg = flag(this, 'message');
10355
10356 try {
10357 var isInstanceOf = target instanceof constructor;
10358 } catch (err) {
10359 if (err instanceof TypeError) {
10360 flagMsg = flagMsg ? flagMsg + ': ' : '';
10361 throw new AssertionError(
10362 flagMsg + 'The instanceof assertion needs a constructor but '
10363 + _.type(constructor) + ' was given.',
10364 undefined,
10365 ssfi
10366 );
10367 }
10368 throw err;
10369 }
10370
10371 var name = _.getName(constructor);
10372 if (name === null) {
10373 name = 'an unnamed constructor';
10374 }
10375
10376 this.assert(
10377 isInstanceOf
10378 , 'expected #{this} to be an instance of ' + name
10379 , 'expected #{this} to not be an instance of ' + name
10380 );
10381 }
10382
10383 Assertion.addMethod('instanceof', assertInstanceOf);
10384 Assertion.addMethod('instanceOf', assertInstanceOf);
10385
10386 /**
10387 * ### .property(name[, val[, msg]])
10388 *
10389 * Asserts that the target has a property with the given key `name`.
10390 *
10391 * expect({a: 1}).to.have.property('a');
10392 *
10393 * When `val` is provided, `.property` also asserts that the property's value
10394 * is equal to the given `val`.
10395 *
10396 * expect({a: 1}).to.have.property('a', 1);
10397 *
10398 * By default, strict (`===`) equality is used. Add `.deep` earlier in the
10399 * chain to use deep equality instead. See the `deep-eql` project page for
10400 * info on the deep equality algorithm: https://github.com/chaijs/deep-eql.
10401 *
10402 * // Target object deeply (but not strictly) has property `x: {a: 1}`
10403 * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1});
10404 * expect({x: {a: 1}}).to.not.have.property('x', {a: 1});
10405 *
10406 * The target's enumerable and non-enumerable properties are always included
10407 * in the search. By default, both own and inherited properties are included.
10408 * Add `.own` earlier in the chain to exclude inherited properties from the
10409 * search.
10410 *
10411 * Object.prototype.b = 2;
10412 *
10413 * expect({a: 1}).to.have.own.property('a');
10414 * expect({a: 1}).to.have.own.property('a', 1);
10415 * expect({a: 1}).to.have.property('b').but.not.own.property('b');
10416 *
10417 * `.deep` and `.own` can be combined.
10418 *
10419 * expect({x: {a: 1}}).to.have.deep.own.property('x', {a: 1});
10420 *
10421 * Add `.nested` earlier in the chain to enable dot- and bracket-notation when
10422 * referencing nested properties.
10423 *
10424 * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]');
10425 * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]', 'y');
10426 *
10427 * If `.` or `[]` are part of an actual property name, they can be escaped by
10428 * adding two backslashes before them.
10429 *
10430 * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]');
10431 *
10432 * `.deep` and `.nested` can be combined.
10433 *
10434 * expect({a: {b: [{c: 3}]}})
10435 * .to.have.deep.nested.property('a.b[0]', {c: 3});
10436 *
10437 * `.own` and `.nested` cannot be combined.
10438 *
10439 * Add `.not` earlier in the chain to negate `.property`.
10440 *
10441 * expect({a: 1}).to.not.have.property('b');
10442 *
10443 * However, it's dangerous to negate `.property` when providing `val`. The
10444 * problem is that it creates uncertain expectations by asserting that the
10445 * target either doesn't have a property with the given key `name`, or that it
10446 * does have a property with the given key `name` but its value isn't equal to
10447 * the given `val`. It's often best to identify the exact output that's
10448 * expected, and then write an assertion that only accepts that exact output.
10449 *
10450 * When the target isn't expected to have a property with the given key
10451 * `name`, it's often best to assert exactly that.
10452 *
10453 * expect({b: 2}).to.not.have.property('a'); // Recommended
10454 * expect({b: 2}).to.not.have.property('a', 1); // Not recommended
10455 *
10456 * When the target is expected to have a property with the given key `name`,
10457 * it's often best to assert that the property has its expected value, rather
10458 * than asserting that it doesn't have one of many unexpected values.
10459 *
10460 * expect({a: 3}).to.have.property('a', 3); // Recommended
10461 * expect({a: 3}).to.not.have.property('a', 1); // Not recommended
10462 *
10463 * `.property` changes the target of any assertions that follow in the chain
10464 * to be the value of the property from the original target object.
10465 *
10466 * expect({a: 1}).to.have.property('a').that.is.a('number');
10467 *
10468 * `.property` accepts an optional `msg` argument which is a custom error
10469 * message to show when the assertion fails. The message can also be given as
10470 * the second argument to `expect`. When not providing `val`, only use the
10471 * second form.
10472 *
10473 * // Recommended
10474 * expect({a: 1}).to.have.property('a', 2, 'nooo why fail??');
10475 * expect({a: 1}, 'nooo why fail??').to.have.property('a', 2);
10476 * expect({a: 1}, 'nooo why fail??').to.have.property('b');
10477 *
10478 * // Not recommended
10479 * expect({a: 1}).to.have.property('b', undefined, 'nooo why fail??');
10480 *
10481 * The above assertion isn't the same thing as not providing `val`. Instead,
10482 * it's asserting that the target object has a `b` property that's equal to
10483 * `undefined`.
10484 *
10485 * The assertions `.ownProperty` and `.haveOwnProperty` can be used
10486 * interchangeably with `.own.property`.
10487 *
10488 * @name property
10489 * @param {String} name
10490 * @param {Mixed} val (optional)
10491 * @param {String} msg _optional_
10492 * @returns value of property for chaining
10493 * @namespace BDD
10494 * @api public
10495 */
10496
10497 function assertProperty (name, val, msg) {
10498 if (msg) flag(this, 'message', msg);
10499
10500 var isNested = flag(this, 'nested')
10501 , isOwn = flag(this, 'own')
10502 , flagMsg = flag(this, 'message')
10503 , obj = flag(this, 'object')
10504 , ssfi = flag(this, 'ssfi');
10505
10506 if (isNested && isOwn) {
10507 flagMsg = flagMsg ? flagMsg + ': ' : '';
10508 throw new AssertionError(
10509 flagMsg + 'The "nested" and "own" flags cannot be combined.',
10510 undefined,
10511 ssfi
10512 );
10513 }
10514
10515 if (obj === null || obj === undefined) {
10516 flagMsg = flagMsg ? flagMsg + ': ' : '';
10517 throw new AssertionError(
10518 flagMsg + 'Target cannot be null or undefined.',
10519 undefined,
10520 ssfi
10521 );
10522 }
10523
10524 var isDeep = flag(this, 'deep')
10525 , negate = flag(this, 'negate')
10526 , pathInfo = isNested ? _.getPathInfo(obj, name) : null
10527 , value = isNested ? pathInfo.value : obj[name];
10528
10529 var descriptor = '';
10530 if (isDeep) descriptor += 'deep ';
10531 if (isOwn) descriptor += 'own ';
10532 if (isNested) descriptor += 'nested ';
10533 descriptor += 'property ';
10534
10535 var hasProperty;
10536 if (isOwn) hasProperty = Object.prototype.hasOwnProperty.call(obj, name);
10537 else if (isNested) hasProperty = pathInfo.exists;
10538 else hasProperty = _.hasProperty(obj, name);
10539
10540 // When performing a negated assertion for both name and val, merely having
10541 // a property with the given name isn't enough to cause the assertion to
10542 // fail. It must both have a property with the given name, and the value of
10543 // that property must equal the given val. Therefore, skip this assertion in
10544 // favor of the next.
10545 if (!negate || arguments.length === 1) {
10546 this.assert(
10547 hasProperty
10548 , 'expected #{this} to have ' + descriptor + _.inspect(name)
10549 , 'expected #{this} to not have ' + descriptor + _.inspect(name));
10550 }
10551
10552 if (arguments.length > 1) {
10553 this.assert(
10554 hasProperty && (isDeep ? _.eql(val, value) : val === value)
10555 , 'expected #{this} to have ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}'
10556 , 'expected #{this} to not have ' + descriptor + _.inspect(name) + ' of #{act}'
10557 , val
10558 , value
10559 );
10560 }
10561
10562 flag(this, 'object', value);
10563 }
10564
10565 Assertion.addMethod('property', assertProperty);
10566
10567 function assertOwnProperty (name, value, msg) {
10568 flag(this, 'own', true);
10569 assertProperty.apply(this, arguments);
10570 }
10571
10572 Assertion.addMethod('ownProperty', assertOwnProperty);
10573 Assertion.addMethod('haveOwnProperty', assertOwnProperty);
10574
10575 /**
10576 * ### .ownPropertyDescriptor(name[, descriptor[, msg]])
10577 *
10578 * Asserts that the target has its own property descriptor with the given key
10579 * `name`. Enumerable and non-enumerable properties are included in the
10580 * search.
10581 *
10582 * expect({a: 1}).to.have.ownPropertyDescriptor('a');
10583 *
10584 * When `descriptor` is provided, `.ownPropertyDescriptor` also asserts that
10585 * the property's descriptor is deeply equal to the given `descriptor`. See
10586 * the `deep-eql` project page for info on the deep equality algorithm:
10587 * https://github.com/chaijs/deep-eql.
10588 *
10589 * expect({a: 1}).to.have.ownPropertyDescriptor('a', {
10590 * configurable: true,
10591 * enumerable: true,
10592 * writable: true,
10593 * value: 1,
10594 * });
10595 *
10596 * Add `.not` earlier in the chain to negate `.ownPropertyDescriptor`.
10597 *
10598 * expect({a: 1}).to.not.have.ownPropertyDescriptor('b');
10599 *
10600 * However, it's dangerous to negate `.ownPropertyDescriptor` when providing
10601 * a `descriptor`. The problem is that it creates uncertain expectations by
10602 * asserting that the target either doesn't have a property descriptor with
10603 * the given key `name`, or that it does have a property descriptor with the
10604 * given key `name` but its not deeply equal to the given `descriptor`. It's
10605 * often best to identify the exact output that's expected, and then write an
10606 * assertion that only accepts that exact output.
10607 *
10608 * When the target isn't expected to have a property descriptor with the given
10609 * key `name`, it's often best to assert exactly that.
10610 *
10611 * // Recommended
10612 * expect({b: 2}).to.not.have.ownPropertyDescriptor('a');
10613 *
10614 * // Not recommended
10615 * expect({b: 2}).to.not.have.ownPropertyDescriptor('a', {
10616 * configurable: true,
10617 * enumerable: true,
10618 * writable: true,
10619 * value: 1,
10620 * });
10621 *
10622 * When the target is expected to have a property descriptor with the given
10623 * key `name`, it's often best to assert that the property has its expected
10624 * descriptor, rather than asserting that it doesn't have one of many
10625 * unexpected descriptors.
10626 *
10627 * // Recommended
10628 * expect({a: 3}).to.have.ownPropertyDescriptor('a', {
10629 * configurable: true,
10630 * enumerable: true,
10631 * writable: true,
10632 * value: 3,
10633 * });
10634 *
10635 * // Not recommended
10636 * expect({a: 3}).to.not.have.ownPropertyDescriptor('a', {
10637 * configurable: true,
10638 * enumerable: true,
10639 * writable: true,
10640 * value: 1,
10641 * });
10642 *
10643 * `.ownPropertyDescriptor` changes the target of any assertions that follow
10644 * in the chain to be the value of the property descriptor from the original
10645 * target object.
10646 *
10647 * expect({a: 1}).to.have.ownPropertyDescriptor('a')
10648 * .that.has.property('enumerable', true);
10649 *
10650 * `.ownPropertyDescriptor` accepts an optional `msg` argument which is a
10651 * custom error message to show when the assertion fails. The message can also
10652 * be given as the second argument to `expect`. When not providing
10653 * `descriptor`, only use the second form.
10654 *
10655 * // Recommended
10656 * expect({a: 1}).to.have.ownPropertyDescriptor('a', {
10657 * configurable: true,
10658 * enumerable: true,
10659 * writable: true,
10660 * value: 2,
10661 * }, 'nooo why fail??');
10662 *
10663 * // Recommended
10664 * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('a', {
10665 * configurable: true,
10666 * enumerable: true,
10667 * writable: true,
10668 * value: 2,
10669 * });
10670 *
10671 * // Recommended
10672 * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('b');
10673 *
10674 * // Not recommended
10675 * expect({a: 1})
10676 * .to.have.ownPropertyDescriptor('b', undefined, 'nooo why fail??');
10677 *
10678 * The above assertion isn't the same thing as not providing `descriptor`.
10679 * Instead, it's asserting that the target object has a `b` property
10680 * descriptor that's deeply equal to `undefined`.
10681 *
10682 * The alias `.haveOwnPropertyDescriptor` can be used interchangeably with
10683 * `.ownPropertyDescriptor`.
10684 *
10685 * @name ownPropertyDescriptor
10686 * @alias haveOwnPropertyDescriptor
10687 * @param {String} name
10688 * @param {Object} descriptor _optional_
10689 * @param {String} msg _optional_
10690 * @namespace BDD
10691 * @api public
10692 */
10693
10694 function assertOwnPropertyDescriptor (name, descriptor, msg) {
10695 if (typeof descriptor === 'string') {
10696 msg = descriptor;
10697 descriptor = null;
10698 }
10699 if (msg) flag(this, 'message', msg);
10700 var obj = flag(this, 'object');
10701 var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
10702 if (actualDescriptor && descriptor) {
10703 this.assert(
10704 _.eql(descriptor, actualDescriptor)
10705 , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor)
10706 , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor)
10707 , descriptor
10708 , actualDescriptor
10709 , true
10710 );
10711 } else {
10712 this.assert(
10713 actualDescriptor
10714 , 'expected #{this} to have an own property descriptor for ' + _.inspect(name)
10715 , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name)
10716 );
10717 }
10718 flag(this, 'object', actualDescriptor);
10719 }
10720
10721 Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor);
10722 Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor);
10723
10724 /**
10725 * ### .lengthOf(n[, msg])
10726 *
10727 * Asserts that the target's `length` property is equal to the given number
10728 * `n`.
10729 *
10730 * expect([1, 2, 3]).to.have.lengthOf(3);
10731 * expect('foo').to.have.lengthOf(3);
10732 *
10733 * Add `.not` earlier in the chain to negate `.lengthOf`. However, it's often
10734 * best to assert that the target's `length` property is equal to its expected
10735 * value, rather than not equal to one of many unexpected values.
10736 *
10737 * expect('foo').to.have.lengthOf(3); // Recommended
10738 * expect('foo').to.not.have.lengthOf(4); // Not recommended
10739 *
10740 * `.lengthOf` accepts an optional `msg` argument which is a custom error
10741 * message to show when the assertion fails. The message can also be given as
10742 * the second argument to `expect`.
10743 *
10744 * expect([1, 2, 3]).to.have.lengthOf(2, 'nooo why fail??');
10745 * expect([1, 2, 3], 'nooo why fail??').to.have.lengthOf(2);
10746 *
10747 * `.lengthOf` can also be used as a language chain, causing all `.above`,
10748 * `.below`, `.least`, `.most`, and `.within` assertions that follow in the
10749 * chain to use the target's `length` property as the target. However, it's
10750 * often best to assert that the target's `length` property is equal to its
10751 * expected length, rather than asserting that its `length` property falls
10752 * within some range of values.
10753 *
10754 * // Recommended
10755 * expect([1, 2, 3]).to.have.lengthOf(3);
10756 *
10757 * // Not recommended
10758 * expect([1, 2, 3]).to.have.lengthOf.above(2);
10759 * expect([1, 2, 3]).to.have.lengthOf.below(4);
10760 * expect([1, 2, 3]).to.have.lengthOf.at.least(3);
10761 * expect([1, 2, 3]).to.have.lengthOf.at.most(3);
10762 * expect([1, 2, 3]).to.have.lengthOf.within(2,4);
10763 *
10764 * Due to a compatibility issue, the alias `.length` can't be chained directly
10765 * off of an uninvoked method such as `.a`. Therefore, `.length` can't be used
10766 * interchangeably with `.lengthOf` in every situation. It's recommended to
10767 * always use `.lengthOf` instead of `.length`.
10768 *
10769 * expect([1, 2, 3]).to.have.a.length(3); // incompatible; throws error
10770 * expect([1, 2, 3]).to.have.a.lengthOf(3); // passes as expected
10771 *
10772 * @name lengthOf
10773 * @alias length
10774 * @param {Number} n
10775 * @param {String} msg _optional_
10776 * @namespace BDD
10777 * @api public
10778 */
10779
10780 function assertLengthChain () {
10781 flag(this, 'doLength', true);
10782 }
10783
10784 function assertLength (n, msg) {
10785 if (msg) flag(this, 'message', msg);
10786 var obj = flag(this, 'object')
10787 , flagMsg = flag(this, 'message')
10788 , ssfi = flag(this, 'ssfi');
10789 new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
10790 var len = obj.length;
10791
10792 this.assert(
10793 len == n
10794 , 'expected #{this} to have a length of #{exp} but got #{act}'
10795 , 'expected #{this} to not have a length of #{act}'
10796 , n
10797 , len
10798 );
10799 }
10800
10801 Assertion.addChainableMethod('length', assertLength, assertLengthChain);
10802 Assertion.addChainableMethod('lengthOf', assertLength, assertLengthChain);
10803
10804 /**
10805 * ### .match(re[, msg])
10806 *
10807 * Asserts that the target matches the given regular expression `re`.
10808 *
10809 * expect('foobar').to.match(/^foo/);
10810 *
10811 * Add `.not` earlier in the chain to negate `.match`.
10812 *
10813 * expect('foobar').to.not.match(/taco/);
10814 *
10815 * `.match` accepts an optional `msg` argument which is a custom error message
10816 * to show when the assertion fails. The message can also be given as the
10817 * second argument to `expect`.
10818 *
10819 * expect('foobar').to.match(/taco/, 'nooo why fail??');
10820 * expect('foobar', 'nooo why fail??').to.match(/taco/);
10821 *
10822 * The alias `.matches` can be used interchangeably with `.match`.
10823 *
10824 * @name match
10825 * @alias matches
10826 * @param {RegExp} re
10827 * @param {String} msg _optional_
10828 * @namespace BDD
10829 * @api public
10830 */
10831 function assertMatch(re, msg) {
10832 if (msg) flag(this, 'message', msg);
10833 var obj = flag(this, 'object');
10834 this.assert(
10835 re.exec(obj)
10836 , 'expected #{this} to match ' + re
10837 , 'expected #{this} not to match ' + re
10838 );
10839 }
10840
10841 Assertion.addMethod('match', assertMatch);
10842 Assertion.addMethod('matches', assertMatch);
10843
10844 /**
10845 * ### .string(str[, msg])
10846 *
10847 * Asserts that the target string contains the given substring `str`.
10848 *
10849 * expect('foobar').to.have.string('bar');
10850 *
10851 * Add `.not` earlier in the chain to negate `.string`.
10852 *
10853 * expect('foobar').to.not.have.string('taco');
10854 *
10855 * `.string` accepts an optional `msg` argument which is a custom error
10856 * message to show when the assertion fails. The message can also be given as
10857 * the second argument to `expect`.
10858 *
10859 * expect('foobar').to.have.string(/taco/, 'nooo why fail??');
10860 * expect('foobar', 'nooo why fail??').to.have.string(/taco/);
10861 *
10862 * @name string
10863 * @param {String} str
10864 * @param {String} msg _optional_
10865 * @namespace BDD
10866 * @api public
10867 */
10868
10869 Assertion.addMethod('string', function (str, msg) {
10870 if (msg) flag(this, 'message', msg);
10871 var obj = flag(this, 'object')
10872 , flagMsg = flag(this, 'message')
10873 , ssfi = flag(this, 'ssfi');
10874 new Assertion(obj, flagMsg, ssfi, true).is.a('string');
10875
10876 this.assert(
10877 ~obj.indexOf(str)
10878 , 'expected #{this} to contain ' + _.inspect(str)
10879 , 'expected #{this} to not contain ' + _.inspect(str)
10880 );
10881 });
10882
10883 /**
10884 * ### .keys(key1[, key2[, ...]])
10885 *
10886 * Asserts that the target object, array, map, or set has the given keys. Only
10887 * the target's own inherited properties are included in the search.
10888 *
10889 * When the target is an object or array, keys can be provided as one or more
10890 * string arguments, a single array argument, or a single object argument. In
10891 * the latter case, only the keys in the given object matter; the values are
10892 * ignored.
10893 *
10894 * expect({a: 1, b: 2}).to.have.all.keys('a', 'b');
10895 * expect(['x', 'y']).to.have.all.keys(0, 1);
10896 *
10897 * expect({a: 1, b: 2}).to.have.all.keys(['a', 'b']);
10898 * expect(['x', 'y']).to.have.all.keys([0, 1]);
10899 *
10900 * expect({a: 1, b: 2}).to.have.all.keys({a: 4, b: 5}); // ignore 4 and 5
10901 * expect(['x', 'y']).to.have.all.keys({0: 4, 1: 5}); // ignore 4 and 5
10902 *
10903 * When the target is a map or set, each key must be provided as a separate
10904 * argument.
10905 *
10906 * expect(new Map([['a', 1], ['b', 2]])).to.have.all.keys('a', 'b');
10907 * expect(new Set(['a', 'b'])).to.have.all.keys('a', 'b');
10908 *
10909 * Because `.keys` does different things based on the target's type, it's
10910 * important to check the target's type before using `.keys`. See the `.a` doc
10911 * for info on testing a target's type.
10912 *
10913 * expect({a: 1, b: 2}).to.be.an('object').that.has.all.keys('a', 'b');
10914 *
10915 * By default, strict (`===`) equality is used to compare keys of maps and
10916 * sets. Add `.deep` earlier in the chain to use deep equality instead. See
10917 * the `deep-eql` project page for info on the deep equality algorithm:
10918 * https://github.com/chaijs/deep-eql.
10919 *
10920 * // Target set deeply (but not strictly) has key `{a: 1}`
10921 * expect(new Set([{a: 1}])).to.have.all.deep.keys([{a: 1}]);
10922 * expect(new Set([{a: 1}])).to.not.have.all.keys([{a: 1}]);
10923 *
10924 * By default, the target must have all of the given keys and no more. Add
10925 * `.any` earlier in the chain to only require that the target have at least
10926 * one of the given keys. Also, add `.not` earlier in the chain to negate
10927 * `.keys`. It's often best to add `.any` when negating `.keys`, and to use
10928 * `.all` when asserting `.keys` without negation.
10929 *
10930 * When negating `.keys`, `.any` is preferred because `.not.any.keys` asserts
10931 * exactly what's expected of the output, whereas `.not.all.keys` creates
10932 * uncertain expectations.
10933 *
10934 * // Recommended; asserts that target doesn't have any of the given keys
10935 * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd');
10936 *
10937 * // Not recommended; asserts that target doesn't have all of the given
10938 * // keys but may or may not have some of them
10939 * expect({a: 1, b: 2}).to.not.have.all.keys('c', 'd');
10940 *
10941 * When asserting `.keys` without negation, `.all` is preferred because
10942 * `.all.keys` asserts exactly what's expected of the output, whereas
10943 * `.any.keys` creates uncertain expectations.
10944 *
10945 * // Recommended; asserts that target has all the given keys
10946 * expect({a: 1, b: 2}).to.have.all.keys('a', 'b');
10947 *
10948 * // Not recommended; asserts that target has at least one of the given
10949 * // keys but may or may not have more of them
10950 * expect({a: 1, b: 2}).to.have.any.keys('a', 'b');
10951 *
10952 * Note that `.all` is used by default when neither `.all` nor `.any` appear
10953 * earlier in the chain. However, it's often best to add `.all` anyway because
10954 * it improves readability.
10955 *
10956 * // Both assertions are identical
10957 * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); // Recommended
10958 * expect({a: 1, b: 2}).to.have.keys('a', 'b'); // Not recommended
10959 *
10960 * Add `.include` earlier in the chain to require that the target's keys be a
10961 * superset of the expected keys, rather than identical sets.
10962 *
10963 * // Target object's keys are a superset of ['a', 'b'] but not identical
10964 * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b');
10965 * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b');
10966 *
10967 * However, if `.any` and `.include` are combined, only the `.any` takes
10968 * effect. The `.include` is ignored in this case.
10969 *
10970 * // Both assertions are identical
10971 * expect({a: 1}).to.have.any.keys('a', 'b');
10972 * expect({a: 1}).to.include.any.keys('a', 'b');
10973 *
10974 * A custom error message can be given as the second argument to `expect`.
10975 *
10976 * expect({a: 1}, 'nooo why fail??').to.have.key('b');
10977 *
10978 * The alias `.key` can be used interchangeably with `.keys`.
10979 *
10980 * @name keys
10981 * @alias key
10982 * @param {...String|Array|Object} keys
10983 * @namespace BDD
10984 * @api public
10985 */
10986
10987 function assertKeys (keys) {
10988 var obj = flag(this, 'object')
10989 , objType = _.type(obj)
10990 , keysType = _.type(keys)
10991 , ssfi = flag(this, 'ssfi')
10992 , isDeep = flag(this, 'deep')
10993 , str
10994 , deepStr = ''
10995 , ok = true
10996 , flagMsg = flag(this, 'message');
10997
10998 flagMsg = flagMsg ? flagMsg + ': ' : '';
10999 var mixedArgsMsg = flagMsg + 'when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments';
11000
11001 if (objType === 'Map' || objType === 'Set') {
11002 deepStr = isDeep ? 'deeply ' : '';
11003 actual = [];
11004
11005 // Map and Set '.keys' aren't supported in IE 11. Therefore, use .forEach.
11006 obj.forEach(function (val, key) { actual.push(key); });
11007
11008 if (keysType !== 'Array') {
11009 keys = Array.prototype.slice.call(arguments);
11010 }
11011
11012 } else {
11013 actual = _.getOwnEnumerableProperties(obj);
11014
11015 switch (keysType) {
11016 case 'Array':
11017 if (arguments.length > 1) {
11018 throw new AssertionError(mixedArgsMsg, undefined, ssfi);
11019 }
11020 break;
11021 case 'Object':
11022 if (arguments.length > 1) {
11023 throw new AssertionError(mixedArgsMsg, undefined, ssfi);
11024 }
11025 keys = Object.keys(keys);
11026 break;
11027 default:
11028 keys = Array.prototype.slice.call(arguments);
11029 }
11030
11031 // Only stringify non-Symbols because Symbols would become "Symbol()"
11032 keys = keys.map(function (val) {
11033 return typeof val === 'symbol' ? val : String(val);
11034 });
11035 }
11036
11037 if (!keys.length) {
11038 throw new AssertionError(flagMsg + 'keys required', undefined, ssfi);
11039 }
11040
11041 var len = keys.length
11042 , any = flag(this, 'any')
11043 , all = flag(this, 'all')
11044 , expected = keys
11045 , actual;
11046
11047 if (!any && !all) {
11048 all = true;
11049 }
11050
11051 // Has any
11052 if (any) {
11053 ok = expected.some(function(expectedKey) {
11054 return actual.some(function(actualKey) {
11055 if (isDeep) {
11056 return _.eql(expectedKey, actualKey);
11057 } else {
11058 return expectedKey === actualKey;
11059 }
11060 });
11061 });
11062 }
11063
11064 // Has all
11065 if (all) {
11066 ok = expected.every(function(expectedKey) {
11067 return actual.some(function(actualKey) {
11068 if (isDeep) {
11069 return _.eql(expectedKey, actualKey);
11070 } else {
11071 return expectedKey === actualKey;
11072 }
11073 });
11074 });
11075
11076 if (!flag(this, 'contains')) {
11077 ok = ok && keys.length == actual.length;
11078 }
11079 }
11080
11081 // Key string
11082 if (len > 1) {
11083 keys = keys.map(function(key) {
11084 return _.inspect(key);
11085 });
11086 var last = keys.pop();
11087 if (all) {
11088 str = keys.join(', ') + ', and ' + last;
11089 }
11090 if (any) {
11091 str = keys.join(', ') + ', or ' + last;
11092 }
11093 } else {
11094 str = _.inspect(keys[0]);
11095 }
11096
11097 // Form
11098 str = (len > 1 ? 'keys ' : 'key ') + str;
11099
11100 // Have / include
11101 str = (flag(this, 'contains') ? 'contain ' : 'have ') + str;
11102
11103 // Assertion
11104 this.assert(
11105 ok
11106 , 'expected #{this} to ' + deepStr + str
11107 , 'expected #{this} to not ' + deepStr + str
11108 , expected.slice(0).sort(_.compareByInspect)
11109 , actual.sort(_.compareByInspect)
11110 , true
11111 );
11112 }
11113
11114 Assertion.addMethod('keys', assertKeys);
11115 Assertion.addMethod('key', assertKeys);
11116
11117 /**
11118 * ### .throw([errorLike], [errMsgMatcher], [msg])
11119 *
11120 * When no arguments are provided, `.throw` invokes the target function and
11121 * asserts that an error is thrown.
11122 *
11123 * var badFn = function () { throw new TypeError('Illegal salmon!'); };
11124 *
11125 * expect(badFn).to.throw();
11126 *
11127 * When one argument is provided, and it's an error constructor, `.throw`
11128 * invokes the target function and asserts that an error is thrown that's an
11129 * instance of that error constructor.
11130 *
11131 * var badFn = function () { throw new TypeError('Illegal salmon!'); };
11132 *
11133 * expect(badFn).to.throw(TypeError);
11134 *
11135 * When one argument is provided, and it's an error instance, `.throw` invokes
11136 * the target function and asserts that an error is thrown that's strictly
11137 * (`===`) equal to that error instance.
11138 *
11139 * var err = new TypeError('Illegal salmon!');
11140 * var badFn = function () { throw err; };
11141 *
11142 * expect(badFn).to.throw(err);
11143 *
11144 * When one argument is provided, and it's a string, `.throw` invokes the
11145 * target function and asserts that an error is thrown with a message that
11146 * contains that string.
11147 *
11148 * var badFn = function () { throw new TypeError('Illegal salmon!'); };
11149 *
11150 * expect(badFn).to.throw('salmon');
11151 *
11152 * When one argument is provided, and it's a regular expression, `.throw`
11153 * invokes the target function and asserts that an error is thrown with a
11154 * message that matches that regular expression.
11155 *
11156 * var badFn = function () { throw new TypeError('Illegal salmon!'); };
11157 *
11158 * expect(badFn).to.throw(/salmon/);
11159 *
11160 * When two arguments are provided, and the first is an error instance or
11161 * constructor, and the second is a string or regular expression, `.throw`
11162 * invokes the function and asserts that an error is thrown that fulfills both
11163 * conditions as described above.
11164 *
11165 * var err = new TypeError('Illegal salmon!');
11166 * var badFn = function () { throw err; };
11167 *
11168 * expect(badFn).to.throw(TypeError, 'salmon');
11169 * expect(badFn).to.throw(TypeError, /salmon/);
11170 * expect(badFn).to.throw(err, 'salmon');
11171 * expect(badFn).to.throw(err, /salmon/);
11172 *
11173 * Add `.not` earlier in the chain to negate `.throw`.
11174 *
11175 * var goodFn = function () {};
11176 *
11177 * expect(goodFn).to.not.throw();
11178 *
11179 * However, it's dangerous to negate `.throw` when providing any arguments.
11180 * The problem is that it creates uncertain expectations by asserting that the
11181 * target either doesn't throw an error, or that it throws an error but of a
11182 * different type than the given type, or that it throws an error of the given
11183 * type but with a message that doesn't include the given string. It's often
11184 * best to identify the exact output that's expected, and then write an
11185 * assertion that only accepts that exact output.
11186 *
11187 * When the target isn't expected to throw an error, it's often best to assert
11188 * exactly that.
11189 *
11190 * var goodFn = function () {};
11191 *
11192 * expect(goodFn).to.not.throw(); // Recommended
11193 * expect(goodFn).to.not.throw(ReferenceError, 'x'); // Not recommended
11194 *
11195 * When the target is expected to throw an error, it's often best to assert
11196 * that the error is of its expected type, and has a message that includes an
11197 * expected string, rather than asserting that it doesn't have one of many
11198 * unexpected types, and doesn't have a message that includes some string.
11199 *
11200 * var badFn = function () { throw new TypeError('Illegal salmon!'); };
11201 *
11202 * expect(badFn).to.throw(TypeError, 'salmon'); // Recommended
11203 * expect(badFn).to.not.throw(ReferenceError, 'x'); // Not recommended
11204 *
11205 * `.throw` changes the target of any assertions that follow in the chain to
11206 * be the error object that's thrown.
11207 *
11208 * var err = new TypeError('Illegal salmon!');
11209 * err.code = 42;
11210 * var badFn = function () { throw err; };
11211 *
11212 * expect(badFn).to.throw(TypeError).with.property('code', 42);
11213 *
11214 * `.throw` accepts an optional `msg` argument which is a custom error message
11215 * to show when the assertion fails. The message can also be given as the
11216 * second argument to `expect`. When not providing two arguments, always use
11217 * the second form.
11218 *
11219 * var goodFn = function () {};
11220 *
11221 * expect(goodFn).to.throw(TypeError, 'x', 'nooo why fail??');
11222 * expect(goodFn, 'nooo why fail??').to.throw();
11223 *
11224 * Due to limitations in ES5, `.throw` may not always work as expected when
11225 * using a transpiler such as Babel or TypeScript. In particular, it may
11226 * produce unexpected results when subclassing the built-in `Error` object and
11227 * then passing the subclassed constructor to `.throw`. See your transpiler's
11228 * docs for details:
11229 *
11230 * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes))
11231 * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work))
11232 *
11233 * Beware of some common mistakes when using the `throw` assertion. One common
11234 * mistake is to accidentally invoke the function yourself instead of letting
11235 * the `throw` assertion invoke the function for you. For example, when
11236 * testing if a function named `fn` throws, provide `fn` instead of `fn()` as
11237 * the target for the assertion.
11238 *
11239 * expect(fn).to.throw(); // Good! Tests `fn` as desired
11240 * expect(fn()).to.throw(); // Bad! Tests result of `fn()`, not `fn`
11241 *
11242 * If you need to assert that your function `fn` throws when passed certain
11243 * arguments, then wrap a call to `fn` inside of another function.
11244 *
11245 * expect(function () { fn(42); }).to.throw(); // Function expression
11246 * expect(() => fn(42)).to.throw(); // ES6 arrow function
11247 *
11248 * Another common mistake is to provide an object method (or any stand-alone
11249 * function that relies on `this`) as the target of the assertion. Doing so is
11250 * problematic because the `this` context will be lost when the function is
11251 * invoked by `.throw`; there's no way for it to know what `this` is supposed
11252 * to be. There are two ways around this problem. One solution is to wrap the
11253 * method or function call inside of another function. Another solution is to
11254 * use `bind`.
11255 *
11256 * expect(function () { cat.meow(); }).to.throw(); // Function expression
11257 * expect(() => cat.meow()).to.throw(); // ES6 arrow function
11258 * expect(cat.meow.bind(cat)).to.throw(); // Bind
11259 *
11260 * Finally, it's worth mentioning that it's a best practice in JavaScript to
11261 * only throw `Error` and derivatives of `Error` such as `ReferenceError`,
11262 * `TypeError`, and user-defined objects that extend `Error`. No other type of
11263 * value will generate a stack trace when initialized. With that said, the
11264 * `throw` assertion does technically support any type of value being thrown,
11265 * not just `Error` and its derivatives.
11266 *
11267 * The aliases `.throws` and `.Throw` can be used interchangeably with
11268 * `.throw`.
11269 *
11270 * @name throw
11271 * @alias throws
11272 * @alias Throw
11273 * @param {Error|ErrorConstructor} errorLike
11274 * @param {String|RegExp} errMsgMatcher error message
11275 * @param {String} msg _optional_
11276 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
11277 * @returns error for chaining (null if no error)
11278 * @namespace BDD
11279 * @api public
11280 */
11281
11282 function assertThrows (errorLike, errMsgMatcher, msg) {
11283 if (msg) flag(this, 'message', msg);
11284 var obj = flag(this, 'object')
11285 , ssfi = flag(this, 'ssfi')
11286 , flagMsg = flag(this, 'message')
11287 , negate = flag(this, 'negate') || false;
11288 new Assertion(obj, flagMsg, ssfi, true).is.a('function');
11289
11290 if (errorLike instanceof RegExp || typeof errorLike === 'string') {
11291 errMsgMatcher = errorLike;
11292 errorLike = null;
11293 }
11294
11295 var caughtErr;
11296 try {
11297 obj();
11298 } catch (err) {
11299 caughtErr = err;
11300 }
11301
11302 // If we have the negate flag enabled and at least one valid argument it means we do expect an error
11303 // but we want it to match a given set of criteria
11304 var everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined;
11305
11306 // If we've got the negate flag enabled and both args, we should only fail if both aren't compatible
11307 // See Issue #551 and PR #683@GitHub
11308 var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
11309 var errorLikeFail = false;
11310 var errMsgMatcherFail = false;
11311
11312 // Checking if error was thrown
11313 if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
11314 // We need this to display results correctly according to their types
11315 var errorLikeString = 'an error';
11316 if (errorLike instanceof Error) {
11317 errorLikeString = '#{exp}';
11318 } else if (errorLike) {
11319 errorLikeString = _.checkError.getConstructorName(errorLike);
11320 }
11321
11322 this.assert(
11323 caughtErr
11324 , 'expected #{this} to throw ' + errorLikeString
11325 , 'expected #{this} to not throw an error but #{act} was thrown'
11326 , errorLike && errorLike.toString()
11327 , (caughtErr instanceof Error ?
11328 caughtErr.toString() : (typeof caughtErr === 'string' ? caughtErr : caughtErr &&
11329 _.checkError.getConstructorName(caughtErr)))
11330 );
11331 }
11332
11333 if (errorLike && caughtErr) {
11334 // We should compare instances only if `errorLike` is an instance of `Error`
11335 if (errorLike instanceof Error) {
11336 var isCompatibleInstance = _.checkError.compatibleInstance(caughtErr, errorLike);
11337
11338 if (isCompatibleInstance === negate) {
11339 // These checks were created to ensure we won't fail too soon when we've got both args and a negate
11340 // See Issue #551 and PR #683@GitHub
11341 if (everyArgIsDefined && negate) {
11342 errorLikeFail = true;
11343 } else {
11344 this.assert(
11345 negate
11346 , 'expected #{this} to throw #{exp} but #{act} was thrown'
11347 , 'expected #{this} to not throw #{exp}' + (caughtErr && !negate ? ' but #{act} was thrown' : '')
11348 , errorLike.toString()
11349 , caughtErr.toString()
11350 );
11351 }
11352 }
11353 }
11354
11355 var isCompatibleConstructor = _.checkError.compatibleConstructor(caughtErr, errorLike);
11356 if (isCompatibleConstructor === negate) {
11357 if (everyArgIsDefined && negate) {
11358 errorLikeFail = true;
11359 } else {
11360 this.assert(
11361 negate
11362 , 'expected #{this} to throw #{exp} but #{act} was thrown'
11363 , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '')
11364 , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike))
11365 , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr))
11366 );
11367 }
11368 }
11369 }
11370
11371 if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) {
11372 // Here we check compatible messages
11373 var placeholder = 'including';
11374 if (errMsgMatcher instanceof RegExp) {
11375 placeholder = 'matching';
11376 }
11377
11378 var isCompatibleMessage = _.checkError.compatibleMessage(caughtErr, errMsgMatcher);
11379 if (isCompatibleMessage === negate) {
11380 if (everyArgIsDefined && negate) {
11381 errMsgMatcherFail = true;
11382 } else {
11383 this.assert(
11384 negate
11385 , 'expected #{this} to throw error ' + placeholder + ' #{exp} but got #{act}'
11386 , 'expected #{this} to throw error not ' + placeholder + ' #{exp}'
11387 , errMsgMatcher
11388 , _.checkError.getMessage(caughtErr)
11389 );
11390 }
11391 }
11392 }
11393
11394 // If both assertions failed and both should've matched we throw an error
11395 if (errorLikeFail && errMsgMatcherFail) {
11396 this.assert(
11397 negate
11398 , 'expected #{this} to throw #{exp} but #{act} was thrown'
11399 , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '')
11400 , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike))
11401 , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr))
11402 );
11403 }
11404
11405 flag(this, 'object', caughtErr);
11406 }
11407
11408 Assertion.addMethod('throw', assertThrows);
11409 Assertion.addMethod('throws', assertThrows);
11410 Assertion.addMethod('Throw', assertThrows);
11411
11412 /**
11413 * ### .respondTo(method[, msg])
11414 *
11415 * When the target is a non-function object, `.respondTo` asserts that the
11416 * target has a method with the given name `method`. The method can be own or
11417 * inherited, and it can be enumerable or non-enumerable.
11418 *
11419 * function Cat () {}
11420 * Cat.prototype.meow = function () {};
11421 *
11422 * expect(new Cat()).to.respondTo('meow');
11423 *
11424 * When the target is a function, `.respondTo` asserts that the target's
11425 * `prototype` property has a method with the given name `method`. Again, the
11426 * method can be own or inherited, and it can be enumerable or non-enumerable.
11427 *
11428 * function Cat () {}
11429 * Cat.prototype.meow = function () {};
11430 *
11431 * expect(Cat).to.respondTo('meow');
11432 *
11433 * Add `.itself` earlier in the chain to force `.respondTo` to treat the
11434 * target as a non-function object, even if it's a function. Thus, it asserts
11435 * that the target has a method with the given name `method`, rather than
11436 * asserting that the target's `prototype` property has a method with the
11437 * given name `method`.
11438 *
11439 * function Cat () {}
11440 * Cat.prototype.meow = function () {};
11441 * Cat.hiss = function () {};
11442 *
11443 * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow');
11444 *
11445 * When not adding `.itself`, it's important to check the target's type before
11446 * using `.respondTo`. See the `.a` doc for info on checking a target's type.
11447 *
11448 * function Cat () {}
11449 * Cat.prototype.meow = function () {};
11450 *
11451 * expect(new Cat()).to.be.an('object').that.respondsTo('meow');
11452 *
11453 * Add `.not` earlier in the chain to negate `.respondTo`.
11454 *
11455 * function Dog () {}
11456 * Dog.prototype.bark = function () {};
11457 *
11458 * expect(new Dog()).to.not.respondTo('meow');
11459 *
11460 * `.respondTo` accepts an optional `msg` argument which is a custom error
11461 * message to show when the assertion fails. The message can also be given as
11462 * the second argument to `expect`.
11463 *
11464 * expect({}).to.respondTo('meow', 'nooo why fail??');
11465 * expect({}, 'nooo why fail??').to.respondTo('meow');
11466 *
11467 * The alias `.respondsTo` can be used interchangeably with `.respondTo`.
11468 *
11469 * @name respondTo
11470 * @alias respondsTo
11471 * @param {String} method
11472 * @param {String} msg _optional_
11473 * @namespace BDD
11474 * @api public
11475 */
11476
11477 function respondTo (method, msg) {
11478 if (msg) flag(this, 'message', msg);
11479 var obj = flag(this, 'object')
11480 , itself = flag(this, 'itself')
11481 , context = ('function' === typeof obj && !itself)
11482 ? obj.prototype[method]
11483 : obj[method];
11484
11485 this.assert(
11486 'function' === typeof context
11487 , 'expected #{this} to respond to ' + _.inspect(method)
11488 , 'expected #{this} to not respond to ' + _.inspect(method)
11489 );
11490 }
11491
11492 Assertion.addMethod('respondTo', respondTo);
11493 Assertion.addMethod('respondsTo', respondTo);
11494
11495 /**
11496 * ### .itself
11497 *
11498 * Forces all `.respondTo` assertions that follow in the chain to behave as if
11499 * the target is a non-function object, even if it's a function. Thus, it
11500 * causes `.respondTo` to assert that the target has a method with the given
11501 * name, rather than asserting that the target's `prototype` property has a
11502 * method with the given name.
11503 *
11504 * function Cat () {}
11505 * Cat.prototype.meow = function () {};
11506 * Cat.hiss = function () {};
11507 *
11508 * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow');
11509 *
11510 * @name itself
11511 * @namespace BDD
11512 * @api public
11513 */
11514
11515 Assertion.addProperty('itself', function () {
11516 flag(this, 'itself', true);
11517 });
11518
11519 /**
11520 * ### .satisfy(matcher[, msg])
11521 *
11522 * Invokes the given `matcher` function with the target being passed as the
11523 * first argument, and asserts that the value returned is truthy.
11524 *
11525 * expect(1).to.satisfy(function(num) {
11526 * return num > 0;
11527 * });
11528 *
11529 * Add `.not` earlier in the chain to negate `.satisfy`.
11530 *
11531 * expect(1).to.not.satisfy(function(num) {
11532 * return num > 2;
11533 * });
11534 *
11535 * `.satisfy` accepts an optional `msg` argument which is a custom error
11536 * message to show when the assertion fails. The message can also be given as
11537 * the second argument to `expect`.
11538 *
11539 * expect(1).to.satisfy(function(num) {
11540 * return num > 2;
11541 * }, 'nooo why fail??');
11542 *
11543 * expect(1, 'nooo why fail??').to.satisfy(function(num) {
11544 * return num > 2;
11545 * });
11546 *
11547 * The alias `.satisfies` can be used interchangeably with `.satisfy`.
11548 *
11549 * @name satisfy
11550 * @alias satisfies
11551 * @param {Function} matcher
11552 * @param {String} msg _optional_
11553 * @namespace BDD
11554 * @api public
11555 */
11556
11557 function satisfy (matcher, msg) {
11558 if (msg) flag(this, 'message', msg);
11559 var obj = flag(this, 'object');
11560 var result = matcher(obj);
11561 this.assert(
11562 result
11563 , 'expected #{this} to satisfy ' + _.objDisplay(matcher)
11564 , 'expected #{this} to not satisfy' + _.objDisplay(matcher)
11565 , flag(this, 'negate') ? false : true
11566 , result
11567 );
11568 }
11569
11570 Assertion.addMethod('satisfy', satisfy);
11571 Assertion.addMethod('satisfies', satisfy);
11572
11573 /**
11574 * ### .closeTo(expected, delta[, msg])
11575 *
11576 * Asserts that the target is a number that's within a given +/- `delta` range
11577 * of the given number `expected`. However, it's often best to assert that the
11578 * target is equal to its expected value.
11579 *
11580 * // Recommended
11581 * expect(1.5).to.equal(1.5);
11582 *
11583 * // Not recommended
11584 * expect(1.5).to.be.closeTo(1, 0.5);
11585 * expect(1.5).to.be.closeTo(2, 0.5);
11586 * expect(1.5).to.be.closeTo(1, 1);
11587 *
11588 * Add `.not` earlier in the chain to negate `.closeTo`.
11589 *
11590 * expect(1.5).to.equal(1.5); // Recommended
11591 * expect(1.5).to.not.be.closeTo(3, 1); // Not recommended
11592 *
11593 * `.closeTo` accepts an optional `msg` argument which is a custom error
11594 * message to show when the assertion fails. The message can also be given as
11595 * the second argument to `expect`.
11596 *
11597 * expect(1.5).to.be.closeTo(3, 1, 'nooo why fail??');
11598 * expect(1.5, 'nooo why fail??').to.be.closeTo(3, 1);
11599 *
11600 * The alias `.approximately` can be used interchangeably with `.closeTo`.
11601 *
11602 * @name closeTo
11603 * @alias approximately
11604 * @param {Number} expected
11605 * @param {Number} delta
11606 * @param {String} msg _optional_
11607 * @namespace BDD
11608 * @api public
11609 */
11610
11611 function closeTo(expected, delta, msg) {
11612 if (msg) flag(this, 'message', msg);
11613 var obj = flag(this, 'object')
11614 , flagMsg = flag(this, 'message')
11615 , ssfi = flag(this, 'ssfi');
11616
11617 new Assertion(obj, flagMsg, ssfi, true).is.a('number');
11618 if (typeof expected !== 'number' || typeof delta !== 'number') {
11619 flagMsg = flagMsg ? flagMsg + ': ' : '';
11620 throw new AssertionError(
11621 flagMsg + 'the arguments to closeTo or approximately must be numbers',
11622 undefined,
11623 ssfi
11624 );
11625 }
11626
11627 this.assert(
11628 Math.abs(obj - expected) <= delta
11629 , 'expected #{this} to be close to ' + expected + ' +/- ' + delta
11630 , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta
11631 );
11632 }
11633
11634 Assertion.addMethod('closeTo', closeTo);
11635 Assertion.addMethod('approximately', closeTo);
11636
11637 // Note: Duplicates are ignored if testing for inclusion instead of sameness.
11638 function isSubsetOf(subset, superset, cmp, contains, ordered) {
11639 if (!contains) {
11640 if (subset.length !== superset.length) return false;
11641 superset = superset.slice();
11642 }
11643
11644 return subset.every(function(elem, idx) {
11645 if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
11646
11647 if (!cmp) {
11648 var matchIdx = superset.indexOf(elem);
11649 if (matchIdx === -1) return false;
11650
11651 // Remove match from superset so not counted twice if duplicate in subset.
11652 if (!contains) superset.splice(matchIdx, 1);
11653 return true;
11654 }
11655
11656 return superset.some(function(elem2, matchIdx) {
11657 if (!cmp(elem, elem2)) return false;
11658
11659 // Remove match from superset so not counted twice if duplicate in subset.
11660 if (!contains) superset.splice(matchIdx, 1);
11661 return true;
11662 });
11663 });
11664 }
11665
11666 /**
11667 * ### .members(set[, msg])
11668 *
11669 * Asserts that the target array has the same members as the given array
11670 * `set`.
11671 *
11672 * expect([1, 2, 3]).to.have.members([2, 1, 3]);
11673 * expect([1, 2, 2]).to.have.members([2, 1, 2]);
11674 *
11675 * By default, members are compared using strict (`===`) equality. Add `.deep`
11676 * earlier in the chain to use deep equality instead. See the `deep-eql`
11677 * project page for info on the deep equality algorithm:
11678 * https://github.com/chaijs/deep-eql.
11679 *
11680 * // Target array deeply (but not strictly) has member `{a: 1}`
11681 * expect([{a: 1}]).to.have.deep.members([{a: 1}]);
11682 * expect([{a: 1}]).to.not.have.members([{a: 1}]);
11683 *
11684 * By default, order doesn't matter. Add `.ordered` earlier in the chain to
11685 * require that members appear in the same order.
11686 *
11687 * expect([1, 2, 3]).to.have.ordered.members([1, 2, 3]);
11688 * expect([1, 2, 3]).to.have.members([2, 1, 3])
11689 * .but.not.ordered.members([2, 1, 3]);
11690 *
11691 * By default, both arrays must be the same size. Add `.include` earlier in
11692 * the chain to require that the target's members be a superset of the
11693 * expected members. Note that duplicates are ignored in the subset when
11694 * `.include` is added.
11695 *
11696 * // Target array is a superset of [1, 2] but not identical
11697 * expect([1, 2, 3]).to.include.members([1, 2]);
11698 * expect([1, 2, 3]).to.not.have.members([1, 2]);
11699 *
11700 * // Duplicates in the subset are ignored
11701 * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]);
11702 *
11703 * `.deep`, `.ordered`, and `.include` can all be combined. However, if
11704 * `.include` and `.ordered` are combined, the ordering begins at the start of
11705 * both arrays.
11706 *
11707 * expect([{a: 1}, {b: 2}, {c: 3}])
11708 * .to.include.deep.ordered.members([{a: 1}, {b: 2}])
11709 * .but.not.include.deep.ordered.members([{b: 2}, {c: 3}]);
11710 *
11711 * Add `.not` earlier in the chain to negate `.members`. However, it's
11712 * dangerous to do so. The problem is that it creates uncertain expectations
11713 * by asserting that the target array doesn't have all of the same members as
11714 * the given array `set` but may or may not have some of them. It's often best
11715 * to identify the exact output that's expected, and then write an assertion
11716 * that only accepts that exact output.
11717 *
11718 * expect([1, 2]).to.not.include(3).and.not.include(4); // Recommended
11719 * expect([1, 2]).to.not.have.members([3, 4]); // Not recommended
11720 *
11721 * `.members` accepts an optional `msg` argument which is a custom error
11722 * message to show when the assertion fails. The message can also be given as
11723 * the second argument to `expect`.
11724 *
11725 * expect([1, 2]).to.have.members([1, 2, 3], 'nooo why fail??');
11726 * expect([1, 2], 'nooo why fail??').to.have.members([1, 2, 3]);
11727 *
11728 * @name members
11729 * @param {Array} set
11730 * @param {String} msg _optional_
11731 * @namespace BDD
11732 * @api public
11733 */
11734
11735 Assertion.addMethod('members', function (subset, msg) {
11736 if (msg) flag(this, 'message', msg);
11737 var obj = flag(this, 'object')
11738 , flagMsg = flag(this, 'message')
11739 , ssfi = flag(this, 'ssfi');
11740
11741 new Assertion(obj, flagMsg, ssfi, true).to.be.an('array');
11742 new Assertion(subset, flagMsg, ssfi, true).to.be.an('array');
11743
11744 var contains = flag(this, 'contains');
11745 var ordered = flag(this, 'ordered');
11746
11747 var subject, failMsg, failNegateMsg;
11748
11749 if (contains) {
11750 subject = ordered ? 'an ordered superset' : 'a superset';
11751 failMsg = 'expected #{this} to be ' + subject + ' of #{exp}';
11752 failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}';
11753 } else {
11754 subject = ordered ? 'ordered members' : 'members';
11755 failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}';
11756 failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}';
11757 }
11758
11759 var cmp = flag(this, 'deep') ? _.eql : undefined;
11760
11761 this.assert(
11762 isSubsetOf(subset, obj, cmp, contains, ordered)
11763 , failMsg
11764 , failNegateMsg
11765 , subset
11766 , obj
11767 , true
11768 );
11769 });
11770
11771 /**
11772 * ### .oneOf(list[, msg])
11773 *
11774 * Asserts that the target is a member of the given array `list`. However,
11775 * it's often best to assert that the target is equal to its expected value.
11776 *
11777 * expect(1).to.equal(1); // Recommended
11778 * expect(1).to.be.oneOf([1, 2, 3]); // Not recommended
11779 *
11780 * Comparisons are performed using strict (`===`) equality.
11781 *
11782 * Add `.not` earlier in the chain to negate `.oneOf`.
11783 *
11784 * expect(1).to.equal(1); // Recommended
11785 * expect(1).to.not.be.oneOf([2, 3, 4]); // Not recommended
11786 *
11787 * `.oneOf` accepts an optional `msg` argument which is a custom error message
11788 * to show when the assertion fails. The message can also be given as the
11789 * second argument to `expect`.
11790 *
11791 * expect(1).to.be.oneOf([2, 3, 4], 'nooo why fail??');
11792 * expect(1, 'nooo why fail??').to.be.oneOf([2, 3, 4]);
11793 *
11794 * @name oneOf
11795 * @param {Array<*>} list
11796 * @param {String} msg _optional_
11797 * @namespace BDD
11798 * @api public
11799 */
11800
11801 function oneOf (list, msg) {
11802 if (msg) flag(this, 'message', msg);
11803 var expected = flag(this, 'object')
11804 , flagMsg = flag(this, 'message')
11805 , ssfi = flag(this, 'ssfi');
11806 new Assertion(list, flagMsg, ssfi, true).to.be.an('array');
11807
11808 this.assert(
11809 list.indexOf(expected) > -1
11810 , 'expected #{this} to be one of #{exp}'
11811 , 'expected #{this} to not be one of #{exp}'
11812 , list
11813 , expected
11814 );
11815 }
11816
11817 Assertion.addMethod('oneOf', oneOf);
11818
11819
11820 /**
11821 * ### .change(subject[, prop[, msg]])
11822 *
11823 * When one argument is provided, `.change` asserts that the given function
11824 * `subject` returns a different value when it's invoked before the target
11825 * function compared to when it's invoked afterward. However, it's often best
11826 * to assert that `subject` is equal to its expected value.
11827 *
11828 * var dots = ''
11829 * , addDot = function () { dots += '.'; }
11830 * , getDots = function () { return dots; };
11831 *
11832 * // Recommended
11833 * expect(getDots()).to.equal('');
11834 * addDot();
11835 * expect(getDots()).to.equal('.');
11836 *
11837 * // Not recommended
11838 * expect(addDot).to.change(getDots);
11839 *
11840 * When two arguments are provided, `.change` asserts that the value of the
11841 * given object `subject`'s `prop` property is different before invoking the
11842 * target function compared to afterward.
11843 *
11844 * var myObj = {dots: ''}
11845 * , addDot = function () { myObj.dots += '.'; };
11846 *
11847 * // Recommended
11848 * expect(myObj).to.have.property('dots', '');
11849 * addDot();
11850 * expect(myObj).to.have.property('dots', '.');
11851 *
11852 * // Not recommended
11853 * expect(addDot).to.change(myObj, 'dots');
11854 *
11855 * Strict (`===`) equality is used to compare before and after values.
11856 *
11857 * Add `.not` earlier in the chain to negate `.change`.
11858 *
11859 * var dots = ''
11860 * , noop = function () {}
11861 * , getDots = function () { return dots; };
11862 *
11863 * expect(noop).to.not.change(getDots);
11864 *
11865 * var myObj = {dots: ''}
11866 * , noop = function () {};
11867 *
11868 * expect(noop).to.not.change(myObj, 'dots');
11869 *
11870 * `.change` accepts an optional `msg` argument which is a custom error
11871 * message to show when the assertion fails. The message can also be given as
11872 * the second argument to `expect`. When not providing two arguments, always
11873 * use the second form.
11874 *
11875 * var myObj = {dots: ''}
11876 * , addDot = function () { myObj.dots += '.'; };
11877 *
11878 * expect(addDot).to.not.change(myObj, 'dots', 'nooo why fail??');
11879 *
11880 * var dots = ''
11881 * , addDot = function () { dots += '.'; }
11882 * , getDots = function () { return dots; };
11883 *
11884 * expect(addDot, 'nooo why fail??').to.not.change(getDots);
11885 *
11886 * `.change` also causes all `.by` assertions that follow in the chain to
11887 * assert how much a numeric subject was increased or decreased by. However,
11888 * it's dangerous to use `.change.by`. The problem is that it creates
11889 * uncertain expectations by asserting that the subject either increases by
11890 * the given delta, or that it decreases by the given delta. It's often best
11891 * to identify the exact output that's expected, and then write an assertion
11892 * that only accepts that exact output.
11893 *
11894 * var myObj = {val: 1}
11895 * , addTwo = function () { myObj.val += 2; }
11896 * , subtractTwo = function () { myObj.val -= 2; };
11897 *
11898 * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended
11899 * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended
11900 *
11901 * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended
11902 * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended
11903 *
11904 * The alias `.changes` can be used interchangeably with `.change`.
11905 *
11906 * @name change
11907 * @alias changes
11908 * @param {String} subject
11909 * @param {String} prop name _optional_
11910 * @param {String} msg _optional_
11911 * @namespace BDD
11912 * @api public
11913 */
11914
11915 function assertChanges (subject, prop, msg) {
11916 if (msg) flag(this, 'message', msg);
11917 var fn = flag(this, 'object')
11918 , flagMsg = flag(this, 'message')
11919 , ssfi = flag(this, 'ssfi');
11920 new Assertion(fn, flagMsg, ssfi, true).is.a('function');
11921
11922 var initial;
11923 if (!prop) {
11924 new Assertion(subject, flagMsg, ssfi, true).is.a('function');
11925 initial = subject();
11926 } else {
11927 new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
11928 initial = subject[prop];
11929 }
11930
11931 fn();
11932
11933 var final = prop === undefined || prop === null ? subject() : subject[prop];
11934 var msgObj = prop === undefined || prop === null ? initial : '.' + prop;
11935
11936 // This gets flagged because of the .by(delta) assertion
11937 flag(this, 'deltaMsgObj', msgObj);
11938 flag(this, 'initialDeltaValue', initial);
11939 flag(this, 'finalDeltaValue', final);
11940 flag(this, 'deltaBehavior', 'change');
11941 flag(this, 'realDelta', final !== initial);
11942
11943 this.assert(
11944 initial !== final
11945 , 'expected ' + msgObj + ' to change'
11946 , 'expected ' + msgObj + ' to not change'
11947 );
11948 }
11949
11950 Assertion.addMethod('change', assertChanges);
11951 Assertion.addMethod('changes', assertChanges);
11952
11953 /**
11954 * ### .increase(subject[, prop[, msg]])
11955 *
11956 * When one argument is provided, `.increase` asserts that the given function
11957 * `subject` returns a greater number when it's invoked after invoking the
11958 * target function compared to when it's invoked beforehand. `.increase` also
11959 * causes all `.by` assertions that follow in the chain to assert how much
11960 * greater of a number is returned. It's often best to assert that the return
11961 * value increased by the expected amount, rather than asserting it increased
11962 * by any amount.
11963 *
11964 * var val = 1
11965 * , addTwo = function () { val += 2; }
11966 * , getVal = function () { return val; };
11967 *
11968 * expect(addTwo).to.increase(getVal).by(2); // Recommended
11969 * expect(addTwo).to.increase(getVal); // Not recommended
11970 *
11971 * When two arguments are provided, `.increase` asserts that the value of the
11972 * given object `subject`'s `prop` property is greater after invoking the
11973 * target function compared to beforehand.
11974 *
11975 * var myObj = {val: 1}
11976 * , addTwo = function () { myObj.val += 2; };
11977 *
11978 * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended
11979 * expect(addTwo).to.increase(myObj, 'val'); // Not recommended
11980 *
11981 * Add `.not` earlier in the chain to negate `.increase`. However, it's
11982 * dangerous to do so. The problem is that it creates uncertain expectations
11983 * by asserting that the subject either decreases, or that it stays the same.
11984 * It's often best to identify the exact output that's expected, and then
11985 * write an assertion that only accepts that exact output.
11986 *
11987 * When the subject is expected to decrease, it's often best to assert that it
11988 * decreased by the expected amount.
11989 *
11990 * var myObj = {val: 1}
11991 * , subtractTwo = function () { myObj.val -= 2; };
11992 *
11993 * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended
11994 * expect(subtractTwo).to.not.increase(myObj, 'val'); // Not recommended
11995 *
11996 * When the subject is expected to stay the same, it's often best to assert
11997 * exactly that.
11998 *
11999 * var myObj = {val: 1}
12000 * , noop = function () {};
12001 *
12002 * expect(noop).to.not.change(myObj, 'val'); // Recommended
12003 * expect(noop).to.not.increase(myObj, 'val'); // Not recommended
12004 *
12005 * `.increase` accepts an optional `msg` argument which is a custom error
12006 * message to show when the assertion fails. The message can also be given as
12007 * the second argument to `expect`. When not providing two arguments, always
12008 * use the second form.
12009 *
12010 * var myObj = {val: 1}
12011 * , noop = function () {};
12012 *
12013 * expect(noop).to.increase(myObj, 'val', 'nooo why fail??');
12014 *
12015 * var val = 1
12016 * , noop = function () {}
12017 * , getVal = function () { return val; };
12018 *
12019 * expect(noop, 'nooo why fail??').to.increase(getVal);
12020 *
12021 * The alias `.increases` can be used interchangeably with `.increase`.
12022 *
12023 * @name increase
12024 * @alias increases
12025 * @param {String|Function} subject
12026 * @param {String} prop name _optional_
12027 * @param {String} msg _optional_
12028 * @namespace BDD
12029 * @api public
12030 */
12031
12032 function assertIncreases (subject, prop, msg) {
12033 if (msg) flag(this, 'message', msg);
12034 var fn = flag(this, 'object')
12035 , flagMsg = flag(this, 'message')
12036 , ssfi = flag(this, 'ssfi');
12037 new Assertion(fn, flagMsg, ssfi, true).is.a('function');
12038
12039 var initial;
12040 if (!prop) {
12041 new Assertion(subject, flagMsg, ssfi, true).is.a('function');
12042 initial = subject();
12043 } else {
12044 new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
12045 initial = subject[prop];
12046 }
12047
12048 // Make sure that the target is a number
12049 new Assertion(initial, flagMsg, ssfi, true).is.a('number');
12050
12051 fn();
12052
12053 var final = prop === undefined || prop === null ? subject() : subject[prop];
12054 var msgObj = prop === undefined || prop === null ? initial : '.' + prop;
12055
12056 flag(this, 'deltaMsgObj', msgObj);
12057 flag(this, 'initialDeltaValue', initial);
12058 flag(this, 'finalDeltaValue', final);
12059 flag(this, 'deltaBehavior', 'increase');
12060 flag(this, 'realDelta', final - initial);
12061
12062 this.assert(
12063 final - initial > 0
12064 , 'expected ' + msgObj + ' to increase'
12065 , 'expected ' + msgObj + ' to not increase'
12066 );
12067 }
12068
12069 Assertion.addMethod('increase', assertIncreases);
12070 Assertion.addMethod('increases', assertIncreases);
12071
12072 /**
12073 * ### .decrease(subject[, prop[, msg]])
12074 *
12075 * When one argument is provided, `.decrease` asserts that the given function
12076 * `subject` returns a lesser number when it's invoked after invoking the
12077 * target function compared to when it's invoked beforehand. `.decrease` also
12078 * causes all `.by` assertions that follow in the chain to assert how much
12079 * lesser of a number is returned. It's often best to assert that the return
12080 * value decreased by the expected amount, rather than asserting it decreased
12081 * by any amount.
12082 *
12083 * var val = 1
12084 * , subtractTwo = function () { val -= 2; }
12085 * , getVal = function () { return val; };
12086 *
12087 * expect(subtractTwo).to.decrease(getVal).by(2); // Recommended
12088 * expect(subtractTwo).to.decrease(getVal); // Not recommended
12089 *
12090 * When two arguments are provided, `.decrease` asserts that the value of the
12091 * given object `subject`'s `prop` property is lesser after invoking the
12092 * target function compared to beforehand.
12093 *
12094 * var myObj = {val: 1}
12095 * , subtractTwo = function () { myObj.val -= 2; };
12096 *
12097 * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended
12098 * expect(subtractTwo).to.decrease(myObj, 'val'); // Not recommended
12099 *
12100 * Add `.not` earlier in the chain to negate `.decrease`. However, it's
12101 * dangerous to do so. The problem is that it creates uncertain expectations
12102 * by asserting that the subject either increases, or that it stays the same.
12103 * It's often best to identify the exact output that's expected, and then
12104 * write an assertion that only accepts that exact output.
12105 *
12106 * When the subject is expected to increase, it's often best to assert that it
12107 * increased by the expected amount.
12108 *
12109 * var myObj = {val: 1}
12110 * , addTwo = function () { myObj.val += 2; };
12111 *
12112 * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended
12113 * expect(addTwo).to.not.decrease(myObj, 'val'); // Not recommended
12114 *
12115 * When the subject is expected to stay the same, it's often best to assert
12116 * exactly that.
12117 *
12118 * var myObj = {val: 1}
12119 * , noop = function () {};
12120 *
12121 * expect(noop).to.not.change(myObj, 'val'); // Recommended
12122 * expect(noop).to.not.decrease(myObj, 'val'); // Not recommended
12123 *
12124 * `.decrease` accepts an optional `msg` argument which is a custom error
12125 * message to show when the assertion fails. The message can also be given as
12126 * the second argument to `expect`. When not providing two arguments, always
12127 * use the second form.
12128 *
12129 * var myObj = {val: 1}
12130 * , noop = function () {};
12131 *
12132 * expect(noop).to.decrease(myObj, 'val', 'nooo why fail??');
12133 *
12134 * var val = 1
12135 * , noop = function () {}
12136 * , getVal = function () { return val; };
12137 *
12138 * expect(noop, 'nooo why fail??').to.decrease(getVal);
12139 *
12140 * The alias `.decreases` can be used interchangeably with `.decrease`.
12141 *
12142 * @name decrease
12143 * @alias decreases
12144 * @param {String|Function} subject
12145 * @param {String} prop name _optional_
12146 * @param {String} msg _optional_
12147 * @namespace BDD
12148 * @api public
12149 */
12150
12151 function assertDecreases (subject, prop, msg) {
12152 if (msg) flag(this, 'message', msg);
12153 var fn = flag(this, 'object')
12154 , flagMsg = flag(this, 'message')
12155 , ssfi = flag(this, 'ssfi');
12156 new Assertion(fn, flagMsg, ssfi, true).is.a('function');
12157
12158 var initial;
12159 if (!prop) {
12160 new Assertion(subject, flagMsg, ssfi, true).is.a('function');
12161 initial = subject();
12162 } else {
12163 new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
12164 initial = subject[prop];
12165 }
12166
12167 // Make sure that the target is a number
12168 new Assertion(initial, flagMsg, ssfi, true).is.a('number');
12169
12170 fn();
12171
12172 var final = prop === undefined || prop === null ? subject() : subject[prop];
12173 var msgObj = prop === undefined || prop === null ? initial : '.' + prop;
12174
12175 flag(this, 'deltaMsgObj', msgObj);
12176 flag(this, 'initialDeltaValue', initial);
12177 flag(this, 'finalDeltaValue', final);
12178 flag(this, 'deltaBehavior', 'decrease');
12179 flag(this, 'realDelta', initial - final);
12180
12181 this.assert(
12182 final - initial < 0
12183 , 'expected ' + msgObj + ' to decrease'
12184 , 'expected ' + msgObj + ' to not decrease'
12185 );
12186 }
12187
12188 Assertion.addMethod('decrease', assertDecreases);
12189 Assertion.addMethod('decreases', assertDecreases);
12190
12191 /**
12192 * ### .by(delta[, msg])
12193 *
12194 * When following an `.increase` assertion in the chain, `.by` asserts that
12195 * the subject of the `.increase` assertion increased by the given `delta`.
12196 *
12197 * var myObj = {val: 1}
12198 * , addTwo = function () { myObj.val += 2; };
12199 *
12200 * expect(addTwo).to.increase(myObj, 'val').by(2);
12201 *
12202 * When following a `.decrease` assertion in the chain, `.by` asserts that the
12203 * subject of the `.decrease` assertion decreased by the given `delta`.
12204 *
12205 * var myObj = {val: 1}
12206 * , subtractTwo = function () { myObj.val -= 2; };
12207 *
12208 * expect(subtractTwo).to.decrease(myObj, 'val').by(2);
12209 *
12210 * When following a `.change` assertion in the chain, `.by` asserts that the
12211 * subject of the `.change` assertion either increased or decreased by the
12212 * given `delta`. However, it's dangerous to use `.change.by`. The problem is
12213 * that it creates uncertain expectations. It's often best to identify the
12214 * exact output that's expected, and then write an assertion that only accepts
12215 * that exact output.
12216 *
12217 * var myObj = {val: 1}
12218 * , addTwo = function () { myObj.val += 2; }
12219 * , subtractTwo = function () { myObj.val -= 2; };
12220 *
12221 * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended
12222 * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended
12223 *
12224 * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended
12225 * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended
12226 *
12227 * Add `.not` earlier in the chain to negate `.by`. However, it's often best
12228 * to assert that the subject changed by its expected delta, rather than
12229 * asserting that it didn't change by one of countless unexpected deltas.
12230 *
12231 * var myObj = {val: 1}
12232 * , addTwo = function () { myObj.val += 2; };
12233 *
12234 * // Recommended
12235 * expect(addTwo).to.increase(myObj, 'val').by(2);
12236 *
12237 * // Not recommended
12238 * expect(addTwo).to.increase(myObj, 'val').but.not.by(3);
12239 *
12240 * `.by` accepts an optional `msg` argument which is a custom error message to
12241 * show when the assertion fails. The message can also be given as the second
12242 * argument to `expect`.
12243 *
12244 * var myObj = {val: 1}
12245 * , addTwo = function () { myObj.val += 2; };
12246 *
12247 * expect(addTwo).to.increase(myObj, 'val').by(3, 'nooo why fail??');
12248 * expect(addTwo, 'nooo why fail??').to.increase(myObj, 'val').by(3);
12249 *
12250 * @name by
12251 * @param {Number} delta
12252 * @param {String} msg _optional_
12253 * @namespace BDD
12254 * @api public
12255 */
12256
12257 function assertDelta(delta, msg) {
12258 if (msg) flag(this, 'message', msg);
12259
12260 var msgObj = flag(this, 'deltaMsgObj');
12261 var initial = flag(this, 'initialDeltaValue');
12262 var final = flag(this, 'finalDeltaValue');
12263 var behavior = flag(this, 'deltaBehavior');
12264 var realDelta = flag(this, 'realDelta');
12265
12266 var expression;
12267 if (behavior === 'change') {
12268 expression = Math.abs(final - initial) === Math.abs(delta);
12269 } else {
12270 expression = realDelta === Math.abs(delta);
12271 }
12272
12273 this.assert(
12274 expression
12275 , 'expected ' + msgObj + ' to ' + behavior + ' by ' + delta
12276 , 'expected ' + msgObj + ' to not ' + behavior + ' by ' + delta
12277 );
12278 }
12279
12280 Assertion.addMethod('by', assertDelta);
12281
12282 /**
12283 * ### .extensible
12284 *
12285 * Asserts that the target is extensible, which means that new properties can
12286 * be added to it. Primitives are never extensible.
12287 *
12288 * expect({a: 1}).to.be.extensible;
12289 *
12290 * Add `.not` earlier in the chain to negate `.extensible`.
12291 *
12292 * var nonExtensibleObject = Object.preventExtensions({})
12293 * , sealedObject = Object.seal({})
12294 * , frozenObject = Object.freeze({});
12295 *
12296 * expect(nonExtensibleObject).to.not.be.extensible;
12297 * expect(sealedObject).to.not.be.extensible;
12298 * expect(frozenObject).to.not.be.extensible;
12299 * expect(1).to.not.be.extensible;
12300 *
12301 * A custom error message can be given as the second argument to `expect`.
12302 *
12303 * expect(1, 'nooo why fail??').to.be.extensible;
12304 *
12305 * @name extensible
12306 * @namespace BDD
12307 * @api public
12308 */
12309
12310 Assertion.addProperty('extensible', function() {
12311 var obj = flag(this, 'object');
12312
12313 // In ES5, if the argument to this method is a primitive, then it will cause a TypeError.
12314 // In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false.
12315 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible
12316 // The following provides ES6 behavior for ES5 environments.
12317
12318 var isExtensible = obj === Object(obj) && Object.isExtensible(obj);
12319
12320 this.assert(
12321 isExtensible
12322 , 'expected #{this} to be extensible'
12323 , 'expected #{this} to not be extensible'
12324 );
12325 });
12326
12327 /**
12328 * ### .sealed
12329 *
12330 * Asserts that the target is sealed, which means that new properties can't be
12331 * added to it, and its existing properties can't be reconfigured or deleted.
12332 * However, it's possible that its existing properties can still be reassigned
12333 * to different values. Primitives are always sealed.
12334 *
12335 * var sealedObject = Object.seal({});
12336 * var frozenObject = Object.freeze({});
12337 *
12338 * expect(sealedObject).to.be.sealed;
12339 * expect(frozenObject).to.be.sealed;
12340 * expect(1).to.be.sealed;
12341 *
12342 * Add `.not` earlier in the chain to negate `.sealed`.
12343 *
12344 * expect({a: 1}).to.not.be.sealed;
12345 *
12346 * A custom error message can be given as the second argument to `expect`.
12347 *
12348 * expect({a: 1}, 'nooo why fail??').to.be.sealed;
12349 *
12350 * @name sealed
12351 * @namespace BDD
12352 * @api public
12353 */
12354
12355 Assertion.addProperty('sealed', function() {
12356 var obj = flag(this, 'object');
12357
12358 // In ES5, if the argument to this method is a primitive, then it will cause a TypeError.
12359 // In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true.
12360 // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed
12361 // The following provides ES6 behavior for ES5 environments.
12362
12363 var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
12364
12365 this.assert(
12366 isSealed
12367 , 'expected #{this} to be sealed'
12368 , 'expected #{this} to not be sealed'
12369 );
12370 });
12371
12372 /**
12373 * ### .frozen
12374 *
12375 * Asserts that the target is frozen, which means that new properties can't be
12376 * added to it, and its existing properties can't be reassigned to different
12377 * values, reconfigured, or deleted. Primitives are always frozen.
12378 *
12379 * var frozenObject = Object.freeze({});
12380 *
12381 * expect(frozenObject).to.be.frozen;
12382 * expect(1).to.be.frozen;
12383 *
12384 * Add `.not` earlier in the chain to negate `.frozen`.
12385 *
12386 * expect({a: 1}).to.not.be.frozen;
12387 *
12388 * A custom error message can be given as the second argument to `expect`.
12389 *
12390 * expect({a: 1}, 'nooo why fail??').to.be.frozen;
12391 *
12392 * @name frozen
12393 * @namespace BDD
12394 * @api public
12395 */
12396
12397 Assertion.addProperty('frozen', function() {
12398 var obj = flag(this, 'object');
12399
12400 // In ES5, if the argument to this method is a primitive, then it will cause a TypeError.
12401 // In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true.
12402 // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen
12403 // The following provides ES6 behavior for ES5 environments.
12404
12405 var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
12406
12407 this.assert(
12408 isFrozen
12409 , 'expected #{this} to be frozen'
12410 , 'expected #{this} to not be frozen'
12411 );
12412 });
12413
12414 /**
12415 * ### .finite
12416 *
12417 * Asserts that the target is a number, and isn't `NaN` or positive/negative
12418 * `Infinity`.
12419 *
12420 * expect(1).to.be.finite;
12421 *
12422 * Add `.not` earlier in the chain to negate `.finite`. However, it's
12423 * dangerous to do so. The problem is that it creates uncertain expectations
12424 * by asserting that the subject either isn't a number, or that it's `NaN`, or
12425 * that it's positive `Infinity`, or that it's negative `Infinity`. It's often
12426 * best to identify the exact output that's expected, and then write an
12427 * assertion that only accepts that exact output.
12428 *
12429 * When the target isn't expected to be a number, it's often best to assert
12430 * that it's the expected type, rather than asserting that it isn't one of
12431 * many unexpected types.
12432 *
12433 * expect('foo').to.be.a('string'); // Recommended
12434 * expect('foo').to.not.be.finite; // Not recommended
12435 *
12436 * When the target is expected to be `NaN`, it's often best to assert exactly
12437 * that.
12438 *
12439 * expect(NaN).to.be.NaN; // Recommended
12440 * expect(NaN).to.not.be.finite; // Not recommended
12441 *
12442 * When the target is expected to be positive infinity, it's often best to
12443 * assert exactly that.
12444 *
12445 * expect(Infinity).to.equal(Infinity); // Recommended
12446 * expect(Infinity).to.not.be.finite; // Not recommended
12447 *
12448 * When the target is expected to be negative infinity, it's often best to
12449 * assert exactly that.
12450 *
12451 * expect(-Infinity).to.equal(-Infinity); // Recommended
12452 * expect(-Infinity).to.not.be.finite; // Not recommended
12453 *
12454 * A custom error message can be given as the second argument to `expect`.
12455 *
12456 * expect('foo', 'nooo why fail??').to.be.finite;
12457 *
12458 * @name finite
12459 * @namespace BDD
12460 * @api public
12461 */
12462
12463 Assertion.addProperty('finite', function(msg) {
12464 var obj = flag(this, 'object');
12465
12466 this.assert(
12467 typeof obj === "number" && isFinite(obj)
12468 , 'expected #{this} to be a finite number'
12469 , 'expected #{this} to not be a finite number'
12470 );
12471 });
12472};
12473
12474/*!
12475 * chai
12476 * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
12477 * MIT Licensed
12478 */
12479
12480var expect = function (chai, util) {
12481 chai.expect = function (val, message) {
12482 return new chai.Assertion(val, message);
12483 };
12484
12485 /**
12486 * ### .fail(actual, expected, [message], [operator])
12487 *
12488 * Throw a failure.
12489 *
12490 * @name fail
12491 * @param {Mixed} actual
12492 * @param {Mixed} expected
12493 * @param {String} message
12494 * @param {String} operator
12495 * @namespace BDD
12496 * @api public
12497 */
12498
12499 chai.expect.fail = function (actual, expected, message, operator) {
12500 message = message || 'expect.fail()';
12501 throw new chai.AssertionError(message, {
12502 actual: actual
12503 , expected: expected
12504 , operator: operator
12505 }, chai.expect.fail);
12506 };
12507};
12508
12509/*!
12510 * chai
12511 * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
12512 * MIT Licensed
12513 */
12514
12515var should = function (chai, util) {
12516 var Assertion = chai.Assertion;
12517
12518 function loadShould () {
12519 // explicitly define this method as function as to have it's name to include as `ssfi`
12520 function shouldGetter() {
12521 if (this instanceof String
12522 || this instanceof Number
12523 || this instanceof Boolean
12524 || typeof Symbol === 'function' && this instanceof Symbol) {
12525 return new Assertion(this.valueOf(), null, shouldGetter);
12526 }
12527 return new Assertion(this, null, shouldGetter);
12528 }
12529 function shouldSetter(value) {
12530 // See https://github.com/chaijs/chai/issues/86: this makes
12531 // `whatever.should = someValue` actually set `someValue`, which is
12532 // especially useful for `global.should = require('chai').should()`.
12533 //
12534 // Note that we have to use [[DefineProperty]] instead of [[Put]]
12535 // since otherwise we would trigger this very setter!
12536 Object.defineProperty(this, 'should', {
12537 value: value,
12538 enumerable: true,
12539 configurable: true,
12540 writable: true
12541 });
12542 }
12543 // modify Object.prototype to have `should`
12544 Object.defineProperty(Object.prototype, 'should', {
12545 set: shouldSetter
12546 , get: shouldGetter
12547 , configurable: true
12548 });
12549
12550 var should = {};
12551
12552 /**
12553 * ### .fail(actual, expected, [message], [operator])
12554 *
12555 * Throw a failure.
12556 *
12557 * @name fail
12558 * @param {Mixed} actual
12559 * @param {Mixed} expected
12560 * @param {String} message
12561 * @param {String} operator
12562 * @namespace BDD
12563 * @api public
12564 */
12565
12566 should.fail = function (actual, expected, message, operator) {
12567 message = message || 'should.fail()';
12568 throw new chai.AssertionError(message, {
12569 actual: actual
12570 , expected: expected
12571 , operator: operator
12572 }, should.fail);
12573 };
12574
12575 /**
12576 * ### .equal(actual, expected, [message])
12577 *
12578 * Asserts non-strict equality (`==`) of `actual` and `expected`.
12579 *
12580 * should.equal(3, '3', '== coerces values to strings');
12581 *
12582 * @name equal
12583 * @param {Mixed} actual
12584 * @param {Mixed} expected
12585 * @param {String} message
12586 * @namespace Should
12587 * @api public
12588 */
12589
12590 should.equal = function (val1, val2, msg) {
12591 new Assertion(val1, msg).to.equal(val2);
12592 };
12593
12594 /**
12595 * ### .throw(function, [constructor/string/regexp], [string/regexp], [message])
12596 *
12597 * Asserts that `function` will throw an error that is an instance of
12598 * `constructor`, or alternately that it will throw an error with message
12599 * matching `regexp`.
12600 *
12601 * should.throw(fn, 'function throws a reference error');
12602 * should.throw(fn, /function throws a reference error/);
12603 * should.throw(fn, ReferenceError);
12604 * should.throw(fn, ReferenceError, 'function throws a reference error');
12605 * should.throw(fn, ReferenceError, /function throws a reference error/);
12606 *
12607 * @name throw
12608 * @alias Throw
12609 * @param {Function} function
12610 * @param {ErrorConstructor} constructor
12611 * @param {RegExp} regexp
12612 * @param {String} message
12613 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
12614 * @namespace Should
12615 * @api public
12616 */
12617
12618 should.Throw = function (fn, errt, errs, msg) {
12619 new Assertion(fn, msg).to.Throw(errt, errs);
12620 };
12621
12622 /**
12623 * ### .exist
12624 *
12625 * Asserts that the target is neither `null` nor `undefined`.
12626 *
12627 * var foo = 'hi';
12628 *
12629 * should.exist(foo, 'foo exists');
12630 *
12631 * @name exist
12632 * @namespace Should
12633 * @api public
12634 */
12635
12636 should.exist = function (val, msg) {
12637 new Assertion(val, msg).to.exist;
12638 };
12639
12640 // negation
12641 should.not = {};
12642
12643 /**
12644 * ### .not.equal(actual, expected, [message])
12645 *
12646 * Asserts non-strict inequality (`!=`) of `actual` and `expected`.
12647 *
12648 * should.not.equal(3, 4, 'these numbers are not equal');
12649 *
12650 * @name not.equal
12651 * @param {Mixed} actual
12652 * @param {Mixed} expected
12653 * @param {String} message
12654 * @namespace Should
12655 * @api public
12656 */
12657
12658 should.not.equal = function (val1, val2, msg) {
12659 new Assertion(val1, msg).to.not.equal(val2);
12660 };
12661
12662 /**
12663 * ### .throw(function, [constructor/regexp], [message])
12664 *
12665 * Asserts that `function` will _not_ throw an error that is an instance of
12666 * `constructor`, or alternately that it will not throw an error with message
12667 * matching `regexp`.
12668 *
12669 * should.not.throw(fn, Error, 'function does not throw');
12670 *
12671 * @name not.throw
12672 * @alias not.Throw
12673 * @param {Function} function
12674 * @param {ErrorConstructor} constructor
12675 * @param {RegExp} regexp
12676 * @param {String} message
12677 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
12678 * @namespace Should
12679 * @api public
12680 */
12681
12682 should.not.Throw = function (fn, errt, errs, msg) {
12683 new Assertion(fn, msg).to.not.Throw(errt, errs);
12684 };
12685
12686 /**
12687 * ### .not.exist
12688 *
12689 * Asserts that the target is neither `null` nor `undefined`.
12690 *
12691 * var bar = null;
12692 *
12693 * should.not.exist(bar, 'bar does not exist');
12694 *
12695 * @name not.exist
12696 * @namespace Should
12697 * @api public
12698 */
12699
12700 should.not.exist = function (val, msg) {
12701 new Assertion(val, msg).to.not.exist;
12702 };
12703
12704 should['throw'] = should['Throw'];
12705 should.not['throw'] = should.not['Throw'];
12706
12707 return should;
12708 }
12709
12710 chai.should = loadShould;
12711 chai.Should = loadShould;
12712};
12713
12714/*!
12715 * chai
12716 * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
12717 * MIT Licensed
12718 */
12719
12720
12721var assert = function (chai, util) {
12722
12723 /*!
12724 * Chai dependencies.
12725 */
12726
12727 var Assertion = chai.Assertion
12728 , flag = util.flag;
12729
12730 /*!
12731 * Module export.
12732 */
12733
12734 /**
12735 * ### assert(expression, message)
12736 *
12737 * Write your own test expressions.
12738 *
12739 * assert('foo' !== 'bar', 'foo is not bar');
12740 * assert(Array.isArray([]), 'empty arrays are arrays');
12741 *
12742 * @param {Mixed} expression to test for truthiness
12743 * @param {String} message to display on error
12744 * @name assert
12745 * @namespace Assert
12746 * @api public
12747 */
12748
12749 var assert = chai.assert = function (express, errmsg) {
12750 var test = new Assertion(null, null, chai.assert, true);
12751 test.assert(
12752 express
12753 , errmsg
12754 , '[ negation message unavailable ]'
12755 );
12756 };
12757
12758 /**
12759 * ### .fail(actual, expected, [message], [operator])
12760 *
12761 * Throw a failure. Node.js `assert` module-compatible.
12762 *
12763 * @name fail
12764 * @param {Mixed} actual
12765 * @param {Mixed} expected
12766 * @param {String} message
12767 * @param {String} operator
12768 * @namespace Assert
12769 * @api public
12770 */
12771
12772 assert.fail = function (actual, expected, message, operator) {
12773 message = message || 'assert.fail()';
12774 throw new chai.AssertionError(message, {
12775 actual: actual
12776 , expected: expected
12777 , operator: operator
12778 }, assert.fail);
12779 };
12780
12781 /**
12782 * ### .isOk(object, [message])
12783 *
12784 * Asserts that `object` is truthy.
12785 *
12786 * assert.isOk('everything', 'everything is ok');
12787 * assert.isOk(false, 'this will fail');
12788 *
12789 * @name isOk
12790 * @alias ok
12791 * @param {Mixed} object to test
12792 * @param {String} message
12793 * @namespace Assert
12794 * @api public
12795 */
12796
12797 assert.isOk = function (val, msg) {
12798 new Assertion(val, msg, assert.isOk, true).is.ok;
12799 };
12800
12801 /**
12802 * ### .isNotOk(object, [message])
12803 *
12804 * Asserts that `object` is falsy.
12805 *
12806 * assert.isNotOk('everything', 'this will fail');
12807 * assert.isNotOk(false, 'this will pass');
12808 *
12809 * @name isNotOk
12810 * @alias notOk
12811 * @param {Mixed} object to test
12812 * @param {String} message
12813 * @namespace Assert
12814 * @api public
12815 */
12816
12817 assert.isNotOk = function (val, msg) {
12818 new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
12819 };
12820
12821 /**
12822 * ### .equal(actual, expected, [message])
12823 *
12824 * Asserts non-strict equality (`==`) of `actual` and `expected`.
12825 *
12826 * assert.equal(3, '3', '== coerces values to strings');
12827 *
12828 * @name equal
12829 * @param {Mixed} actual
12830 * @param {Mixed} expected
12831 * @param {String} message
12832 * @namespace Assert
12833 * @api public
12834 */
12835
12836 assert.equal = function (act, exp, msg) {
12837 var test = new Assertion(act, msg, assert.equal, true);
12838
12839 test.assert(
12840 exp == flag(test, 'object')
12841 , 'expected #{this} to equal #{exp}'
12842 , 'expected #{this} to not equal #{act}'
12843 , exp
12844 , act
12845 , true
12846 );
12847 };
12848
12849 /**
12850 * ### .notEqual(actual, expected, [message])
12851 *
12852 * Asserts non-strict inequality (`!=`) of `actual` and `expected`.
12853 *
12854 * assert.notEqual(3, 4, 'these numbers are not equal');
12855 *
12856 * @name notEqual
12857 * @param {Mixed} actual
12858 * @param {Mixed} expected
12859 * @param {String} message
12860 * @namespace Assert
12861 * @api public
12862 */
12863
12864 assert.notEqual = function (act, exp, msg) {
12865 var test = new Assertion(act, msg, assert.notEqual, true);
12866
12867 test.assert(
12868 exp != flag(test, 'object')
12869 , 'expected #{this} to not equal #{exp}'
12870 , 'expected #{this} to equal #{act}'
12871 , exp
12872 , act
12873 , true
12874 );
12875 };
12876
12877 /**
12878 * ### .strictEqual(actual, expected, [message])
12879 *
12880 * Asserts strict equality (`===`) of `actual` and `expected`.
12881 *
12882 * assert.strictEqual(true, true, 'these booleans are strictly equal');
12883 *
12884 * @name strictEqual
12885 * @param {Mixed} actual
12886 * @param {Mixed} expected
12887 * @param {String} message
12888 * @namespace Assert
12889 * @api public
12890 */
12891
12892 assert.strictEqual = function (act, exp, msg) {
12893 new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
12894 };
12895
12896 /**
12897 * ### .notStrictEqual(actual, expected, [message])
12898 *
12899 * Asserts strict inequality (`!==`) of `actual` and `expected`.
12900 *
12901 * assert.notStrictEqual(3, '3', 'no coercion for strict equality');
12902 *
12903 * @name notStrictEqual
12904 * @param {Mixed} actual
12905 * @param {Mixed} expected
12906 * @param {String} message
12907 * @namespace Assert
12908 * @api public
12909 */
12910
12911 assert.notStrictEqual = function (act, exp, msg) {
12912 new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
12913 };
12914
12915 /**
12916 * ### .deepEqual(actual, expected, [message])
12917 *
12918 * Asserts that `actual` is deeply equal to `expected`.
12919 *
12920 * assert.deepEqual({ tea: 'green' }, { tea: 'green' });
12921 *
12922 * @name deepEqual
12923 * @param {Mixed} actual
12924 * @param {Mixed} expected
12925 * @param {String} message
12926 * @alias deepStrictEqual
12927 * @namespace Assert
12928 * @api public
12929 */
12930
12931 assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) {
12932 new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
12933 };
12934
12935 /**
12936 * ### .notDeepEqual(actual, expected, [message])
12937 *
12938 * Assert that `actual` is not deeply equal to `expected`.
12939 *
12940 * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });
12941 *
12942 * @name notDeepEqual
12943 * @param {Mixed} actual
12944 * @param {Mixed} expected
12945 * @param {String} message
12946 * @namespace Assert
12947 * @api public
12948 */
12949
12950 assert.notDeepEqual = function (act, exp, msg) {
12951 new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
12952 };
12953
12954 /**
12955 * ### .isAbove(valueToCheck, valueToBeAbove, [message])
12956 *
12957 * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`.
12958 *
12959 * assert.isAbove(5, 2, '5 is strictly greater than 2');
12960 *
12961 * @name isAbove
12962 * @param {Mixed} valueToCheck
12963 * @param {Mixed} valueToBeAbove
12964 * @param {String} message
12965 * @namespace Assert
12966 * @api public
12967 */
12968
12969 assert.isAbove = function (val, abv, msg) {
12970 new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
12971 };
12972
12973 /**
12974 * ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])
12975 *
12976 * Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`.
12977 *
12978 * assert.isAtLeast(5, 2, '5 is greater or equal to 2');
12979 * assert.isAtLeast(3, 3, '3 is greater or equal to 3');
12980 *
12981 * @name isAtLeast
12982 * @param {Mixed} valueToCheck
12983 * @param {Mixed} valueToBeAtLeast
12984 * @param {String} message
12985 * @namespace Assert
12986 * @api public
12987 */
12988
12989 assert.isAtLeast = function (val, atlst, msg) {
12990 new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
12991 };
12992
12993 /**
12994 * ### .isBelow(valueToCheck, valueToBeBelow, [message])
12995 *
12996 * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow`.
12997 *
12998 * assert.isBelow(3, 6, '3 is strictly less than 6');
12999 *
13000 * @name isBelow
13001 * @param {Mixed} valueToCheck
13002 * @param {Mixed} valueToBeBelow
13003 * @param {String} message
13004 * @namespace Assert
13005 * @api public
13006 */
13007
13008 assert.isBelow = function (val, blw, msg) {
13009 new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
13010 };
13011
13012 /**
13013 * ### .isAtMost(valueToCheck, valueToBeAtMost, [message])
13014 *
13015 * Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`.
13016 *
13017 * assert.isAtMost(3, 6, '3 is less than or equal to 6');
13018 * assert.isAtMost(4, 4, '4 is less than or equal to 4');
13019 *
13020 * @name isAtMost
13021 * @param {Mixed} valueToCheck
13022 * @param {Mixed} valueToBeAtMost
13023 * @param {String} message
13024 * @namespace Assert
13025 * @api public
13026 */
13027
13028 assert.isAtMost = function (val, atmst, msg) {
13029 new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
13030 };
13031
13032 /**
13033 * ### .isTrue(value, [message])
13034 *
13035 * Asserts that `value` is true.
13036 *
13037 * var teaServed = true;
13038 * assert.isTrue(teaServed, 'the tea has been served');
13039 *
13040 * @name isTrue
13041 * @param {Mixed} value
13042 * @param {String} message
13043 * @namespace Assert
13044 * @api public
13045 */
13046
13047 assert.isTrue = function (val, msg) {
13048 new Assertion(val, msg, assert.isTrue, true).is['true'];
13049 };
13050
13051 /**
13052 * ### .isNotTrue(value, [message])
13053 *
13054 * Asserts that `value` is not true.
13055 *
13056 * var tea = 'tasty chai';
13057 * assert.isNotTrue(tea, 'great, time for tea!');
13058 *
13059 * @name isNotTrue
13060 * @param {Mixed} value
13061 * @param {String} message
13062 * @namespace Assert
13063 * @api public
13064 */
13065
13066 assert.isNotTrue = function (val, msg) {
13067 new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
13068 };
13069
13070 /**
13071 * ### .isFalse(value, [message])
13072 *
13073 * Asserts that `value` is false.
13074 *
13075 * var teaServed = false;
13076 * assert.isFalse(teaServed, 'no tea yet? hmm...');
13077 *
13078 * @name isFalse
13079 * @param {Mixed} value
13080 * @param {String} message
13081 * @namespace Assert
13082 * @api public
13083 */
13084
13085 assert.isFalse = function (val, msg) {
13086 new Assertion(val, msg, assert.isFalse, true).is['false'];
13087 };
13088
13089 /**
13090 * ### .isNotFalse(value, [message])
13091 *
13092 * Asserts that `value` is not false.
13093 *
13094 * var tea = 'tasty chai';
13095 * assert.isNotFalse(tea, 'great, time for tea!');
13096 *
13097 * @name isNotFalse
13098 * @param {Mixed} value
13099 * @param {String} message
13100 * @namespace Assert
13101 * @api public
13102 */
13103
13104 assert.isNotFalse = function (val, msg) {
13105 new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
13106 };
13107
13108 /**
13109 * ### .isNull(value, [message])
13110 *
13111 * Asserts that `value` is null.
13112 *
13113 * assert.isNull(err, 'there was no error');
13114 *
13115 * @name isNull
13116 * @param {Mixed} value
13117 * @param {String} message
13118 * @namespace Assert
13119 * @api public
13120 */
13121
13122 assert.isNull = function (val, msg) {
13123 new Assertion(val, msg, assert.isNull, true).to.equal(null);
13124 };
13125
13126 /**
13127 * ### .isNotNull(value, [message])
13128 *
13129 * Asserts that `value` is not null.
13130 *
13131 * var tea = 'tasty chai';
13132 * assert.isNotNull(tea, 'great, time for tea!');
13133 *
13134 * @name isNotNull
13135 * @param {Mixed} value
13136 * @param {String} message
13137 * @namespace Assert
13138 * @api public
13139 */
13140
13141 assert.isNotNull = function (val, msg) {
13142 new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
13143 };
13144
13145 /**
13146 * ### .isNaN
13147 *
13148 * Asserts that value is NaN.
13149 *
13150 * assert.isNaN(NaN, 'NaN is NaN');
13151 *
13152 * @name isNaN
13153 * @param {Mixed} value
13154 * @param {String} message
13155 * @namespace Assert
13156 * @api public
13157 */
13158
13159 assert.isNaN = function (val, msg) {
13160 new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
13161 };
13162
13163 /**
13164 * ### .isNotNaN
13165 *
13166 * Asserts that value is not NaN.
13167 *
13168 * assert.isNotNaN(4, '4 is not NaN');
13169 *
13170 * @name isNotNaN
13171 * @param {Mixed} value
13172 * @param {String} message
13173 * @namespace Assert
13174 * @api public
13175 */
13176 assert.isNotNaN = function (val, msg) {
13177 new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN;
13178 };
13179
13180 /**
13181 * ### .exists
13182 *
13183 * Asserts that the target is neither `null` nor `undefined`.
13184 *
13185 * var foo = 'hi';
13186 *
13187 * assert.exists(foo, 'foo is neither `null` nor `undefined`');
13188 *
13189 * @name exists
13190 * @param {Mixed} value
13191 * @param {String} message
13192 * @namespace Assert
13193 * @api public
13194 */
13195
13196 assert.exists = function (val, msg) {
13197 new Assertion(val, msg, assert.exists, true).to.exist;
13198 };
13199
13200 /**
13201 * ### .notExists
13202 *
13203 * Asserts that the target is either `null` or `undefined`.
13204 *
13205 * var bar = null
13206 * , baz;
13207 *
13208 * assert.notExists(bar);
13209 * assert.notExists(baz, 'baz is either null or undefined');
13210 *
13211 * @name notExists
13212 * @param {Mixed} value
13213 * @param {String} message
13214 * @namespace Assert
13215 * @api public
13216 */
13217
13218 assert.notExists = function (val, msg) {
13219 new Assertion(val, msg, assert.notExists, true).to.not.exist;
13220 };
13221
13222 /**
13223 * ### .isUndefined(value, [message])
13224 *
13225 * Asserts that `value` is `undefined`.
13226 *
13227 * var tea;
13228 * assert.isUndefined(tea, 'no tea defined');
13229 *
13230 * @name isUndefined
13231 * @param {Mixed} value
13232 * @param {String} message
13233 * @namespace Assert
13234 * @api public
13235 */
13236
13237 assert.isUndefined = function (val, msg) {
13238 new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined);
13239 };
13240
13241 /**
13242 * ### .isDefined(value, [message])
13243 *
13244 * Asserts that `value` is not `undefined`.
13245 *
13246 * var tea = 'cup of chai';
13247 * assert.isDefined(tea, 'tea has been defined');
13248 *
13249 * @name isDefined
13250 * @param {Mixed} value
13251 * @param {String} message
13252 * @namespace Assert
13253 * @api public
13254 */
13255
13256 assert.isDefined = function (val, msg) {
13257 new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined);
13258 };
13259
13260 /**
13261 * ### .isFunction(value, [message])
13262 *
13263 * Asserts that `value` is a function.
13264 *
13265 * function serveTea() { return 'cup of tea'; };
13266 * assert.isFunction(serveTea, 'great, we can have tea now');
13267 *
13268 * @name isFunction
13269 * @param {Mixed} value
13270 * @param {String} message
13271 * @namespace Assert
13272 * @api public
13273 */
13274
13275 assert.isFunction = function (val, msg) {
13276 new Assertion(val, msg, assert.isFunction, true).to.be.a('function');
13277 };
13278
13279 /**
13280 * ### .isNotFunction(value, [message])
13281 *
13282 * Asserts that `value` is _not_ a function.
13283 *
13284 * var serveTea = [ 'heat', 'pour', 'sip' ];
13285 * assert.isNotFunction(serveTea, 'great, we have listed the steps');
13286 *
13287 * @name isNotFunction
13288 * @param {Mixed} value
13289 * @param {String} message
13290 * @namespace Assert
13291 * @api public
13292 */
13293
13294 assert.isNotFunction = function (val, msg) {
13295 new Assertion(val, msg, assert.isNotFunction, true).to.not.be.a('function');
13296 };
13297
13298 /**
13299 * ### .isObject(value, [message])
13300 *
13301 * Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`).
13302 * _The assertion does not match subclassed objects._
13303 *
13304 * var selection = { name: 'Chai', serve: 'with spices' };
13305 * assert.isObject(selection, 'tea selection is an object');
13306 *
13307 * @name isObject
13308 * @param {Mixed} value
13309 * @param {String} message
13310 * @namespace Assert
13311 * @api public
13312 */
13313
13314 assert.isObject = function (val, msg) {
13315 new Assertion(val, msg, assert.isObject, true).to.be.a('object');
13316 };
13317
13318 /**
13319 * ### .isNotObject(value, [message])
13320 *
13321 * Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`).
13322 *
13323 * var selection = 'chai'
13324 * assert.isNotObject(selection, 'tea selection is not an object');
13325 * assert.isNotObject(null, 'null is not an object');
13326 *
13327 * @name isNotObject
13328 * @param {Mixed} value
13329 * @param {String} message
13330 * @namespace Assert
13331 * @api public
13332 */
13333
13334 assert.isNotObject = function (val, msg) {
13335 new Assertion(val, msg, assert.isNotObject, true).to.not.be.a('object');
13336 };
13337
13338 /**
13339 * ### .isArray(value, [message])
13340 *
13341 * Asserts that `value` is an array.
13342 *
13343 * var menu = [ 'green', 'chai', 'oolong' ];
13344 * assert.isArray(menu, 'what kind of tea do we want?');
13345 *
13346 * @name isArray
13347 * @param {Mixed} value
13348 * @param {String} message
13349 * @namespace Assert
13350 * @api public
13351 */
13352
13353 assert.isArray = function (val, msg) {
13354 new Assertion(val, msg, assert.isArray, true).to.be.an('array');
13355 };
13356
13357 /**
13358 * ### .isNotArray(value, [message])
13359 *
13360 * Asserts that `value` is _not_ an array.
13361 *
13362 * var menu = 'green|chai|oolong';
13363 * assert.isNotArray(menu, 'what kind of tea do we want?');
13364 *
13365 * @name isNotArray
13366 * @param {Mixed} value
13367 * @param {String} message
13368 * @namespace Assert
13369 * @api public
13370 */
13371
13372 assert.isNotArray = function (val, msg) {
13373 new Assertion(val, msg, assert.isNotArray, true).to.not.be.an('array');
13374 };
13375
13376 /**
13377 * ### .isString(value, [message])
13378 *
13379 * Asserts that `value` is a string.
13380 *
13381 * var teaOrder = 'chai';
13382 * assert.isString(teaOrder, 'order placed');
13383 *
13384 * @name isString
13385 * @param {Mixed} value
13386 * @param {String} message
13387 * @namespace Assert
13388 * @api public
13389 */
13390
13391 assert.isString = function (val, msg) {
13392 new Assertion(val, msg, assert.isString, true).to.be.a('string');
13393 };
13394
13395 /**
13396 * ### .isNotString(value, [message])
13397 *
13398 * Asserts that `value` is _not_ a string.
13399 *
13400 * var teaOrder = 4;
13401 * assert.isNotString(teaOrder, 'order placed');
13402 *
13403 * @name isNotString
13404 * @param {Mixed} value
13405 * @param {String} message
13406 * @namespace Assert
13407 * @api public
13408 */
13409
13410 assert.isNotString = function (val, msg) {
13411 new Assertion(val, msg, assert.isNotString, true).to.not.be.a('string');
13412 };
13413
13414 /**
13415 * ### .isNumber(value, [message])
13416 *
13417 * Asserts that `value` is a number.
13418 *
13419 * var cups = 2;
13420 * assert.isNumber(cups, 'how many cups');
13421 *
13422 * @name isNumber
13423 * @param {Number} value
13424 * @param {String} message
13425 * @namespace Assert
13426 * @api public
13427 */
13428
13429 assert.isNumber = function (val, msg) {
13430 new Assertion(val, msg, assert.isNumber, true).to.be.a('number');
13431 };
13432
13433 /**
13434 * ### .isNotNumber(value, [message])
13435 *
13436 * Asserts that `value` is _not_ a number.
13437 *
13438 * var cups = '2 cups please';
13439 * assert.isNotNumber(cups, 'how many cups');
13440 *
13441 * @name isNotNumber
13442 * @param {Mixed} value
13443 * @param {String} message
13444 * @namespace Assert
13445 * @api public
13446 */
13447
13448 assert.isNotNumber = function (val, msg) {
13449 new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a('number');
13450 };
13451
13452 /**
13453 * ### .isFinite(value, [message])
13454 *
13455 * Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
13456 *
13457 * var cups = 2;
13458 * assert.isFinite(cups, 'how many cups');
13459 *
13460 * assert.isFinite(NaN); // throws
13461 *
13462 * @name isFinite
13463 * @param {Number} value
13464 * @param {String} message
13465 * @namespace Assert
13466 * @api public
13467 */
13468
13469 assert.isFinite = function (val, msg) {
13470 new Assertion(val, msg, assert.isFinite, true).to.be.finite;
13471 };
13472
13473 /**
13474 * ### .isBoolean(value, [message])
13475 *
13476 * Asserts that `value` is a boolean.
13477 *
13478 * var teaReady = true
13479 * , teaServed = false;
13480 *
13481 * assert.isBoolean(teaReady, 'is the tea ready');
13482 * assert.isBoolean(teaServed, 'has tea been served');
13483 *
13484 * @name isBoolean
13485 * @param {Mixed} value
13486 * @param {String} message
13487 * @namespace Assert
13488 * @api public
13489 */
13490
13491 assert.isBoolean = function (val, msg) {
13492 new Assertion(val, msg, assert.isBoolean, true).to.be.a('boolean');
13493 };
13494
13495 /**
13496 * ### .isNotBoolean(value, [message])
13497 *
13498 * Asserts that `value` is _not_ a boolean.
13499 *
13500 * var teaReady = 'yep'
13501 * , teaServed = 'nope';
13502 *
13503 * assert.isNotBoolean(teaReady, 'is the tea ready');
13504 * assert.isNotBoolean(teaServed, 'has tea been served');
13505 *
13506 * @name isNotBoolean
13507 * @param {Mixed} value
13508 * @param {String} message
13509 * @namespace Assert
13510 * @api public
13511 */
13512
13513 assert.isNotBoolean = function (val, msg) {
13514 new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a('boolean');
13515 };
13516
13517 /**
13518 * ### .typeOf(value, name, [message])
13519 *
13520 * Asserts that `value`'s type is `name`, as determined by
13521 * `Object.prototype.toString`.
13522 *
13523 * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object');
13524 * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array');
13525 * assert.typeOf('tea', 'string', 'we have a string');
13526 * assert.typeOf(/tea/, 'regexp', 'we have a regular expression');
13527 * assert.typeOf(null, 'null', 'we have a null');
13528 * assert.typeOf(undefined, 'undefined', 'we have an undefined');
13529 *
13530 * @name typeOf
13531 * @param {Mixed} value
13532 * @param {String} name
13533 * @param {String} message
13534 * @namespace Assert
13535 * @api public
13536 */
13537
13538 assert.typeOf = function (val, type, msg) {
13539 new Assertion(val, msg, assert.typeOf, true).to.be.a(type);
13540 };
13541
13542 /**
13543 * ### .notTypeOf(value, name, [message])
13544 *
13545 * Asserts that `value`'s type is _not_ `name`, as determined by
13546 * `Object.prototype.toString`.
13547 *
13548 * assert.notTypeOf('tea', 'number', 'strings are not numbers');
13549 *
13550 * @name notTypeOf
13551 * @param {Mixed} value
13552 * @param {String} typeof name
13553 * @param {String} message
13554 * @namespace Assert
13555 * @api public
13556 */
13557
13558 assert.notTypeOf = function (val, type, msg) {
13559 new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type);
13560 };
13561
13562 /**
13563 * ### .instanceOf(object, constructor, [message])
13564 *
13565 * Asserts that `value` is an instance of `constructor`.
13566 *
13567 * var Tea = function (name) { this.name = name; }
13568 * , chai = new Tea('chai');
13569 *
13570 * assert.instanceOf(chai, Tea, 'chai is an instance of tea');
13571 *
13572 * @name instanceOf
13573 * @param {Object} object
13574 * @param {Constructor} constructor
13575 * @param {String} message
13576 * @namespace Assert
13577 * @api public
13578 */
13579
13580 assert.instanceOf = function (val, type, msg) {
13581 new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type);
13582 };
13583
13584 /**
13585 * ### .notInstanceOf(object, constructor, [message])
13586 *
13587 * Asserts `value` is not an instance of `constructor`.
13588 *
13589 * var Tea = function (name) { this.name = name; }
13590 * , chai = new String('chai');
13591 *
13592 * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');
13593 *
13594 * @name notInstanceOf
13595 * @param {Object} object
13596 * @param {Constructor} constructor
13597 * @param {String} message
13598 * @namespace Assert
13599 * @api public
13600 */
13601
13602 assert.notInstanceOf = function (val, type, msg) {
13603 new Assertion(val, msg, assert.notInstanceOf, true)
13604 .to.not.be.instanceOf(type);
13605 };
13606
13607 /**
13608 * ### .include(haystack, needle, [message])
13609 *
13610 * Asserts that `haystack` includes `needle`. Can be used to assert the
13611 * inclusion of a value in an array, a substring in a string, or a subset of
13612 * properties in an object.
13613 *
13614 * assert.include([1,2,3], 2, 'array contains value');
13615 * assert.include('foobar', 'foo', 'string contains substring');
13616 * assert.include({ foo: 'bar', hello: 'universe' }, { foo: 'bar' }, 'object contains property');
13617 *
13618 * Strict equality (===) is used. When asserting the inclusion of a value in
13619 * an array, the array is searched for an element that's strictly equal to the
13620 * given value. When asserting a subset of properties in an object, the object
13621 * is searched for the given property keys, checking that each one is present
13622 * and stricty equal to the given property value. For instance:
13623 *
13624 * var obj1 = {a: 1}
13625 * , obj2 = {b: 2};
13626 * assert.include([obj1, obj2], obj1);
13627 * assert.include({foo: obj1, bar: obj2}, {foo: obj1});
13628 * assert.include({foo: obj1, bar: obj2}, {foo: obj1, bar: obj2});
13629 *
13630 * @name include
13631 * @param {Array|String} haystack
13632 * @param {Mixed} needle
13633 * @param {String} message
13634 * @namespace Assert
13635 * @api public
13636 */
13637
13638 assert.include = function (exp, inc, msg) {
13639 new Assertion(exp, msg, assert.include, true).include(inc);
13640 };
13641
13642 /**
13643 * ### .notInclude(haystack, needle, [message])
13644 *
13645 * Asserts that `haystack` does not include `needle`. Can be used to assert
13646 * the absence of a value in an array, a substring in a string, or a subset of
13647 * properties in an object.
13648 *
13649 * assert.notInclude([1,2,3], 4, 'array doesn't contain value');
13650 * assert.notInclude('foobar', 'baz', 'string doesn't contain substring');
13651 * assert.notInclude({ foo: 'bar', hello: 'universe' }, { foo: 'baz' }, 'object doesn't contain property');
13652 *
13653 * Strict equality (===) is used. When asserting the absence of a value in an
13654 * array, the array is searched to confirm the absence of an element that's
13655 * strictly equal to the given value. When asserting a subset of properties in
13656 * an object, the object is searched to confirm that at least one of the given
13657 * property keys is either not present or not strictly equal to the given
13658 * property value. For instance:
13659 *
13660 * var obj1 = {a: 1}
13661 * , obj2 = {b: 2};
13662 * assert.notInclude([obj1, obj2], {a: 1});
13663 * assert.notInclude({foo: obj1, bar: obj2}, {foo: {a: 1}});
13664 * assert.notInclude({foo: obj1, bar: obj2}, {foo: obj1, bar: {b: 2}});
13665 *
13666 * @name notInclude
13667 * @param {Array|String} haystack
13668 * @param {Mixed} needle
13669 * @param {String} message
13670 * @namespace Assert
13671 * @api public
13672 */
13673
13674 assert.notInclude = function (exp, inc, msg) {
13675 new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
13676 };
13677
13678 /**
13679 * ### .deepInclude(haystack, needle, [message])
13680 *
13681 * Asserts that `haystack` includes `needle`. Can be used to assert the
13682 * inclusion of a value in an array or a subset of properties in an object.
13683 * Deep equality is used.
13684 *
13685 * var obj1 = {a: 1}
13686 * , obj2 = {b: 2};
13687 * assert.deepInclude([obj1, obj2], {a: 1});
13688 * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}});
13689 * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 2}});
13690 *
13691 * @name deepInclude
13692 * @param {Array|String} haystack
13693 * @param {Mixed} needle
13694 * @param {String} message
13695 * @namespace Assert
13696 * @api public
13697 */
13698
13699 assert.deepInclude = function (exp, inc, msg) {
13700 new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
13701 };
13702
13703 /**
13704 * ### .notDeepInclude(haystack, needle, [message])
13705 *
13706 * Asserts that `haystack` does not include `needle`. Can be used to assert
13707 * the absence of a value in an array or a subset of properties in an object.
13708 * Deep equality is used.
13709 *
13710 * var obj1 = {a: 1}
13711 * , obj2 = {b: 2};
13712 * assert.notDeepInclude([obj1, obj2], {a: 9});
13713 * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 9}});
13714 * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 9}});
13715 *
13716 * @name notDeepInclude
13717 * @param {Array|String} haystack
13718 * @param {Mixed} needle
13719 * @param {String} message
13720 * @namespace Assert
13721 * @api public
13722 */
13723
13724 assert.notDeepInclude = function (exp, inc, msg) {
13725 new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
13726 };
13727
13728 /**
13729 * ### .nestedInclude(haystack, needle, [message])
13730 *
13731 * Asserts that 'haystack' includes 'needle'.
13732 * Can be used to assert the inclusion of a subset of properties in an
13733 * object.
13734 * Enables the use of dot- and bracket-notation for referencing nested
13735 * properties.
13736 * '[]' and '.' in property names can be escaped using double backslashes.
13737 *
13738 * assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'});
13739 * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'});
13740 *
13741 * @name nestedInclude
13742 * @param {Object} haystack
13743 * @param {Object} needle
13744 * @param {String} message
13745 * @namespace Assert
13746 * @api public
13747 */
13748
13749 assert.nestedInclude = function (exp, inc, msg) {
13750 new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
13751 };
13752
13753 /**
13754 * ### .notNestedInclude(haystack, needle, [message])
13755 *
13756 * Asserts that 'haystack' does not include 'needle'.
13757 * Can be used to assert the absence of a subset of properties in an
13758 * object.
13759 * Enables the use of dot- and bracket-notation for referencing nested
13760 * properties.
13761 * '[]' and '.' in property names can be escaped using double backslashes.
13762 *
13763 * assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'});
13764 * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'});
13765 *
13766 * @name notNestedInclude
13767 * @param {Object} haystack
13768 * @param {Object} needle
13769 * @param {String} message
13770 * @namespace Assert
13771 * @api public
13772 */
13773
13774 assert.notNestedInclude = function (exp, inc, msg) {
13775 new Assertion(exp, msg, assert.notNestedInclude, true)
13776 .not.nested.include(inc);
13777 };
13778
13779 /**
13780 * ### .deepNestedInclude(haystack, needle, [message])
13781 *
13782 * Asserts that 'haystack' includes 'needle'.
13783 * Can be used to assert the inclusion of a subset of properties in an
13784 * object while checking for deep equality.
13785 * Enables the use of dot- and bracket-notation for referencing nested
13786 * properties.
13787 * '[]' and '.' in property names can be escaped using double backslashes.
13788 *
13789 * assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}});
13790 * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}});
13791 *
13792 * @name deepNestedInclude
13793 * @param {Object} haystack
13794 * @param {Object} needle
13795 * @param {String} message
13796 * @namespace Assert
13797 * @api public
13798 */
13799
13800 assert.deepNestedInclude = function(exp, inc, msg) {
13801 new Assertion(exp, msg, assert.deepNestedInclude, true)
13802 .deep.nested.include(inc);
13803 };
13804
13805 /**
13806 * ### .notDeepNestedInclude(haystack, needle, [message])
13807 *
13808 * Asserts that 'haystack' does not include 'needle'.
13809 * Can be used to assert the absence of a subset of properties in an
13810 * object while checking for deep equality.
13811 * Enables the use of dot- and bracket-notation for referencing nested
13812 * properties.
13813 * '[]' and '.' in property names can be escaped using double backslashes.
13814 *
13815 * assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}})
13816 * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}});
13817 *
13818 * @name notDeepNestedInclude
13819 * @param {Object} haystack
13820 * @param {Object} needle
13821 * @param {String} message
13822 * @namespace Assert
13823 * @api public
13824 */
13825
13826 assert.notDeepNestedInclude = function(exp, inc, msg) {
13827 new Assertion(exp, msg, assert.notDeepNestedInclude, true)
13828 .not.deep.nested.include(inc);
13829 };
13830
13831 /**
13832 * ### .ownInclude(haystack, needle, [message])
13833 *
13834 * Asserts that 'haystack' includes 'needle'.
13835 * Can be used to assert the inclusion of a subset of properties in an
13836 * object while ignoring inherited properties.
13837 *
13838 * assert.ownInclude({ a: 1 }, { a: 1 });
13839 *
13840 * @name ownInclude
13841 * @param {Object} haystack
13842 * @param {Object} needle
13843 * @param {String} message
13844 * @namespace Assert
13845 * @api public
13846 */
13847
13848 assert.ownInclude = function(exp, inc, msg) {
13849 new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
13850 };
13851
13852 /**
13853 * ### .notOwnInclude(haystack, needle, [message])
13854 *
13855 * Asserts that 'haystack' includes 'needle'.
13856 * Can be used to assert the absence of a subset of properties in an
13857 * object while ignoring inherited properties.
13858 *
13859 * Object.prototype.b = 2;
13860 *
13861 * assert.notOwnInclude({ a: 1 }, { b: 2 });
13862 *
13863 * @name notOwnInclude
13864 * @param {Object} haystack
13865 * @param {Object} needle
13866 * @param {String} message
13867 * @namespace Assert
13868 * @api public
13869 */
13870
13871 assert.notOwnInclude = function(exp, inc, msg) {
13872 new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
13873 };
13874
13875 /**
13876 * ### .deepOwnInclude(haystack, needle, [message])
13877 *
13878 * Asserts that 'haystack' includes 'needle'.
13879 * Can be used to assert the inclusion of a subset of properties in an
13880 * object while ignoring inherited properties and checking for deep equality.
13881 *
13882 * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
13883 *
13884 * @name deepOwnInclude
13885 * @param {Object} haystack
13886 * @param {Object} needle
13887 * @param {String} message
13888 * @namespace Assert
13889 * @api public
13890 */
13891
13892 assert.deepOwnInclude = function(exp, inc, msg) {
13893 new Assertion(exp, msg, assert.deepOwnInclude, true)
13894 .deep.own.include(inc);
13895 };
13896
13897 /**
13898 * ### .notDeepOwnInclude(haystack, needle, [message])
13899 *
13900 * Asserts that 'haystack' includes 'needle'.
13901 * Can be used to assert the absence of a subset of properties in an
13902 * object while ignoring inherited properties and checking for deep equality.
13903 *
13904 * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
13905 *
13906 * @name notDeepOwnInclude
13907 * @param {Object} haystack
13908 * @param {Object} needle
13909 * @param {String} message
13910 * @namespace Assert
13911 * @api public
13912 */
13913
13914 assert.notDeepOwnInclude = function(exp, inc, msg) {
13915 new Assertion(exp, msg, assert.notDeepOwnInclude, true)
13916 .not.deep.own.include(inc);
13917 };
13918
13919 /**
13920 * ### .match(value, regexp, [message])
13921 *
13922 * Asserts that `value` matches the regular expression `regexp`.
13923 *
13924 * assert.match('foobar', /^foo/, 'regexp matches');
13925 *
13926 * @name match
13927 * @param {Mixed} value
13928 * @param {RegExp} regexp
13929 * @param {String} message
13930 * @namespace Assert
13931 * @api public
13932 */
13933
13934 assert.match = function (exp, re, msg) {
13935 new Assertion(exp, msg, assert.match, true).to.match(re);
13936 };
13937
13938 /**
13939 * ### .notMatch(value, regexp, [message])
13940 *
13941 * Asserts that `value` does not match the regular expression `regexp`.
13942 *
13943 * assert.notMatch('foobar', /^foo/, 'regexp does not match');
13944 *
13945 * @name notMatch
13946 * @param {Mixed} value
13947 * @param {RegExp} regexp
13948 * @param {String} message
13949 * @namespace Assert
13950 * @api public
13951 */
13952
13953 assert.notMatch = function (exp, re, msg) {
13954 new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
13955 };
13956
13957 /**
13958 * ### .property(object, property, [message])
13959 *
13960 * Asserts that `object` has a direct or inherited property named by
13961 * `property`.
13962 *
13963 * assert.property({ tea: { green: 'matcha' }}, 'tea');
13964 * assert.property({ tea: { green: 'matcha' }}, 'toString');
13965 *
13966 * @name property
13967 * @param {Object} object
13968 * @param {String} property
13969 * @param {String} message
13970 * @namespace Assert
13971 * @api public
13972 */
13973
13974 assert.property = function (obj, prop, msg) {
13975 new Assertion(obj, msg, assert.property, true).to.have.property(prop);
13976 };
13977
13978 /**
13979 * ### .notProperty(object, property, [message])
13980 *
13981 * Asserts that `object` does _not_ have a direct or inherited property named
13982 * by `property`.
13983 *
13984 * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');
13985 *
13986 * @name notProperty
13987 * @param {Object} object
13988 * @param {String} property
13989 * @param {String} message
13990 * @namespace Assert
13991 * @api public
13992 */
13993
13994 assert.notProperty = function (obj, prop, msg) {
13995 new Assertion(obj, msg, assert.notProperty, true)
13996 .to.not.have.property(prop);
13997 };
13998
13999 /**
14000 * ### .propertyVal(object, property, value, [message])
14001 *
14002 * Asserts that `object` has a direct or inherited property named by
14003 * `property` with a value given by `value`. Uses a strict equality check
14004 * (===).
14005 *
14006 * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');
14007 *
14008 * @name propertyVal
14009 * @param {Object} object
14010 * @param {String} property
14011 * @param {Mixed} value
14012 * @param {String} message
14013 * @namespace Assert
14014 * @api public
14015 */
14016
14017 assert.propertyVal = function (obj, prop, val, msg) {
14018 new Assertion(obj, msg, assert.propertyVal, true)
14019 .to.have.property(prop, val);
14020 };
14021
14022 /**
14023 * ### .notPropertyVal(object, property, value, [message])
14024 *
14025 * Asserts that `object` does _not_ have a direct or inherited property named
14026 * by `property` with value given by `value`. Uses a strict equality check
14027 * (===).
14028 *
14029 * assert.notPropertyVal({ tea: 'is good' }, 'tea', 'is bad');
14030 * assert.notPropertyVal({ tea: 'is good' }, 'coffee', 'is good');
14031 *
14032 * @name notPropertyVal
14033 * @param {Object} object
14034 * @param {String} property
14035 * @param {Mixed} value
14036 * @param {String} message
14037 * @namespace Assert
14038 * @api public
14039 */
14040
14041 assert.notPropertyVal = function (obj, prop, val, msg) {
14042 new Assertion(obj, msg, assert.notPropertyVal, true)
14043 .to.not.have.property(prop, val);
14044 };
14045
14046 /**
14047 * ### .deepPropertyVal(object, property, value, [message])
14048 *
14049 * Asserts that `object` has a direct or inherited property named by
14050 * `property` with a value given by `value`. Uses a deep equality check.
14051 *
14052 * assert.deepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' });
14053 *
14054 * @name deepPropertyVal
14055 * @param {Object} object
14056 * @param {String} property
14057 * @param {Mixed} value
14058 * @param {String} message
14059 * @namespace Assert
14060 * @api public
14061 */
14062
14063 assert.deepPropertyVal = function (obj, prop, val, msg) {
14064 new Assertion(obj, msg, assert.deepPropertyVal, true)
14065 .to.have.deep.property(prop, val);
14066 };
14067
14068 /**
14069 * ### .notDeepPropertyVal(object, property, value, [message])
14070 *
14071 * Asserts that `object` does _not_ have a direct or inherited property named
14072 * by `property` with value given by `value`. Uses a deep equality check.
14073 *
14074 * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' });
14075 * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' });
14076 * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' });
14077 *
14078 * @name notDeepPropertyVal
14079 * @param {Object} object
14080 * @param {String} property
14081 * @param {Mixed} value
14082 * @param {String} message
14083 * @namespace Assert
14084 * @api public
14085 */
14086
14087 assert.notDeepPropertyVal = function (obj, prop, val, msg) {
14088 new Assertion(obj, msg, assert.notDeepPropertyVal, true)
14089 .to.not.have.deep.property(prop, val);
14090 };
14091
14092 /**
14093 * ### .ownProperty(object, property, [message])
14094 *
14095 * Asserts that `object` has a direct property named by `property`. Inherited
14096 * properties aren't checked.
14097 *
14098 * assert.ownProperty({ tea: { green: 'matcha' }}, 'tea');
14099 *
14100 * @name ownProperty
14101 * @param {Object} object
14102 * @param {String} property
14103 * @param {String} message
14104 * @api public
14105 */
14106
14107 assert.ownProperty = function (obj, prop, msg) {
14108 new Assertion(obj, msg, assert.ownProperty, true)
14109 .to.have.own.property(prop);
14110 };
14111
14112 /**
14113 * ### .notOwnProperty(object, property, [message])
14114 *
14115 * Asserts that `object` does _not_ have a direct property named by
14116 * `property`. Inherited properties aren't checked.
14117 *
14118 * assert.notOwnProperty({ tea: { green: 'matcha' }}, 'coffee');
14119 * assert.notOwnProperty({}, 'toString');
14120 *
14121 * @name notOwnProperty
14122 * @param {Object} object
14123 * @param {String} property
14124 * @param {String} message
14125 * @api public
14126 */
14127
14128 assert.notOwnProperty = function (obj, prop, msg) {
14129 new Assertion(obj, msg, assert.notOwnProperty, true)
14130 .to.not.have.own.property(prop);
14131 };
14132
14133 /**
14134 * ### .ownPropertyVal(object, property, value, [message])
14135 *
14136 * Asserts that `object` has a direct property named by `property` and a value
14137 * equal to the provided `value`. Uses a strict equality check (===).
14138 * Inherited properties aren't checked.
14139 *
14140 * assert.ownPropertyVal({ coffee: 'is good'}, 'coffee', 'is good');
14141 *
14142 * @name ownPropertyVal
14143 * @param {Object} object
14144 * @param {String} property
14145 * @param {Mixed} value
14146 * @param {String} message
14147 * @api public
14148 */
14149
14150 assert.ownPropertyVal = function (obj, prop, value, msg) {
14151 new Assertion(obj, msg, assert.ownPropertyVal, true)
14152 .to.have.own.property(prop, value);
14153 };
14154
14155 /**
14156 * ### .notOwnPropertyVal(object, property, value, [message])
14157 *
14158 * Asserts that `object` does _not_ have a direct property named by `property`
14159 * with a value equal to the provided `value`. Uses a strict equality check
14160 * (===). Inherited properties aren't checked.
14161 *
14162 * assert.notOwnPropertyVal({ tea: 'is better'}, 'tea', 'is worse');
14163 * assert.notOwnPropertyVal({}, 'toString', Object.prototype.toString);
14164 *
14165 * @name notOwnPropertyVal
14166 * @param {Object} object
14167 * @param {String} property
14168 * @param {Mixed} value
14169 * @param {String} message
14170 * @api public
14171 */
14172
14173 assert.notOwnPropertyVal = function (obj, prop, value, msg) {
14174 new Assertion(obj, msg, assert.notOwnPropertyVal, true)
14175 .to.not.have.own.property(prop, value);
14176 };
14177
14178 /**
14179 * ### .deepOwnPropertyVal(object, property, value, [message])
14180 *
14181 * Asserts that `object` has a direct property named by `property` and a value
14182 * equal to the provided `value`. Uses a deep equality check. Inherited
14183 * properties aren't checked.
14184 *
14185 * assert.deepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' });
14186 *
14187 * @name deepOwnPropertyVal
14188 * @param {Object} object
14189 * @param {String} property
14190 * @param {Mixed} value
14191 * @param {String} message
14192 * @api public
14193 */
14194
14195 assert.deepOwnPropertyVal = function (obj, prop, value, msg) {
14196 new Assertion(obj, msg, assert.deepOwnPropertyVal, true)
14197 .to.have.deep.own.property(prop, value);
14198 };
14199
14200 /**
14201 * ### .notDeepOwnPropertyVal(object, property, value, [message])
14202 *
14203 * Asserts that `object` does _not_ have a direct property named by `property`
14204 * with a value equal to the provided `value`. Uses a deep equality check.
14205 * Inherited properties aren't checked.
14206 *
14207 * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' });
14208 * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' });
14209 * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' });
14210 * assert.notDeepOwnPropertyVal({}, 'toString', Object.prototype.toString);
14211 *
14212 * @name notDeepOwnPropertyVal
14213 * @param {Object} object
14214 * @param {String} property
14215 * @param {Mixed} value
14216 * @param {String} message
14217 * @api public
14218 */
14219
14220 assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) {
14221 new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true)
14222 .to.not.have.deep.own.property(prop, value);
14223 };
14224
14225 /**
14226 * ### .nestedProperty(object, property, [message])
14227 *
14228 * Asserts that `object` has a direct or inherited property named by
14229 * `property`, which can be a string using dot- and bracket-notation for
14230 * nested reference.
14231 *
14232 * assert.nestedProperty({ tea: { green: 'matcha' }}, 'tea.green');
14233 *
14234 * @name nestedProperty
14235 * @param {Object} object
14236 * @param {String} property
14237 * @param {String} message
14238 * @namespace Assert
14239 * @api public
14240 */
14241
14242 assert.nestedProperty = function (obj, prop, msg) {
14243 new Assertion(obj, msg, assert.nestedProperty, true)
14244 .to.have.nested.property(prop);
14245 };
14246
14247 /**
14248 * ### .notNestedProperty(object, property, [message])
14249 *
14250 * Asserts that `object` does _not_ have a property named by `property`, which
14251 * can be a string using dot- and bracket-notation for nested reference. The
14252 * property cannot exist on the object nor anywhere in its prototype chain.
14253 *
14254 * assert.notNestedProperty({ tea: { green: 'matcha' }}, 'tea.oolong');
14255 *
14256 * @name notNestedProperty
14257 * @param {Object} object
14258 * @param {String} property
14259 * @param {String} message
14260 * @namespace Assert
14261 * @api public
14262 */
14263
14264 assert.notNestedProperty = function (obj, prop, msg) {
14265 new Assertion(obj, msg, assert.notNestedProperty, true)
14266 .to.not.have.nested.property(prop);
14267 };
14268
14269 /**
14270 * ### .nestedPropertyVal(object, property, value, [message])
14271 *
14272 * Asserts that `object` has a property named by `property` with value given
14273 * by `value`. `property` can use dot- and bracket-notation for nested
14274 * reference. Uses a strict equality check (===).
14275 *
14276 * assert.nestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');
14277 *
14278 * @name nestedPropertyVal
14279 * @param {Object} object
14280 * @param {String} property
14281 * @param {Mixed} value
14282 * @param {String} message
14283 * @namespace Assert
14284 * @api public
14285 */
14286
14287 assert.nestedPropertyVal = function (obj, prop, val, msg) {
14288 new Assertion(obj, msg, assert.nestedPropertyVal, true)
14289 .to.have.nested.property(prop, val);
14290 };
14291
14292 /**
14293 * ### .notNestedPropertyVal(object, property, value, [message])
14294 *
14295 * Asserts that `object` does _not_ have a property named by `property` with
14296 * value given by `value`. `property` can use dot- and bracket-notation for
14297 * nested reference. Uses a strict equality check (===).
14298 *
14299 * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha');
14300 * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'coffee.green', 'matcha');
14301 *
14302 * @name notNestedPropertyVal
14303 * @param {Object} object
14304 * @param {String} property
14305 * @param {Mixed} value
14306 * @param {String} message
14307 * @namespace Assert
14308 * @api public
14309 */
14310
14311 assert.notNestedPropertyVal = function (obj, prop, val, msg) {
14312 new Assertion(obj, msg, assert.notNestedPropertyVal, true)
14313 .to.not.have.nested.property(prop, val);
14314 };
14315
14316 /**
14317 * ### .deepNestedPropertyVal(object, property, value, [message])
14318 *
14319 * Asserts that `object` has a property named by `property` with a value given
14320 * by `value`. `property` can use dot- and bracket-notation for nested
14321 * reference. Uses a deep equality check.
14322 *
14323 * assert.deepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yum' });
14324 *
14325 * @name deepNestedPropertyVal
14326 * @param {Object} object
14327 * @param {String} property
14328 * @param {Mixed} value
14329 * @param {String} message
14330 * @namespace Assert
14331 * @api public
14332 */
14333
14334 assert.deepNestedPropertyVal = function (obj, prop, val, msg) {
14335 new Assertion(obj, msg, assert.deepNestedPropertyVal, true)
14336 .to.have.deep.nested.property(prop, val);
14337 };
14338
14339 /**
14340 * ### .notDeepNestedPropertyVal(object, property, value, [message])
14341 *
14342 * Asserts that `object` does _not_ have a property named by `property` with
14343 * value given by `value`. `property` can use dot- and bracket-notation for
14344 * nested reference. Uses a deep equality check.
14345 *
14346 * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { oolong: 'yum' });
14347 * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yuck' });
14348 * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.black', { matcha: 'yum' });
14349 *
14350 * @name notDeepNestedPropertyVal
14351 * @param {Object} object
14352 * @param {String} property
14353 * @param {Mixed} value
14354 * @param {String} message
14355 * @namespace Assert
14356 * @api public
14357 */
14358
14359 assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) {
14360 new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true)
14361 .to.not.have.deep.nested.property(prop, val);
14362 };
14363
14364 /**
14365 * ### .lengthOf(object, length, [message])
14366 *
14367 * Asserts that `object` has a `length` property with the expected value.
14368 *
14369 * assert.lengthOf([1,2,3], 3, 'array has length of 3');
14370 * assert.lengthOf('foobar', 6, 'string has length of 6');
14371 *
14372 * @name lengthOf
14373 * @param {Mixed} object
14374 * @param {Number} length
14375 * @param {String} message
14376 * @namespace Assert
14377 * @api public
14378 */
14379
14380 assert.lengthOf = function (exp, len, msg) {
14381 new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
14382 };
14383
14384 /**
14385 * ### .hasAnyKeys(object, [keys], [message])
14386 *
14387 * Asserts that `object` has at least one of the `keys` provided.
14388 * You can also provide a single object instead of a `keys` array and its keys
14389 * will be used as the expected set of keys.
14390 *
14391 * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'iDontExist', 'baz']);
14392 * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, iDontExist: 99, baz: 1337});
14393 * assert.hasAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
14394 * assert.hasAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
14395 *
14396 * @name hasAnyKeys
14397 * @param {Mixed} object
14398 * @param {Array|Object} keys
14399 * @param {String} message
14400 * @namespace Assert
14401 * @api public
14402 */
14403
14404 assert.hasAnyKeys = function (obj, keys, msg) {
14405 new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
14406 };
14407
14408 /**
14409 * ### .hasAllKeys(object, [keys], [message])
14410 *
14411 * Asserts that `object` has all and only all of the `keys` provided.
14412 * You can also provide a single object instead of a `keys` array and its keys
14413 * will be used as the expected set of keys.
14414 *
14415 * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);
14416 * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337]);
14417 * assert.hasAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
14418 * assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']);
14419 *
14420 * @name hasAllKeys
14421 * @param {Mixed} object
14422 * @param {String[]} keys
14423 * @param {String} message
14424 * @namespace Assert
14425 * @api public
14426 */
14427
14428 assert.hasAllKeys = function (obj, keys, msg) {
14429 new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
14430 };
14431
14432 /**
14433 * ### .containsAllKeys(object, [keys], [message])
14434 *
14435 * Asserts that `object` has all of the `keys` provided but may have more keys not listed.
14436 * You can also provide a single object instead of a `keys` array and its keys
14437 * will be used as the expected set of keys.
14438 *
14439 * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'baz']);
14440 * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);
14441 * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, baz: 1337});
14442 * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337});
14443 * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]);
14444 * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
14445 * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}]);
14446 * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']);
14447 *
14448 * @name containsAllKeys
14449 * @param {Mixed} object
14450 * @param {String[]} keys
14451 * @param {String} message
14452 * @namespace Assert
14453 * @api public
14454 */
14455
14456 assert.containsAllKeys = function (obj, keys, msg) {
14457 new Assertion(obj, msg, assert.containsAllKeys, true)
14458 .to.contain.all.keys(keys);
14459 };
14460
14461 /**
14462 * ### .doesNotHaveAnyKeys(object, [keys], [message])
14463 *
14464 * Asserts that `object` has none of the `keys` provided.
14465 * You can also provide a single object instead of a `keys` array and its keys
14466 * will be used as the expected set of keys.
14467 *
14468 * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
14469 * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
14470 * assert.doesNotHaveAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
14471 * assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']);
14472 *
14473 * @name doesNotHaveAnyKeys
14474 * @param {Mixed} object
14475 * @param {String[]} keys
14476 * @param {String} message
14477 * @namespace Assert
14478 * @api public
14479 */
14480
14481 assert.doesNotHaveAnyKeys = function (obj, keys, msg) {
14482 new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true)
14483 .to.not.have.any.keys(keys);
14484 };
14485
14486 /**
14487 * ### .doesNotHaveAllKeys(object, [keys], [message])
14488 *
14489 * Asserts that `object` does not have at least one of the `keys` provided.
14490 * You can also provide a single object instead of a `keys` array and its keys
14491 * will be used as the expected set of keys.
14492 *
14493 * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
14494 * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
14495 * assert.doesNotHaveAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
14496 * assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']);
14497 *
14498 * @name doesNotHaveAllKeys
14499 * @param {Mixed} object
14500 * @param {String[]} keys
14501 * @param {String} message
14502 * @namespace Assert
14503 * @api public
14504 */
14505
14506 assert.doesNotHaveAllKeys = function (obj, keys, msg) {
14507 new Assertion(obj, msg, assert.doesNotHaveAllKeys, true)
14508 .to.not.have.all.keys(keys);
14509 };
14510
14511 /**
14512 * ### .hasAnyDeepKeys(object, [keys], [message])
14513 *
14514 * Asserts that `object` has at least one of the `keys` provided.
14515 * Since Sets and Maps can have objects as keys you can use this assertion to perform
14516 * a deep comparison.
14517 * You can also provide a single object instead of a `keys` array and its keys
14518 * will be used as the expected set of keys.
14519 *
14520 * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
14521 * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]);
14522 * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
14523 * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});
14524 * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {three: 'three'}]);
14525 * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
14526 *
14527 * @name doesNotHaveAllKeys
14528 * @param {Mixed} object
14529 * @param {Array|Object} keys
14530 * @param {String} message
14531 * @namespace Assert
14532 * @api public
14533 */
14534
14535 assert.hasAnyDeepKeys = function (obj, keys, msg) {
14536 new Assertion(obj, msg, assert.hasAnyDeepKeys, true)
14537 .to.have.any.deep.keys(keys);
14538 };
14539
14540 /**
14541 * ### .hasAllDeepKeys(object, [keys], [message])
14542 *
14543 * Asserts that `object` has all and only all of the `keys` provided.
14544 * Since Sets and Maps can have objects as keys you can use this assertion to perform
14545 * a deep comparison.
14546 * You can also provide a single object instead of a `keys` array and its keys
14547 * will be used as the expected set of keys.
14548 *
14549 * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne']]), {one: 'one'});
14550 * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
14551 * assert.hasAllDeepKeys(new Set([{one: 'one'}]), {one: 'one'});
14552 * assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
14553 *
14554 * @name hasAllDeepKeys
14555 * @param {Mixed} object
14556 * @param {Array|Object} keys
14557 * @param {String} message
14558 * @namespace Assert
14559 * @api public
14560 */
14561
14562 assert.hasAllDeepKeys = function (obj, keys, msg) {
14563 new Assertion(obj, msg, assert.hasAllDeepKeys, true)
14564 .to.have.all.deep.keys(keys);
14565 };
14566
14567 /**
14568 * ### .containsAllDeepKeys(object, [keys], [message])
14569 *
14570 * Asserts that `object` contains all of the `keys` provided.
14571 * Since Sets and Maps can have objects as keys you can use this assertion to perform
14572 * a deep comparison.
14573 * You can also provide a single object instead of a `keys` array and its keys
14574 * will be used as the expected set of keys.
14575 *
14576 * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
14577 * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
14578 * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});
14579 * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
14580 *
14581 * @name containsAllDeepKeys
14582 * @param {Mixed} object
14583 * @param {Array|Object} keys
14584 * @param {String} message
14585 * @namespace Assert
14586 * @api public
14587 */
14588
14589 assert.containsAllDeepKeys = function (obj, keys, msg) {
14590 new Assertion(obj, msg, assert.containsAllDeepKeys, true)
14591 .to.contain.all.deep.keys(keys);
14592 };
14593
14594 /**
14595 * ### .doesNotHaveAnyDeepKeys(object, [keys], [message])
14596 *
14597 * Asserts that `object` has none of the `keys` provided.
14598 * Since Sets and Maps can have objects as keys you can use this assertion to perform
14599 * a deep comparison.
14600 * You can also provide a single object instead of a `keys` array and its keys
14601 * will be used as the expected set of keys.
14602 *
14603 * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
14604 * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
14605 * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});
14606 * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
14607 *
14608 * @name doesNotHaveAnyDeepKeys
14609 * @param {Mixed} object
14610 * @param {Array|Object} keys
14611 * @param {String} message
14612 * @namespace Assert
14613 * @api public
14614 */
14615
14616 assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) {
14617 new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true)
14618 .to.not.have.any.deep.keys(keys);
14619 };
14620
14621 /**
14622 * ### .doesNotHaveAllDeepKeys(object, [keys], [message])
14623 *
14624 * Asserts that `object` does not have at least one of the `keys` provided.
14625 * Since Sets and Maps can have objects as keys you can use this assertion to perform
14626 * a deep comparison.
14627 * You can also provide a single object instead of a `keys` array and its keys
14628 * will be used as the expected set of keys.
14629 *
14630 * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
14631 * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]);
14632 * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});
14633 * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]);
14634 *
14635 * @name doesNotHaveAllDeepKeys
14636 * @param {Mixed} object
14637 * @param {Array|Object} keys
14638 * @param {String} message
14639 * @namespace Assert
14640 * @api public
14641 */
14642
14643 assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) {
14644 new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true)
14645 .to.not.have.all.deep.keys(keys);
14646 };
14647
14648 /**
14649 * ### .throws(fn, [errorLike/string/regexp], [string/regexp], [message])
14650 *
14651 * If `errorLike` is an `Error` constructor, asserts that `fn` will throw an error that is an
14652 * instance of `errorLike`.
14653 * If `errorLike` is an `Error` instance, asserts that the error thrown is the same
14654 * instance as `errorLike`.
14655 * If `errMsgMatcher` is provided, it also asserts that the error thrown will have a
14656 * message matching `errMsgMatcher`.
14657 *
14658 * assert.throws(fn, 'function throws a reference error');
14659 * assert.throws(fn, /function throws a reference error/);
14660 * assert.throws(fn, ReferenceError);
14661 * assert.throws(fn, errorInstance);
14662 * assert.throws(fn, ReferenceError, 'Error thrown must be a ReferenceError and have this msg');
14663 * assert.throws(fn, errorInstance, 'Error thrown must be the same errorInstance and have this msg');
14664 * assert.throws(fn, ReferenceError, /Error thrown must be a ReferenceError and match this/);
14665 * assert.throws(fn, errorInstance, /Error thrown must be the same errorInstance and match this/);
14666 *
14667 * @name throws
14668 * @alias throw
14669 * @alias Throw
14670 * @param {Function} fn
14671 * @param {ErrorConstructor|Error} errorLike
14672 * @param {RegExp|String} errMsgMatcher
14673 * @param {String} message
14674 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
14675 * @namespace Assert
14676 * @api public
14677 */
14678
14679 assert.throws = function (fn, errorLike, errMsgMatcher, msg) {
14680 if ('string' === typeof errorLike || errorLike instanceof RegExp) {
14681 errMsgMatcher = errorLike;
14682 errorLike = null;
14683 }
14684
14685 var assertErr = new Assertion(fn, msg, assert.throws, true)
14686 .to.throw(errorLike, errMsgMatcher);
14687 return flag(assertErr, 'object');
14688 };
14689
14690 /**
14691 * ### .doesNotThrow(fn, [errorLike/string/regexp], [string/regexp], [message])
14692 *
14693 * If `errorLike` is an `Error` constructor, asserts that `fn` will _not_ throw an error that is an
14694 * instance of `errorLike`.
14695 * If `errorLike` is an `Error` instance, asserts that the error thrown is _not_ the same
14696 * instance as `errorLike`.
14697 * If `errMsgMatcher` is provided, it also asserts that the error thrown will _not_ have a
14698 * message matching `errMsgMatcher`.
14699 *
14700 * assert.doesNotThrow(fn, 'Any Error thrown must not have this message');
14701 * assert.doesNotThrow(fn, /Any Error thrown must not match this/);
14702 * assert.doesNotThrow(fn, Error);
14703 * assert.doesNotThrow(fn, errorInstance);
14704 * assert.doesNotThrow(fn, Error, 'Error must not have this message');
14705 * assert.doesNotThrow(fn, errorInstance, 'Error must not have this message');
14706 * assert.doesNotThrow(fn, Error, /Error must not match this/);
14707 * assert.doesNotThrow(fn, errorInstance, /Error must not match this/);
14708 *
14709 * @name doesNotThrow
14710 * @param {Function} fn
14711 * @param {ErrorConstructor} errorLike
14712 * @param {RegExp|String} errMsgMatcher
14713 * @param {String} message
14714 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
14715 * @namespace Assert
14716 * @api public
14717 */
14718
14719 assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) {
14720 if ('string' === typeof errorLike || errorLike instanceof RegExp) {
14721 errMsgMatcher = errorLike;
14722 errorLike = null;
14723 }
14724
14725 new Assertion(fn, msg, assert.doesNotThrow, true)
14726 .to.not.throw(errorLike, errMsgMatcher);
14727 };
14728
14729 /**
14730 * ### .operator(val1, operator, val2, [message])
14731 *
14732 * Compares two values using `operator`.
14733 *
14734 * assert.operator(1, '<', 2, 'everything is ok');
14735 * assert.operator(1, '>', 2, 'this will fail');
14736 *
14737 * @name operator
14738 * @param {Mixed} val1
14739 * @param {String} operator
14740 * @param {Mixed} val2
14741 * @param {String} message
14742 * @namespace Assert
14743 * @api public
14744 */
14745
14746 assert.operator = function (val, operator, val2, msg) {
14747 var ok;
14748 switch(operator) {
14749 case '==':
14750 ok = val == val2;
14751 break;
14752 case '===':
14753 ok = val === val2;
14754 break;
14755 case '>':
14756 ok = val > val2;
14757 break;
14758 case '>=':
14759 ok = val >= val2;
14760 break;
14761 case '<':
14762 ok = val < val2;
14763 break;
14764 case '<=':
14765 ok = val <= val2;
14766 break;
14767 case '!=':
14768 ok = val != val2;
14769 break;
14770 case '!==':
14771 ok = val !== val2;
14772 break;
14773 default:
14774 msg = msg ? msg + ': ' : msg;
14775 throw new chai.AssertionError(
14776 msg + 'Invalid operator "' + operator + '"',
14777 undefined,
14778 assert.operator
14779 );
14780 }
14781 var test = new Assertion(ok, msg, assert.operator, true);
14782 test.assert(
14783 true === flag(test, 'object')
14784 , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)
14785 , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );
14786 };
14787
14788 /**
14789 * ### .closeTo(actual, expected, delta, [message])
14790 *
14791 * Asserts that the target is equal `expected`, to within a +/- `delta` range.
14792 *
14793 * assert.closeTo(1.5, 1, 0.5, 'numbers are close');
14794 *
14795 * @name closeTo
14796 * @param {Number} actual
14797 * @param {Number} expected
14798 * @param {Number} delta
14799 * @param {String} message
14800 * @namespace Assert
14801 * @api public
14802 */
14803
14804 assert.closeTo = function (act, exp, delta, msg) {
14805 new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
14806 };
14807
14808 /**
14809 * ### .approximately(actual, expected, delta, [message])
14810 *
14811 * Asserts that the target is equal `expected`, to within a +/- `delta` range.
14812 *
14813 * assert.approximately(1.5, 1, 0.5, 'numbers are close');
14814 *
14815 * @name approximately
14816 * @param {Number} actual
14817 * @param {Number} expected
14818 * @param {Number} delta
14819 * @param {String} message
14820 * @namespace Assert
14821 * @api public
14822 */
14823
14824 assert.approximately = function (act, exp, delta, msg) {
14825 new Assertion(act, msg, assert.approximately, true)
14826 .to.be.approximately(exp, delta);
14827 };
14828
14829 /**
14830 * ### .sameMembers(set1, set2, [message])
14831 *
14832 * Asserts that `set1` and `set2` have the same members in any order. Uses a
14833 * strict equality check (===).
14834 *
14835 * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
14836 *
14837 * @name sameMembers
14838 * @param {Array} set1
14839 * @param {Array} set2
14840 * @param {String} message
14841 * @namespace Assert
14842 * @api public
14843 */
14844
14845 assert.sameMembers = function (set1, set2, msg) {
14846 new Assertion(set1, msg, assert.sameMembers, true)
14847 .to.have.same.members(set2);
14848 };
14849
14850 /**
14851 * ### .notSameMembers(set1, set2, [message])
14852 *
14853 * Asserts that `set1` and `set2` don't have the same members in any order.
14854 * Uses a strict equality check (===).
14855 *
14856 * assert.notSameMembers([ 1, 2, 3 ], [ 5, 1, 3 ], 'not same members');
14857 *
14858 * @name notSameMembers
14859 * @param {Array} set1
14860 * @param {Array} set2
14861 * @param {String} message
14862 * @namespace Assert
14863 * @api public
14864 */
14865
14866 assert.notSameMembers = function (set1, set2, msg) {
14867 new Assertion(set1, msg, assert.notSameMembers, true)
14868 .to.not.have.same.members(set2);
14869 };
14870
14871 /**
14872 * ### .sameDeepMembers(set1, set2, [message])
14873 *
14874 * Asserts that `set1` and `set2` have the same members in any order. Uses a
14875 * deep equality check.
14876 *
14877 * assert.sameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { c: 3 }], 'same deep members');
14878 *
14879 * @name sameDeepMembers
14880 * @param {Array} set1
14881 * @param {Array} set2
14882 * @param {String} message
14883 * @namespace Assert
14884 * @api public
14885 */
14886
14887 assert.sameDeepMembers = function (set1, set2, msg) {
14888 new Assertion(set1, msg, assert.sameDeepMembers, true)
14889 .to.have.same.deep.members(set2);
14890 };
14891
14892 /**
14893 * ### .notSameDeepMembers(set1, set2, [message])
14894 *
14895 * Asserts that `set1` and `set2` don't have the same members in any order.
14896 * Uses a deep equality check.
14897 *
14898 * assert.notSameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { f: 5 }], 'not same deep members');
14899 *
14900 * @name notSameDeepMembers
14901 * @param {Array} set1
14902 * @param {Array} set2
14903 * @param {String} message
14904 * @namespace Assert
14905 * @api public
14906 */
14907
14908 assert.notSameDeepMembers = function (set1, set2, msg) {
14909 new Assertion(set1, msg, assert.notSameDeepMembers, true)
14910 .to.not.have.same.deep.members(set2);
14911 };
14912
14913 /**
14914 * ### .sameOrderedMembers(set1, set2, [message])
14915 *
14916 * Asserts that `set1` and `set2` have the same members in the same order.
14917 * Uses a strict equality check (===).
14918 *
14919 * assert.sameOrderedMembers([ 1, 2, 3 ], [ 1, 2, 3 ], 'same ordered members');
14920 *
14921 * @name sameOrderedMembers
14922 * @param {Array} set1
14923 * @param {Array} set2
14924 * @param {String} message
14925 * @namespace Assert
14926 * @api public
14927 */
14928
14929 assert.sameOrderedMembers = function (set1, set2, msg) {
14930 new Assertion(set1, msg, assert.sameOrderedMembers, true)
14931 .to.have.same.ordered.members(set2);
14932 };
14933
14934 /**
14935 * ### .notSameOrderedMembers(set1, set2, [message])
14936 *
14937 * Asserts that `set1` and `set2` don't have the same members in the same
14938 * order. Uses a strict equality check (===).
14939 *
14940 * assert.notSameOrderedMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'not same ordered members');
14941 *
14942 * @name notSameOrderedMembers
14943 * @param {Array} set1
14944 * @param {Array} set2
14945 * @param {String} message
14946 * @namespace Assert
14947 * @api public
14948 */
14949
14950 assert.notSameOrderedMembers = function (set1, set2, msg) {
14951 new Assertion(set1, msg, assert.notSameOrderedMembers, true)
14952 .to.not.have.same.ordered.members(set2);
14953 };
14954
14955 /**
14956 * ### .sameDeepOrderedMembers(set1, set2, [message])
14957 *
14958 * Asserts that `set1` and `set2` have the same members in the same order.
14959 * Uses a deep equality check.
14960 *
14961 * assert.sameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { c: 3 } ], 'same deep ordered members');
14962 *
14963 * @name sameDeepOrderedMembers
14964 * @param {Array} set1
14965 * @param {Array} set2
14966 * @param {String} message
14967 * @namespace Assert
14968 * @api public
14969 */
14970
14971 assert.sameDeepOrderedMembers = function (set1, set2, msg) {
14972 new Assertion(set1, msg, assert.sameDeepOrderedMembers, true)
14973 .to.have.same.deep.ordered.members(set2);
14974 };
14975
14976 /**
14977 * ### .notSameDeepOrderedMembers(set1, set2, [message])
14978 *
14979 * Asserts that `set1` and `set2` don't have the same members in the same
14980 * order. Uses a deep equality check.
14981 *
14982 * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { z: 5 } ], 'not same deep ordered members');
14983 * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { c: 3 } ], 'not same deep ordered members');
14984 *
14985 * @name notSameDeepOrderedMembers
14986 * @param {Array} set1
14987 * @param {Array} set2
14988 * @param {String} message
14989 * @namespace Assert
14990 * @api public
14991 */
14992
14993 assert.notSameDeepOrderedMembers = function (set1, set2, msg) {
14994 new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true)
14995 .to.not.have.same.deep.ordered.members(set2);
14996 };
14997
14998 /**
14999 * ### .includeMembers(superset, subset, [message])
15000 *
15001 * Asserts that `subset` is included in `superset` in any order. Uses a
15002 * strict equality check (===). Duplicates are ignored.
15003 *
15004 * assert.includeMembers([ 1, 2, 3 ], [ 2, 1, 2 ], 'include members');
15005 *
15006 * @name includeMembers
15007 * @param {Array} superset
15008 * @param {Array} subset
15009 * @param {String} message
15010 * @namespace Assert
15011 * @api public
15012 */
15013
15014 assert.includeMembers = function (superset, subset, msg) {
15015 new Assertion(superset, msg, assert.includeMembers, true)
15016 .to.include.members(subset);
15017 };
15018
15019 /**
15020 * ### .notIncludeMembers(superset, subset, [message])
15021 *
15022 * Asserts that `subset` isn't included in `superset` in any order. Uses a
15023 * strict equality check (===). Duplicates are ignored.
15024 *
15025 * assert.notIncludeMembers([ 1, 2, 3 ], [ 5, 1 ], 'not include members');
15026 *
15027 * @name notIncludeMembers
15028 * @param {Array} superset
15029 * @param {Array} subset
15030 * @param {String} message
15031 * @namespace Assert
15032 * @api public
15033 */
15034
15035 assert.notIncludeMembers = function (superset, subset, msg) {
15036 new Assertion(superset, msg, assert.notIncludeMembers, true)
15037 .to.not.include.members(subset);
15038 };
15039
15040 /**
15041 * ### .includeDeepMembers(superset, subset, [message])
15042 *
15043 * Asserts that `subset` is included in `superset` in any order. Uses a deep
15044 * equality check. Duplicates are ignored.
15045 *
15046 * assert.includeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { b: 2 } ], 'include deep members');
15047 *
15048 * @name includeDeepMembers
15049 * @param {Array} superset
15050 * @param {Array} subset
15051 * @param {String} message
15052 * @namespace Assert
15053 * @api public
15054 */
15055
15056 assert.includeDeepMembers = function (superset, subset, msg) {
15057 new Assertion(superset, msg, assert.includeDeepMembers, true)
15058 .to.include.deep.members(subset);
15059 };
15060
15061 /**
15062 * ### .notIncludeDeepMembers(superset, subset, [message])
15063 *
15064 * Asserts that `subset` isn't included in `superset` in any order. Uses a
15065 * deep equality check. Duplicates are ignored.
15066 *
15067 * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members');
15068 *
15069 * @name notIncludeDeepMembers
15070 * @param {Array} superset
15071 * @param {Array} subset
15072 * @param {String} message
15073 * @namespace Assert
15074 * @api public
15075 */
15076
15077 assert.notIncludeDeepMembers = function (superset, subset, msg) {
15078 new Assertion(superset, msg, assert.notIncludeDeepMembers, true)
15079 .to.not.include.deep.members(subset);
15080 };
15081
15082 /**
15083 * ### .includeOrderedMembers(superset, subset, [message])
15084 *
15085 * Asserts that `subset` is included in `superset` in the same order
15086 * beginning with the first element in `superset`. Uses a strict equality
15087 * check (===).
15088 *
15089 * assert.includeOrderedMembers([ 1, 2, 3 ], [ 1, 2 ], 'include ordered members');
15090 *
15091 * @name includeOrderedMembers
15092 * @param {Array} superset
15093 * @param {Array} subset
15094 * @param {String} message
15095 * @namespace Assert
15096 * @api public
15097 */
15098
15099 assert.includeOrderedMembers = function (superset, subset, msg) {
15100 new Assertion(superset, msg, assert.includeOrderedMembers, true)
15101 .to.include.ordered.members(subset);
15102 };
15103
15104 /**
15105 * ### .notIncludeOrderedMembers(superset, subset, [message])
15106 *
15107 * Asserts that `subset` isn't included in `superset` in the same order
15108 * beginning with the first element in `superset`. Uses a strict equality
15109 * check (===).
15110 *
15111 * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 1 ], 'not include ordered members');
15112 * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 3 ], 'not include ordered members');
15113 *
15114 * @name notIncludeOrderedMembers
15115 * @param {Array} superset
15116 * @param {Array} subset
15117 * @param {String} message
15118 * @namespace Assert
15119 * @api public
15120 */
15121
15122 assert.notIncludeOrderedMembers = function (superset, subset, msg) {
15123 new Assertion(superset, msg, assert.notIncludeOrderedMembers, true)
15124 .to.not.include.ordered.members(subset);
15125 };
15126
15127 /**
15128 * ### .includeDeepOrderedMembers(superset, subset, [message])
15129 *
15130 * Asserts that `subset` is included in `superset` in the same order
15131 * beginning with the first element in `superset`. Uses a deep equality
15132 * check.
15133 *
15134 * assert.includeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 } ], 'include deep ordered members');
15135 *
15136 * @name includeDeepOrderedMembers
15137 * @param {Array} superset
15138 * @param {Array} subset
15139 * @param {String} message
15140 * @namespace Assert
15141 * @api public
15142 */
15143
15144 assert.includeDeepOrderedMembers = function (superset, subset, msg) {
15145 new Assertion(superset, msg, assert.includeDeepOrderedMembers, true)
15146 .to.include.deep.ordered.members(subset);
15147 };
15148
15149 /**
15150 * ### .notIncludeDeepOrderedMembers(superset, subset, [message])
15151 *
15152 * Asserts that `subset` isn't included in `superset` in the same order
15153 * beginning with the first element in `superset`. Uses a deep equality
15154 * check.
15155 *
15156 * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { f: 5 } ], 'not include deep ordered members');
15157 * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 } ], 'not include deep ordered members');
15158 * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { c: 3 } ], 'not include deep ordered members');
15159 *
15160 * @name notIncludeDeepOrderedMembers
15161 * @param {Array} superset
15162 * @param {Array} subset
15163 * @param {String} message
15164 * @namespace Assert
15165 * @api public
15166 */
15167
15168 assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) {
15169 new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true)
15170 .to.not.include.deep.ordered.members(subset);
15171 };
15172
15173 /**
15174 * ### .oneOf(inList, list, [message])
15175 *
15176 * Asserts that non-object, non-array value `inList` appears in the flat array `list`.
15177 *
15178 * assert.oneOf(1, [ 2, 1 ], 'Not found in list');
15179 *
15180 * @name oneOf
15181 * @param {*} inList
15182 * @param {Array<*>} list
15183 * @param {String} message
15184 * @namespace Assert
15185 * @api public
15186 */
15187
15188 assert.oneOf = function (inList, list, msg) {
15189 new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
15190 };
15191
15192 /**
15193 * ### .changes(function, object, property, [message])
15194 *
15195 * Asserts that a function changes the value of a property.
15196 *
15197 * var obj = { val: 10 };
15198 * var fn = function() { obj.val = 22 };
15199 * assert.changes(fn, obj, 'val');
15200 *
15201 * @name changes
15202 * @param {Function} modifier function
15203 * @param {Object} object or getter function
15204 * @param {String} property name _optional_
15205 * @param {String} message _optional_
15206 * @namespace Assert
15207 * @api public
15208 */
15209
15210 assert.changes = function (fn, obj, prop, msg) {
15211 if (arguments.length === 3 && typeof obj === 'function') {
15212 msg = prop;
15213 prop = null;
15214 }
15215
15216 new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
15217 };
15218
15219 /**
15220 * ### .changesBy(function, object, property, delta, [message])
15221 *
15222 * Asserts that a function changes the value of a property by an amount (delta).
15223 *
15224 * var obj = { val: 10 };
15225 * var fn = function() { obj.val += 2 };
15226 * assert.changesBy(fn, obj, 'val', 2);
15227 *
15228 * @name changesBy
15229 * @param {Function} modifier function
15230 * @param {Object} object or getter function
15231 * @param {String} property name _optional_
15232 * @param {Number} change amount (delta)
15233 * @param {String} message _optional_
15234 * @namespace Assert
15235 * @api public
15236 */
15237
15238 assert.changesBy = function (fn, obj, prop, delta, msg) {
15239 if (arguments.length === 4 && typeof obj === 'function') {
15240 var tmpMsg = delta;
15241 delta = prop;
15242 msg = tmpMsg;
15243 } else if (arguments.length === 3) {
15244 delta = prop;
15245 prop = null;
15246 }
15247
15248 new Assertion(fn, msg, assert.changesBy, true)
15249 .to.change(obj, prop).by(delta);
15250 };
15251
15252 /**
15253 * ### .doesNotChange(function, object, property, [message])
15254 *
15255 * Asserts that a function does not change the value of a property.
15256 *
15257 * var obj = { val: 10 };
15258 * var fn = function() { console.log('foo'); };
15259 * assert.doesNotChange(fn, obj, 'val');
15260 *
15261 * @name doesNotChange
15262 * @param {Function} modifier function
15263 * @param {Object} object or getter function
15264 * @param {String} property name _optional_
15265 * @param {String} message _optional_
15266 * @namespace Assert
15267 * @api public
15268 */
15269
15270 assert.doesNotChange = function (fn, obj, prop, msg) {
15271 if (arguments.length === 3 && typeof obj === 'function') {
15272 msg = prop;
15273 prop = null;
15274 }
15275
15276 return new Assertion(fn, msg, assert.doesNotChange, true)
15277 .to.not.change(obj, prop);
15278 };
15279
15280 /**
15281 * ### .changesButNotBy(function, object, property, delta, [message])
15282 *
15283 * Asserts that a function does not change the value of a property or of a function's return value by an amount (delta)
15284 *
15285 * var obj = { val: 10 };
15286 * var fn = function() { obj.val += 10 };
15287 * assert.changesButNotBy(fn, obj, 'val', 5);
15288 *
15289 * @name changesButNotBy
15290 * @param {Function} modifier function
15291 * @param {Object} object or getter function
15292 * @param {String} property name _optional_
15293 * @param {Number} change amount (delta)
15294 * @param {String} message _optional_
15295 * @namespace Assert
15296 * @api public
15297 */
15298
15299 assert.changesButNotBy = function (fn, obj, prop, delta, msg) {
15300 if (arguments.length === 4 && typeof obj === 'function') {
15301 var tmpMsg = delta;
15302 delta = prop;
15303 msg = tmpMsg;
15304 } else if (arguments.length === 3) {
15305 delta = prop;
15306 prop = null;
15307 }
15308
15309 new Assertion(fn, msg, assert.changesButNotBy, true)
15310 .to.change(obj, prop).but.not.by(delta);
15311 };
15312
15313 /**
15314 * ### .increases(function, object, property, [message])
15315 *
15316 * Asserts that a function increases a numeric object property.
15317 *
15318 * var obj = { val: 10 };
15319 * var fn = function() { obj.val = 13 };
15320 * assert.increases(fn, obj, 'val');
15321 *
15322 * @name increases
15323 * @param {Function} modifier function
15324 * @param {Object} object or getter function
15325 * @param {String} property name _optional_
15326 * @param {String} message _optional_
15327 * @namespace Assert
15328 * @api public
15329 */
15330
15331 assert.increases = function (fn, obj, prop, msg) {
15332 if (arguments.length === 3 && typeof obj === 'function') {
15333 msg = prop;
15334 prop = null;
15335 }
15336
15337 return new Assertion(fn, msg, assert.increases, true)
15338 .to.increase(obj, prop);
15339 };
15340
15341 /**
15342 * ### .increasesBy(function, object, property, delta, [message])
15343 *
15344 * Asserts that a function increases a numeric object property or a function's return value by an amount (delta).
15345 *
15346 * var obj = { val: 10 };
15347 * var fn = function() { obj.val += 10 };
15348 * assert.increasesBy(fn, obj, 'val', 10);
15349 *
15350 * @name increasesBy
15351 * @param {Function} modifier function
15352 * @param {Object} object or getter function
15353 * @param {String} property name _optional_
15354 * @param {Number} change amount (delta)
15355 * @param {String} message _optional_
15356 * @namespace Assert
15357 * @api public
15358 */
15359
15360 assert.increasesBy = function (fn, obj, prop, delta, msg) {
15361 if (arguments.length === 4 && typeof obj === 'function') {
15362 var tmpMsg = delta;
15363 delta = prop;
15364 msg = tmpMsg;
15365 } else if (arguments.length === 3) {
15366 delta = prop;
15367 prop = null;
15368 }
15369
15370 new Assertion(fn, msg, assert.increasesBy, true)
15371 .to.increase(obj, prop).by(delta);
15372 };
15373
15374 /**
15375 * ### .doesNotIncrease(function, object, property, [message])
15376 *
15377 * Asserts that a function does not increase a numeric object property.
15378 *
15379 * var obj = { val: 10 };
15380 * var fn = function() { obj.val = 8 };
15381 * assert.doesNotIncrease(fn, obj, 'val');
15382 *
15383 * @name doesNotIncrease
15384 * @param {Function} modifier function
15385 * @param {Object} object or getter function
15386 * @param {String} property name _optional_
15387 * @param {String} message _optional_
15388 * @namespace Assert
15389 * @api public
15390 */
15391
15392 assert.doesNotIncrease = function (fn, obj, prop, msg) {
15393 if (arguments.length === 3 && typeof obj === 'function') {
15394 msg = prop;
15395 prop = null;
15396 }
15397
15398 return new Assertion(fn, msg, assert.doesNotIncrease, true)
15399 .to.not.increase(obj, prop);
15400 };
15401
15402 /**
15403 * ### .increasesButNotBy(function, object, property, [message])
15404 *
15405 * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta).
15406 *
15407 * var obj = { val: 10 };
15408 * var fn = function() { obj.val = 15 };
15409 * assert.increasesButNotBy(fn, obj, 'val', 10);
15410 *
15411 * @name increasesButNotBy
15412 * @param {Function} modifier function
15413 * @param {Object} object or getter function
15414 * @param {String} property name _optional_
15415 * @param {Number} change amount (delta)
15416 * @param {String} message _optional_
15417 * @namespace Assert
15418 * @api public
15419 */
15420
15421 assert.increasesButNotBy = function (fn, obj, prop, delta, msg) {
15422 if (arguments.length === 4 && typeof obj === 'function') {
15423 var tmpMsg = delta;
15424 delta = prop;
15425 msg = tmpMsg;
15426 } else if (arguments.length === 3) {
15427 delta = prop;
15428 prop = null;
15429 }
15430
15431 new Assertion(fn, msg, assert.increasesButNotBy, true)
15432 .to.increase(obj, prop).but.not.by(delta);
15433 };
15434
15435 /**
15436 * ### .decreases(function, object, property, [message])
15437 *
15438 * Asserts that a function decreases a numeric object property.
15439 *
15440 * var obj = { val: 10 };
15441 * var fn = function() { obj.val = 5 };
15442 * assert.decreases(fn, obj, 'val');
15443 *
15444 * @name decreases
15445 * @param {Function} modifier function
15446 * @param {Object} object or getter function
15447 * @param {String} property name _optional_
15448 * @param {String} message _optional_
15449 * @namespace Assert
15450 * @api public
15451 */
15452
15453 assert.decreases = function (fn, obj, prop, msg) {
15454 if (arguments.length === 3 && typeof obj === 'function') {
15455 msg = prop;
15456 prop = null;
15457 }
15458
15459 return new Assertion(fn, msg, assert.decreases, true)
15460 .to.decrease(obj, prop);
15461 };
15462
15463 /**
15464 * ### .decreasesBy(function, object, property, delta, [message])
15465 *
15466 * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta)
15467 *
15468 * var obj = { val: 10 };
15469 * var fn = function() { obj.val -= 5 };
15470 * assert.decreasesBy(fn, obj, 'val', 5);
15471 *
15472 * @name decreasesBy
15473 * @param {Function} modifier function
15474 * @param {Object} object or getter function
15475 * @param {String} property name _optional_
15476 * @param {Number} change amount (delta)
15477 * @param {String} message _optional_
15478 * @namespace Assert
15479 * @api public
15480 */
15481
15482 assert.decreasesBy = function (fn, obj, prop, delta, msg) {
15483 if (arguments.length === 4 && typeof obj === 'function') {
15484 var tmpMsg = delta;
15485 delta = prop;
15486 msg = tmpMsg;
15487 } else if (arguments.length === 3) {
15488 delta = prop;
15489 prop = null;
15490 }
15491
15492 new Assertion(fn, msg, assert.decreasesBy, true)
15493 .to.decrease(obj, prop).by(delta);
15494 };
15495
15496 /**
15497 * ### .doesNotDecrease(function, object, property, [message])
15498 *
15499 * Asserts that a function does not decreases a numeric object property.
15500 *
15501 * var obj = { val: 10 };
15502 * var fn = function() { obj.val = 15 };
15503 * assert.doesNotDecrease(fn, obj, 'val');
15504 *
15505 * @name doesNotDecrease
15506 * @param {Function} modifier function
15507 * @param {Object} object or getter function
15508 * @param {String} property name _optional_
15509 * @param {String} message _optional_
15510 * @namespace Assert
15511 * @api public
15512 */
15513
15514 assert.doesNotDecrease = function (fn, obj, prop, msg) {
15515 if (arguments.length === 3 && typeof obj === 'function') {
15516 msg = prop;
15517 prop = null;
15518 }
15519
15520 return new Assertion(fn, msg, assert.doesNotDecrease, true)
15521 .to.not.decrease(obj, prop);
15522 };
15523
15524 /**
15525 * ### .doesNotDecreaseBy(function, object, property, delta, [message])
15526 *
15527 * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
15528 *
15529 * var obj = { val: 10 };
15530 * var fn = function() { obj.val = 5 };
15531 * assert.doesNotDecreaseBy(fn, obj, 'val', 1);
15532 *
15533 * @name doesNotDecrease
15534 * @param {Function} modifier function
15535 * @param {Object} object or getter function
15536 * @param {String} property name _optional_
15537 * @param {Number} change amount (delta)
15538 * @param {String} message _optional_
15539 * @namespace Assert
15540 * @api public
15541 */
15542
15543 assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) {
15544 if (arguments.length === 4 && typeof obj === 'function') {
15545 var tmpMsg = delta;
15546 delta = prop;
15547 msg = tmpMsg;
15548 } else if (arguments.length === 3) {
15549 delta = prop;
15550 prop = null;
15551 }
15552
15553 return new Assertion(fn, msg, assert.doesNotDecreaseBy, true)
15554 .to.not.decrease(obj, prop).by(delta);
15555 };
15556
15557 /**
15558 * ### .decreasesButNotBy(function, object, property, delta, [message])
15559 *
15560 * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
15561 *
15562 * var obj = { val: 10 };
15563 * var fn = function() { obj.val = 5 };
15564 * assert.decreasesButNotBy(fn, obj, 'val', 1);
15565 *
15566 * @name decreasesButNotBy
15567 * @param {Function} modifier function
15568 * @param {Object} object or getter function
15569 * @param {String} property name _optional_
15570 * @param {Number} change amount (delta)
15571 * @param {String} message _optional_
15572 * @namespace Assert
15573 * @api public
15574 */
15575
15576 assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) {
15577 if (arguments.length === 4 && typeof obj === 'function') {
15578 var tmpMsg = delta;
15579 delta = prop;
15580 msg = tmpMsg;
15581 } else if (arguments.length === 3) {
15582 delta = prop;
15583 prop = null;
15584 }
15585
15586 new Assertion(fn, msg, assert.decreasesButNotBy, true)
15587 .to.decrease(obj, prop).but.not.by(delta);
15588 };
15589
15590 /*!
15591 * ### .ifError(object)
15592 *
15593 * Asserts if value is not a false value, and throws if it is a true value.
15594 * This is added to allow for chai to be a drop-in replacement for Node's
15595 * assert class.
15596 *
15597 * var err = new Error('I am a custom error');
15598 * assert.ifError(err); // Rethrows err!
15599 *
15600 * @name ifError
15601 * @param {Object} object
15602 * @namespace Assert
15603 * @api public
15604 */
15605
15606 assert.ifError = function (val) {
15607 if (val) {
15608 throw(val);
15609 }
15610 };
15611
15612 /**
15613 * ### .isExtensible(object)
15614 *
15615 * Asserts that `object` is extensible (can have new properties added to it).
15616 *
15617 * assert.isExtensible({});
15618 *
15619 * @name isExtensible
15620 * @alias extensible
15621 * @param {Object} object
15622 * @param {String} message _optional_
15623 * @namespace Assert
15624 * @api public
15625 */
15626
15627 assert.isExtensible = function (obj, msg) {
15628 new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
15629 };
15630
15631 /**
15632 * ### .isNotExtensible(object)
15633 *
15634 * Asserts that `object` is _not_ extensible.
15635 *
15636 * var nonExtensibleObject = Object.preventExtensions({});
15637 * var sealedObject = Object.seal({});
15638 * var frozenObject = Object.freeze({});
15639 *
15640 * assert.isNotExtensible(nonExtensibleObject);
15641 * assert.isNotExtensible(sealedObject);
15642 * assert.isNotExtensible(frozenObject);
15643 *
15644 * @name isNotExtensible
15645 * @alias notExtensible
15646 * @param {Object} object
15647 * @param {String} message _optional_
15648 * @namespace Assert
15649 * @api public
15650 */
15651
15652 assert.isNotExtensible = function (obj, msg) {
15653 new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
15654 };
15655
15656 /**
15657 * ### .isSealed(object)
15658 *
15659 * Asserts that `object` is sealed (cannot have new properties added to it
15660 * and its existing properties cannot be removed).
15661 *
15662 * var sealedObject = Object.seal({});
15663 * var frozenObject = Object.seal({});
15664 *
15665 * assert.isSealed(sealedObject);
15666 * assert.isSealed(frozenObject);
15667 *
15668 * @name isSealed
15669 * @alias sealed
15670 * @param {Object} object
15671 * @param {String} message _optional_
15672 * @namespace Assert
15673 * @api public
15674 */
15675
15676 assert.isSealed = function (obj, msg) {
15677 new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
15678 };
15679
15680 /**
15681 * ### .isNotSealed(object)
15682 *
15683 * Asserts that `object` is _not_ sealed.
15684 *
15685 * assert.isNotSealed({});
15686 *
15687 * @name isNotSealed
15688 * @alias notSealed
15689 * @param {Object} object
15690 * @param {String} message _optional_
15691 * @namespace Assert
15692 * @api public
15693 */
15694
15695 assert.isNotSealed = function (obj, msg) {
15696 new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
15697 };
15698
15699 /**
15700 * ### .isFrozen(object)
15701 *
15702 * Asserts that `object` is frozen (cannot have new properties added to it
15703 * and its existing properties cannot be modified).
15704 *
15705 * var frozenObject = Object.freeze({});
15706 * assert.frozen(frozenObject);
15707 *
15708 * @name isFrozen
15709 * @alias frozen
15710 * @param {Object} object
15711 * @param {String} message _optional_
15712 * @namespace Assert
15713 * @api public
15714 */
15715
15716 assert.isFrozen = function (obj, msg) {
15717 new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
15718 };
15719
15720 /**
15721 * ### .isNotFrozen(object)
15722 *
15723 * Asserts that `object` is _not_ frozen.
15724 *
15725 * assert.isNotFrozen({});
15726 *
15727 * @name isNotFrozen
15728 * @alias notFrozen
15729 * @param {Object} object
15730 * @param {String} message _optional_
15731 * @namespace Assert
15732 * @api public
15733 */
15734
15735 assert.isNotFrozen = function (obj, msg) {
15736 new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
15737 };
15738
15739 /**
15740 * ### .isEmpty(target)
15741 *
15742 * Asserts that the target does not contain any values.
15743 * For arrays and strings, it checks the `length` property.
15744 * For `Map` and `Set` instances, it checks the `size` property.
15745 * For non-function objects, it gets the count of own
15746 * enumerable string keys.
15747 *
15748 * assert.isEmpty([]);
15749 * assert.isEmpty('');
15750 * assert.isEmpty(new Map);
15751 * assert.isEmpty({});
15752 *
15753 * @name isEmpty
15754 * @alias empty
15755 * @param {Object|Array|String|Map|Set} target
15756 * @param {String} message _optional_
15757 * @namespace Assert
15758 * @api public
15759 */
15760
15761 assert.isEmpty = function(val, msg) {
15762 new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
15763 };
15764
15765 /**
15766 * ### .isNotEmpty(target)
15767 *
15768 * Asserts that the target contains values.
15769 * For arrays and strings, it checks the `length` property.
15770 * For `Map` and `Set` instances, it checks the `size` property.
15771 * For non-function objects, it gets the count of own
15772 * enumerable string keys.
15773 *
15774 * assert.isNotEmpty([1, 2]);
15775 * assert.isNotEmpty('34');
15776 * assert.isNotEmpty(new Set([5, 6]));
15777 * assert.isNotEmpty({ key: 7 });
15778 *
15779 * @name isNotEmpty
15780 * @alias notEmpty
15781 * @param {Object|Array|String|Map|Set} target
15782 * @param {String} message _optional_
15783 * @namespace Assert
15784 * @api public
15785 */
15786
15787 assert.isNotEmpty = function(val, msg) {
15788 new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
15789 };
15790
15791 /*!
15792 * Aliases.
15793 */
15794
15795 (function alias(name, as){
15796 assert[as] = assert[name];
15797 return alias;
15798 })
15799 ('isOk', 'ok')
15800 ('isNotOk', 'notOk')
15801 ('throws', 'throw')
15802 ('throws', 'Throw')
15803 ('isExtensible', 'extensible')
15804 ('isNotExtensible', 'notExtensible')
15805 ('isSealed', 'sealed')
15806 ('isNotSealed', 'notSealed')
15807 ('isFrozen', 'frozen')
15808 ('isNotFrozen', 'notFrozen')
15809 ('isEmpty', 'empty')
15810 ('isNotEmpty', 'notEmpty');
15811};
15812
15813var chai = createCommonjsModule(function (module, exports) {
15814/*!
15815 * chai
15816 * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
15817 * MIT Licensed
15818 */
15819
15820var used = [];
15821
15822/*!
15823 * Chai version
15824 */
15825
15826exports.version = '4.1.2';
15827
15828/*!
15829 * Assertion Error
15830 */
15831
15832exports.AssertionError = assertionError;
15833
15834/*!
15835 * Utils for plugins (not exported)
15836 */
15837
15838
15839
15840/**
15841 * # .use(function)
15842 *
15843 * Provides a way to extend the internals of Chai.
15844 *
15845 * @param {Function}
15846 * @returns {this} for chaining
15847 * @api public
15848 */
15849
15850exports.use = function (fn) {
15851 if (!~used.indexOf(fn)) {
15852 fn(exports, utils);
15853 used.push(fn);
15854 }
15855
15856 return exports;
15857};
15858
15859/*!
15860 * Utility Functions
15861 */
15862
15863exports.util = utils;
15864
15865/*!
15866 * Configuration
15867 */
15868
15869
15870exports.config = config;
15871
15872/*!
15873 * Primary `Assertion` prototype
15874 */
15875
15876
15877exports.use(assertion);
15878
15879/*!
15880 * Core Assertions
15881 */
15882
15883
15884exports.use(assertions);
15885
15886/*!
15887 * Expect interface
15888 */
15889
15890
15891exports.use(expect);
15892
15893/*!
15894 * Should interface
15895 */
15896
15897
15898exports.use(should);
15899
15900/*!
15901 * Assert interface
15902 */
15903
15904
15905exports.use(assert);
15906});
15907
15908var chai_1 = chai.version;
15909var chai_2 = chai.AssertionError;
15910var chai_3 = chai.use;
15911var chai_4 = chai.util;
15912var chai_5 = chai.config;
15913
15914var chai$2 = chai;
15915
15916/*
15917 * mocha's bdd syntax is inspired in RSpec
15918 * please read: http://betterspecs.org/
15919 */
15920var expect$3 = chai$2.expect;
15921
15922describe('jsondiffpatch', function () {
15923 before(function () {});
15924 it('has a diff method', function () {
15925 expect$3(diff).to.be.a('function');
15926 });
15927});
15928
15929var DiffPatcher$1 = DiffPatcher;
15930
15931var isArray$1$1 = typeof Array.isArray === 'function' ? Array.isArray : function (a) {
15932 return (typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object' && a instanceof Array;
15933};
15934
15935var valueDescription = function valueDescription(value) {
15936 if (value === null) {
15937 return 'null';
15938 }
15939 if (typeof value === 'boolean') {
15940 return value.toString();
15941 }
15942 if (value instanceof Date) {
15943 return 'Date';
15944 }
15945 if (value instanceof RegExp) {
15946 return 'RegExp';
15947 }
15948 if (isArray$1$1(value)) {
15949 return 'array';
15950 }
15951 if (typeof value === 'string') {
15952 if (value.length >= 60) {
15953 return 'large text';
15954 }
15955 }
15956 return typeof value === 'undefined' ? 'undefined' : _typeof(value);
15957};
15958
15959// Object.keys polyfill
15960var objectKeys = typeof Object.keys === 'function' ? function (obj) {
15961 return Object.keys(obj);
15962} : function (obj) {
15963 var keys = [];
15964 for (var key in obj) {
15965 if (Object.prototype.hasOwnProperty.call(obj, key)) {
15966 keys.push(key);
15967 }
15968 }
15969 return keys;
15970};
15971
15972// Array.prototype.forEach polyfill
15973var arrayForEach = typeof Array.prototype.forEach === 'function' ? function (array, fn) {
15974 return array.forEach(fn);
15975} : function (array, fn) {
15976 for (var index$$1 = 0, length = array.length; index$$1 < length; index$$1++) {
15977 fn(array[index$$1], index$$1, array);
15978 }
15979};
15980
15981describe('DiffPatcher', function () {
15982 arrayForEach(objectKeys(examples), function (groupName) {
15983 var group = examples[groupName];
15984 describe(groupName, function () {
15985 arrayForEach(group, function (example) {
15986 if (!example) {
15987 return;
15988 }
15989 var name = example.name || valueDescription(example.left) + ' -> ' + valueDescription(example.right);
15990 describe(name, function () {
15991 before(function () {
15992 this.instance = new DiffPatcher$1(example.options);
15993 });
15994 if (example.error) {
15995 it('diff should fail with: ' + example.error, function () {
15996 var instance = this.instance;
15997 expect$3(function () {
15998 instance.diff(example.left, example.right);
15999 }).to.throw(example.error);
16000 });
16001 return;
16002 }
16003 it('can diff', function () {
16004 var delta = this.instance.diff(example.left, example.right);
16005 expect$3(delta).to.deep.equal(example.delta);
16006 });
16007 it('can diff backwards', function () {
16008 var reverse$$1 = this.instance.diff(example.right, example.left);
16009 expect$3(reverse$$1).to.deep.equal(example.reverse);
16010 });
16011 if (!example.noPatch) {
16012 it('can patch', function () {
16013 var right = this.instance.patch(clone$1(example.left), example.delta);
16014 expect$3(right).to.deep.equal(example.right);
16015 });
16016 it('can reverse delta', function () {
16017 var reverse$$1 = this.instance.reverse(example.delta);
16018 if (example.exactReverse !== false) {
16019 expect$3(reverse$$1).to.deep.equal(example.reverse);
16020 } else {
16021 // reversed delta and the swapped-diff delta are
16022 // not always equal, to verify they're equivalent,
16023 // patch and compare the results
16024 expect$3(this.instance.patch(clone$1(example.right), reverse$$1)).to.deep.equal(example.left);
16025 reverse$$1 = this.instance.diff(example.right, example.left);
16026 expect$3(this.instance.patch(clone$1(example.right), reverse$$1)).to.deep.equal(example.left);
16027 }
16028 });
16029 it('can unpatch', function () {
16030 var left = this.instance.unpatch(clone$1(example.right), example.delta);
16031 expect$3(left).to.deep.equal(example.left);
16032 });
16033 }
16034 });
16035 });
16036 });
16037 });
16038
16039 describe('.clone', function () {
16040 it('clones complex objects', function () {
16041 var obj = {
16042 name: 'a string',
16043 nested: {
16044 attributes: [{ name: 'one', value: 345, since: new Date(1934, 1, 1) }],
16045 another: 'property',
16046 enabled: true,
16047 nested2: {
16048 name: 'another string'
16049 }
16050 }
16051 };
16052 var cloned = clone$1(obj);
16053 expect$3(cloned).to.deep.equal(obj);
16054 });
16055 it('clones RegExp', function () {
16056 var obj = {
16057 pattern: /expr/gim
16058 };
16059 var cloned = clone$1(obj);
16060 expect$3(cloned).to.deep.equal({
16061 pattern: /expr/gim
16062 });
16063 });
16064 });
16065
16066 describe('using cloneDiffValues', function () {
16067 before(function () {
16068 this.instance = new DiffPatcher$1({
16069 cloneDiffValues: true
16070 });
16071 });
16072 it("ensures deltas don't reference original objects", function () {
16073 var left = {
16074 oldProp: {
16075 value: 3
16076 }
16077 };
16078 var right = {
16079 newProp: {
16080 value: 5
16081 }
16082 };
16083 var delta = this.instance.diff(left, right);
16084 left.oldProp.value = 1;
16085 right.newProp.value = 8;
16086 expect$3(delta).to.deep.equal({
16087 oldProp: [{ value: 3 }, 0, 0],
16088 newProp: [{ value: 5 }]
16089 });
16090 });
16091 });
16092
16093 describe('static shortcuts', function () {
16094 it('diff', function () {
16095 var delta = diff(4, 5);
16096 expect$3(delta).to.deep.equal([4, 5]);
16097 });
16098 it('patch', function () {
16099 var right = patch(4, [4, 5]);
16100 expect$3(right).to.eql(5);
16101 });
16102 it('unpatch', function () {
16103 var left = unpatch(5, [4, 5]);
16104 expect$3(left).to.eql(4);
16105 });
16106 it('reverse', function () {
16107 var reverseDelta = reverse([4, 5]);
16108 expect$3(reverseDelta).to.deep.equal([5, 4]);
16109 });
16110 });
16111
16112 describe('plugins', function () {
16113 before(function () {
16114 this.instance = new DiffPatcher$1();
16115 });
16116
16117 describe('getting pipe filter list', function () {
16118 it('returns builtin filters', function () {
16119 expect$3(this.instance.processor.pipes.diff.list()).to.deep.equal(['collectChildren', 'trivial', 'dates', 'texts', 'objects', 'arrays']);
16120 });
16121 });
16122
16123 describe('supporting numeric deltas', function () {
16124 var NUMERIC_DIFFERENCE = -8;
16125
16126 it('diff', function () {
16127 // a constant to identify the custom delta type
16128 function numericDiffFilter(context) {
16129 if (typeof context.left === 'number' && typeof context.right === 'number') {
16130 // store number delta, eg. useful for distributed counters
16131 context.setResult([0, context.right - context.left, NUMERIC_DIFFERENCE]).exit();
16132 }
16133 }
16134 // a filterName is useful if I want to allow other filters to
16135 // be inserted before/after this one
16136 numericDiffFilter.filterName = 'numeric';
16137
16138 // insert new filter, right before trivial one
16139 this.instance.processor.pipes.diff.before('trivial', numericDiffFilter);
16140
16141 var delta = this.instance.diff({ population: 400 }, { population: 403 });
16142 expect$3(delta).to.deep.equal({ population: [0, 3, NUMERIC_DIFFERENCE] });
16143 });
16144
16145 it('patch', function () {
16146 function numericPatchFilter(context) {
16147 if (context.delta && Array.isArray(context.delta) && context.delta[2] === NUMERIC_DIFFERENCE) {
16148 context.setResult(context.left + context.delta[1]).exit();
16149 }
16150 }
16151 numericPatchFilter.filterName = 'numeric';
16152 this.instance.processor.pipes.patch.before('trivial', numericPatchFilter);
16153
16154 var delta = { population: [0, 3, NUMERIC_DIFFERENCE] };
16155 var right = this.instance.patch({ population: 600 }, delta);
16156 expect$3(right).to.deep.equal({ population: 603 });
16157 });
16158
16159 it('unpatch', function () {
16160 function numericReverseFilter(context) {
16161 if (context.nested) {
16162 return;
16163 }
16164 if (context.delta && Array.isArray(context.delta) && context.delta[2] === NUMERIC_DIFFERENCE) {
16165 context.setResult([0, -context.delta[1], NUMERIC_DIFFERENCE]).exit();
16166 }
16167 }
16168 numericReverseFilter.filterName = 'numeric';
16169 this.instance.processor.pipes.reverse.after('trivial', numericReverseFilter);
16170
16171 var delta = { population: [0, 3, NUMERIC_DIFFERENCE] };
16172 var reverseDelta = this.instance.reverse(delta);
16173 expect$3(reverseDelta).to.deep.equal({
16174 population: [0, -3, NUMERIC_DIFFERENCE]
16175 });
16176 var right = { population: 703 };
16177 this.instance.unpatch(right, delta);
16178 expect$3(right).to.deep.equal({ population: 700 });
16179 });
16180 });
16181
16182 describe('removing and replacing pipe filters', function () {
16183 it('removes specified filter', function () {
16184 expect$3(this.instance.processor.pipes.diff.list()).to.deep.equal(['collectChildren', 'numeric', 'trivial', 'dates', 'texts', 'objects', 'arrays']);
16185 this.instance.processor.pipes.diff.remove('dates');
16186 expect$3(this.instance.processor.pipes.diff.list()).to.deep.equal(['collectChildren', 'numeric', 'trivial', 'texts', 'objects', 'arrays']);
16187 });
16188
16189 it('replaces specified filter', function () {
16190 function fooFilter(context) {
16191 context.setResult(['foo']).exit();
16192 }
16193 fooFilter.filterName = 'foo';
16194 expect$3(this.instance.processor.pipes.diff.list()).to.deep.equal(['collectChildren', 'numeric', 'trivial', 'texts', 'objects', 'arrays']);
16195 this.instance.processor.pipes.diff.replace('trivial', fooFilter);
16196 expect$3(this.instance.processor.pipes.diff.list()).to.deep.equal(['collectChildren', 'numeric', 'foo', 'texts', 'objects', 'arrays']);
16197 });
16198 });
16199 });
16200
16201 describe('formatters', function () {
16202 describe('jsonpatch', function () {
16203 var instance = void 0;
16204 var formatter = void 0;
16205
16206 before(function () {
16207 instance = new DiffPatcher$1();
16208 formatter = index.jsonpatch;
16209 });
16210
16211 var expectFormat = function expectFormat(before, after, expected) {
16212 var diff$$1 = instance.diff(before, after);
16213 var format = formatter.format(diff$$1);
16214 expect$3(format).to.be.eql(expected);
16215 };
16216
16217 var removeOp = function removeOp(path) {
16218 return {
16219 op: 'remove',
16220 path: path
16221 };
16222 };
16223
16224 var addOp = function addOp(path, value) {
16225 return {
16226 op: 'add',
16227 path: path,
16228 value: value
16229 };
16230 };
16231
16232 var replaceOp = function replaceOp(path, value) {
16233 return {
16234 op: 'replace',
16235 path: path,
16236 value: value
16237 };
16238 };
16239
16240 it('should return empty format for empty diff', function () {
16241 expectFormat([], [], []);
16242 });
16243
16244 it('should format an add operation for array insertion', function () {
16245 expectFormat([1, 2, 3], [1, 2, 3, 4], [addOp('/3', 4)]);
16246 });
16247
16248 it('should format an add operation for object insertion', function () {
16249 expectFormat({ a: 'a', b: 'b' }, { a: 'a', b: 'b', c: 'c' }, [addOp('/c', 'c')]);
16250 });
16251
16252 it('should format for deletion of array', function () {
16253 expectFormat([1, 2, 3, 4], [1, 2, 3], [removeOp('/3')]);
16254 });
16255
16256 it('should format for deletion of object', function () {
16257 expectFormat({ a: 'a', b: 'b', c: 'c' }, { a: 'a', b: 'b' }, [removeOp('/c')]);
16258 });
16259
16260 it('should format for replace of object', function () {
16261 expectFormat({ a: 'a', b: 'b' }, { a: 'a', b: 'c' }, [replaceOp('/b', 'c')]);
16262 });
16263
16264 it('should put add/remove for array with primitive items', function () {
16265 expectFormat([1, 2, 3], [1, 2, 4], [removeOp('/2'), addOp('/2', 4)]);
16266 });
16267
16268 it('should sort remove by desc order', function () {
16269 expectFormat([1, 2, 3], [1], [removeOp('/2'), removeOp('/1')]);
16270 });
16271
16272 describe('patcher with comparator', function () {
16273 before(function () {
16274 instance = new DiffPatcher$1({
16275 objectHash: function objectHash(obj) {
16276 if (obj && obj.id) {
16277 return obj.id;
16278 }
16279 }
16280 });
16281 });
16282
16283 var anObjectWithId = function anObjectWithId(id) {
16284 return {
16285 id: id
16286 };
16287 };
16288
16289 it('should remove higher level first', function () {
16290 var before = [anObjectWithId('removed'), {
16291 id: 'remaining_outer',
16292 items: [anObjectWithId('removed_inner'), anObjectWithId('remaining_inner')]
16293 }];
16294 var after = [{
16295 id: 'remaining_outer',
16296 items: [anObjectWithId('remaining_inner')]
16297 }];
16298 var expectedDiff = [removeOp('/0'), removeOp('/0/items/0')];
16299 expectFormat(before, after, expectedDiff);
16300 });
16301 });
16302
16303 it('should annotate as moved op', function () {
16304 expectFormat([1, 2], [2, 1], [{ op: 'move', from: '/1', path: '/0' }]);
16305 });
16306 });
16307
16308 describe('html', function () {
16309 var instance = void 0;
16310 var formatter = void 0;
16311
16312 before(function () {
16313 instance = new DiffPatcher$1({ textDiff: { minLength: 10 } });
16314 formatter = index.html;
16315 });
16316
16317 var expectFormat = function expectFormat(before, after, expected) {
16318 var diff$$1 = instance.diff(before, after);
16319 var format = formatter.format(diff$$1);
16320 expect$3(format).to.be.eql(expected);
16321 };
16322
16323 var expectedHtml = function expectedHtml(expectedDiff) {
16324 var html = [];
16325 arrayForEach(expectedDiff, function (diff$$1) {
16326 html.push('<li>');
16327 html.push('<div class="jsondiffpatch-textdiff-location">');
16328 html.push('<span class="jsondiffpatch-textdiff-line-number">' + diff$$1.start + '</span>');
16329 html.push('<span class="jsondiffpatch-textdiff-char">' + diff$$1.length + '</span>');
16330 html.push('</div>');
16331 html.push('<div class="jsondiffpatch-textdiff-line">');
16332
16333 arrayForEach(diff$$1.data, function (data) {
16334 html.push('<span class="jsondiffpatch-textdiff-' + data.type + '">' + data.text + '</span>');
16335 });
16336
16337 html.push('</div>');
16338 html.push('</li>');
16339 });
16340 return '<div class="jsondiffpatch-delta jsondiffpatch-textdiff">' + '<div class="jsondiffpatch-value">' + '<ul class="jsondiffpatch-textdiff">' + (html.join('') + '</ul></div></div>');
16341 };
16342
16343 it('should format Chinese', function () {
16344 var before = '喵星人最可爱最可爱最可爱喵星人最可爱最可爱最可爱';
16345 var after = '汪星人最可爱最可爱最可爱喵星人meow最可爱最可爱最可爱';
16346 var expectedDiff = [{
16347 start: 1,
16348 length: 17,
16349 data: [{
16350 type: 'deleted',
16351 text: '喵'
16352 }, {
16353 type: 'added',
16354 text: '汪'
16355 }, {
16356 type: 'context',
16357 text: '星人最可爱最可爱最可爱喵星人最可'
16358 }]
16359 }, {
16360 start: 8,
16361 length: 16,
16362 data: [{
16363 type: 'context',
16364 text: '可爱最可爱喵星人'
16365 }, {
16366 type: 'added',
16367 text: 'meow'
16368 }, {
16369 type: 'context',
16370 text: '最可爱最可爱最可'
16371 }]
16372 }];
16373 expectFormat(before, after, expectedHtml(expectedDiff));
16374 });
16375
16376 it('should format Japanese', function () {
16377 var before = '猫が可愛いです猫が可愛いです';
16378 var after = '猫がmeow可愛いですいぬ可愛いです';
16379 var expectedDiff = [{
16380 start: 1,
16381 length: 13,
16382 data: [{
16383 type: 'context',
16384 text: '猫が'
16385 }, {
16386 type: 'added',
16387 text: 'meow'
16388 }, {
16389 type: 'context',
16390 text: '可愛いです'
16391 }, {
16392 type: 'deleted',
16393 text: '猫が'
16394 }, {
16395 type: 'added',
16396 text: 'いぬ'
16397 }, {
16398 type: 'context',
16399 text: '可愛いで'
16400 }]
16401 }];
16402 expectFormat(before, after, expectedHtml(expectedDiff));
16403 });
16404 });
16405 });
16406});
16407
16408})));
16409//# sourceMappingURL=jsondiffpatch.umd.test.js.map