ember-source 5.7.0-alpha.3 → 5.7.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,19 +56,13 @@ function expect(val, message) {
56
56
  if (val === null || val === undefined) throw new Error(message);
57
57
  return val;
58
58
  }
59
- function unreachable() {
60
- let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unreachable';
59
+ function unreachable(message = 'unreachable') {
61
60
  return new Error(message);
62
61
  }
63
62
  function exhausted(value) {
64
63
  throw new Error(`Exhausted ${String(value)}`);
65
64
  }
66
- const tuple = function () {
67
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
68
- args[_key] = arguments[_key];
69
- }
70
- return args;
71
- };
65
+ const tuple = (...args) => args;
72
66
 
73
67
  function isPresent(value) {
74
68
  return value !== null && value !== undefined;
@@ -95,14 +89,12 @@ function arrayToOption(list) {
95
89
  return null;
96
90
  }
97
91
  }
98
- function assertPresentArray(list) {
99
- let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `unexpected empty list`;
92
+ function assertPresentArray(list, message = `unexpected empty list`) {
100
93
  if (!isPresentArray(list)) {
101
94
  throw new Error(message);
102
95
  }
103
96
  }
104
- function asPresentArray(list) {
105
- let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `unexpected empty list`;
97
+ function asPresentArray(list, message = `unexpected empty list`) {
106
98
  assertPresentArray(list, message);
107
99
  return list;
108
100
  }
@@ -135,8 +127,7 @@ function isObject(u) {
135
127
  class StackImpl {
136
128
  stack;
137
129
  current = null;
138
- constructor() {
139
- let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
130
+ constructor(values = []) {
140
131
  this.stack = values;
141
132
  }
142
133
  get size() {
@@ -299,10 +290,7 @@ function isHandle(value) {
299
290
  function isNonPrimitiveHandle(value) {
300
291
  return value > ImmediateConstants.ENCODED_UNDEFINED_HANDLE;
301
292
  }
302
- function constants() {
303
- for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
304
- values[_key] = arguments[_key];
305
- }
293
+ function constants(...values) {
306
294
  return [false, true, null, undefined, ...values];
307
295
  }
308
296
  function isSmallInt(value) {
@@ -392,13 +380,6 @@ function isSerializationFirstNode(node) {
392
380
  }
393
381
 
394
382
  let assign = Object.assign;
395
- function fillNulls(count) {
396
- let arr = new Array(count);
397
- for (let i = 0; i < count; i++) {
398
- arr[i] = null;
399
- }
400
- return arr;
401
- }
402
383
  function values(obj) {
403
384
  return Object.values(obj);
404
385
  }
@@ -484,11 +465,8 @@ function stringCheckNode(node, check) {
484
465
  }
485
466
  }
486
467
 
487
- function strip(strings) {
468
+ function strip(strings, ...args) {
488
469
  let out = '';
489
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
490
- args[_key - 1] = arguments[_key];
491
- }
492
470
  for (const [i, string] of enumerate(strings)) {
493
471
  let dynamic = args[i] !== undefined ? String(args[i]) : '';
494
472
  out += `${string}${dynamic}`;
@@ -581,11 +559,10 @@ const LOCAL_LOGGER = console;
581
559
  * actually appropriate.
582
560
  */
583
561
  const LOGGER = console;
584
- function assertNever(value) {
585
- let desc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'unexpected unreachable branch';
562
+ function assertNever(value, desc = 'unexpected unreachable branch') {
586
563
  LOGGER.log('unreachable', value);
587
564
  LOGGER.log(`${desc} :: ${JSON.stringify(value)} (${value})`);
588
565
  throw new Error(`code reached unreachable`);
589
566
  }
590
567
 
591
- export { COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, EMPTY_ARRAY, EMPTY_NUMBER_ARRAY, EMPTY_STRING_ARRAY, INSERT_AFTER_BEGIN, INSERT_AFTER_END, INSERT_BEFORE_BEGIN, INSERT_BEFORE_END, ImmediateConstants, LOCAL_LOGGER, LOGGER, NS_HTML, NS_MATHML, NS_SVG, NS_XLINK, NS_XML, NS_XMLNS, RAW_NODE, SERIALIZATION_FIRST_NODE_STRING, StackImpl as Stack, TEXT_NODE, arrayToOption, asPresentArray, debugAssert as assert, assertNever, assertPresent, assertPresentArray, assign, beginTestSteps, buildUntouchableThis, castToBrowser, castToSimple, checkBrowserNode as checkNode, clearElement, constants, debugToString$1 as debugToString, decodeHandle, decodeImmediate, decodeNegative, decodePositive, deprecate, dict, emptyArray, encodeHandle, encodeImmediate, encodeNegative, encodePositive, endTestSteps, entries, enumerate, exhausted, expect, extractHandle, fillNulls, getFirst, getLast, ifPresent, intern, isDict, isElement, isEmptyArray, isErrHandle, isHandle, isNonPrimitiveHandle, isObject, isOkHandle, isPresent, isPresentArray, isSerializationFirstNode, isSimpleElement, isSmallInt, keys, logStep, mapPresentArray, reverse, strip, tuple, unreachable, unwrap, unwrapHandle, unwrapTemplate, values, verifySteps };
568
+ export { COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, EMPTY_ARRAY, EMPTY_NUMBER_ARRAY, EMPTY_STRING_ARRAY, INSERT_AFTER_BEGIN, INSERT_AFTER_END, INSERT_BEFORE_BEGIN, INSERT_BEFORE_END, ImmediateConstants, LOCAL_LOGGER, LOGGER, NS_HTML, NS_MATHML, NS_SVG, NS_XLINK, NS_XML, NS_XMLNS, RAW_NODE, SERIALIZATION_FIRST_NODE_STRING, StackImpl as Stack, TEXT_NODE, arrayToOption, asPresentArray, debugAssert as assert, assertNever, assertPresent, assertPresentArray, assign, beginTestSteps, buildUntouchableThis, castToBrowser, castToSimple, checkBrowserNode as checkNode, clearElement, constants, debugToString$1 as debugToString, decodeHandle, decodeImmediate, decodeNegative, decodePositive, deprecate, dict, emptyArray, encodeHandle, encodeImmediate, encodeNegative, encodePositive, endTestSteps, entries, enumerate, exhausted, expect, extractHandle, getFirst, getLast, ifPresent, intern, isDict, isElement, isEmptyArray, isErrHandle, isHandle, isNonPrimitiveHandle, isObject, isOkHandle, isPresent, isPresentArray, isSerializationFirstNode, isSimpleElement, isSmallInt, keys, logStep, mapPresentArray, reverse, strip, tuple, unreachable, unwrap, unwrapHandle, unwrapTemplate, values, verifySteps };
@@ -6,7 +6,6 @@ function indexable(input) {
6
6
  return input;
7
7
  }
8
8
  function getGlobal() {
9
- // eslint-disable-next-line n/no-unsupported-features/es-builtins
10
9
  if (typeof globalThis !== 'undefined') return indexable(globalThis);
11
10
  if (typeof self !== 'undefined') return indexable(self);
12
11
  if (typeof window !== 'undefined') return indexable(window);
@@ -101,8 +100,7 @@ if (DEBUG) {
101
100
  }
102
101
  };
103
102
 
104
- let nthIndex = function (str, pattern, n) {
105
- let startingPos = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
103
+ let nthIndex = (str, pattern, n, startingPos = -1) => {
106
104
  let i = startingPos;
107
105
  while (n-- > 0 && i++ < str.length) {
108
106
  i = str.indexOf(pattern, i);
@@ -127,9 +125,7 @@ if (DEBUG) {
127
125
  }
128
126
  current = current.parent;
129
127
  }
130
-
131
- // TODO: Use String.prototype.repeat here once we can drop support for IE11
132
- return trackingStack.map((label, index) => Array(2 * index + 1).join(' ') + label).join('\n');
128
+ return trackingStack.map((label, index) => ' '.repeat(2 * index) + label).join('\n');
133
129
  };
134
130
  debug.markTagAsConsumed = _tag => {
135
131
  if (!CONSUMED_TAGS || CONSUMED_TAGS.has(_tag)) return;
@@ -282,18 +278,18 @@ class MonomorphicTagImpl {
282
278
  } = this;
283
279
  if (subtag !== null) {
284
280
  if (Array.isArray(subtag)) {
285
- for (const tag of subtag) {
286
- let value = tag[COMPUTE]();
287
- revision = Math.max(value, revision);
288
- }
281
+ revision = subtag.reduce((prev, currentTag) => {
282
+ let current = currentTag[COMPUTE]();
283
+ return current > prev ? current : prev;
284
+ }, revision);
289
285
  } else {
290
286
  let subtagValue = subtag[COMPUTE]();
291
287
  if (subtagValue === this.subtagBufferCache) {
292
- revision = Math.max(revision, this.lastValue);
288
+ revision = revision > this.lastValue ? revision : this.lastValue;
293
289
  } else {
294
290
  // Clear the temporary buffer cache
295
291
  this.subtagBufferCache = null;
296
- revision = Math.max(revision, subtagValue);
292
+ revision = revision > subtagValue ? revision : subtagValue;
297
293
  }
298
294
  }
299
295
  }
@@ -480,9 +476,7 @@ class Tracker {
480
476
  } else if (tags.size === 1) {
481
477
  return this.last;
482
478
  } else {
483
- let tagsArr = [];
484
- tags.forEach(tag => tagsArr.push(tag));
485
- return combine(tagsArr);
479
+ return combine(Array.from(this.tags));
486
480
  }
487
481
  }
488
482
  }