dist/ember.debug.js in ember-source-2.17.0.beta.6 vs dist/ember.debug.js in ember-source-2.17.0

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2017 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 2.17.0-beta.6 + * @version 2.17.0 */ var enifed, requireModule, Ember; var mainContext = this; // Used in ember-environment/lib/global.js @@ -9644,17 +9644,14 @@ for (var i = 0, l = length - 2; i < l; i++) { args[i] = arguments[i + 2]; } } } - var onError = getOnError(this.options); - if (onError) { - try { - return method.apply(target, args); - } catch (error) { - onError(error); - } + if (length === 1) { + return method(); + } else if (length === 2) { + return method.call(target); } else { return method.apply(target, args); } }; @@ -26827,26 +26824,14 @@ function reset() { subscribers.length = 0; cache = {}; } - // To maintain stacktrace consistency across browsers - var getStack = function (error) { - var stack = error.stack; - var message = error.message; - - if (stack && stack.indexOf(message) === -1) { - stack = message + '\n' + stack; - } - - return stack; - }; - var onerror = void 0; var onErrorTarget = { get onerror() { - return dispatchOverride || onerror; + return onerror; } }; // Ember.onerror getter function getOnerror() { @@ -26856,38 +26841,19 @@ function setOnerror(handler) { onerror = handler; } var dispatchOverride = void 0; - // dispatch error - function dispatchError(error) { - if (dispatchOverride) { - dispatchOverride(error); - } else { - defaultDispatch(error); - } - } // allows testing adapter to override dispatch function getDispatchOverride() { return dispatchOverride; } function setDispatchOverride(handler) { dispatchOverride = handler; } - function defaultDispatch(error) { - if (emberDebug.isTesting()) { - throw error; - } - if (onerror) { - onerror(error); - } else { - Logger.error(getStack(error)); - } - } - /** @module @ember/utils */ /** Returns true if the passed value is null or undefined. This avoids errors @@ -30044,11 +30010,10 @@ exports.instrumentationReset = reset; exports.instrumentationSubscribe = subscribe; exports.instrumentationUnsubscribe = unsubscribe; exports.getOnerror = getOnerror; exports.setOnerror = setOnerror; - exports.dispatchError = dispatchError; exports.setDispatchOverride = setDispatchOverride; exports.getDispatchOverride = getDispatchOverride; exports.META_DESC = META_DESC; exports.meta = meta; exports.deleteMeta = deleteMeta; @@ -35665,11 +35630,14 @@ exports.sort = sort; /** @module @ember/object */ - function reduceMacro(dependentKey, callback, initialValue) { + function reduceMacro(dependentKey, callback, initialValue, name) { + (true && !(!/[\[\]\{\}]/g.test(dependentKey)) && (0, _emberDebug.assert)('Dependent key passed to `Ember.computed.' + name + '` shouldn\'t contain brace expanding pattern.', !/[\[\]\{\}]/g.test(dependentKey))); + + var cp = new _emberMetal.ComputedProperty(function () { var arr = (0, _emberMetal.get)(this, dependentKey); if (arr === null || typeof arr !== 'object') { return initialValue; } @@ -35694,16 +35662,24 @@ if ((0, _utils.isArray)(value)) { return (0, _native_array.A)(callback.call(this, value)); } else { return (0, _native_array.A)(); } - }, { dependentKeys: [dependentKey], readOnly: true }); + }, { readOnly: true }); + cp.property(dependentKey); // this forces to expand properties GH #15855 + return cp; } - function multiArrayMacro(_dependentKeys, callback) { + function multiArrayMacro(_dependentKeys, callback, name) { + (true && !(_dependentKeys.every(function (dependentKey) { + return !/[\[\]\{\}]/g.test(dependentKey); + })) && (0, _emberDebug.assert)('Dependent keys passed to `Ember.computed.' + name + '` shouldn\'t contain brace expanding pattern.', _dependentKeys.every(function (dependentKey) { + return !/[\[\]\{\}]/g.test(dependentKey); + }))); + var dependentKeys = _dependentKeys.map(function (key) { return key + '.[]'; }); var cp = new _emberMetal.ComputedProperty(function () { @@ -35726,11 +35702,11 @@ @public */ function sum(dependentKey) { return reduceMacro(dependentKey, function (sum, item) { return sum + item; - }, 0); + }, 0, 'sum'); } /** A computed property that calculates the maximum value in the dependent array. This will return `-Infinity` when the dependent @@ -35774,11 +35750,11 @@ @public */ function max(dependentKey) { return reduceMacro(dependentKey, function (max, item) { return Math.max(max, item); - }, -Infinity); + }, -Infinity, 'max'); } /** A computed property that calculates the minimum value in the dependent array. This will return `Infinity` when the dependent @@ -35822,11 +35798,11 @@ @public */ function min(dependentKey) { return reduceMacro(dependentKey, function (min, item) { return Math.min(min, item); - }, Infinity); + }, Infinity, 'min'); } /** Returns an array mapped via the callback @@ -35898,11 +35874,12 @@ @param {String} propertyKey @return {Ember.ComputedProperty} an array mapped to the specified key @public */ function mapBy(dependentKey, propertyKey) { - (true && !(typeof propertyKey === 'string') && (0, _emberDebug.assert)('Ember.computed.mapBy expects a property string for its second argument, ' + 'perhaps you meant to use "map"', typeof propertyKey === 'string')); + (true && !(typeof propertyKey === 'string') && (0, _emberDebug.assert)('\`Ember.computed.mapBy\` expects a property string for its second argument, ' + 'perhaps you meant to use "map"', typeof propertyKey === 'string')); + (true && !(!/[\[\]\{\}]/g.test(dependentKey)) && (0, _emberDebug.assert)('Dependent key passed to `Ember.computed.mapBy` shouldn\'t contain brace expanding pattern.', !/[\[\]\{\}]/g.test(dependentKey))); return map(dependentKey + '.@each.' + propertyKey, function (item) { return (0, _emberMetal.get)(item, propertyKey); }); @@ -36001,12 +35978,14 @@ @param {*} value @return {Ember.ComputedProperty} the filtered array @public */ function filterBy(dependentKey, propertyKey, value) { - var callback = void 0; + (true && !(!/[\[\]\{\}]/g.test(dependentKey)) && (0, _emberDebug.assert)('Dependent key passed to `Ember.computed.filterBy` shouldn\'t contain brace expanding pattern.', !/[\[\]\{\}]/g.test(dependentKey))); + + var callback = void 0; if (arguments.length === 2) { callback = function (item) { return (0, _emberMetal.get)(item, propertyKey); }; } else { @@ -36069,11 +36048,11 @@ }); } }); return uniq; - }); + }, 'uniq'); } /** A computed property which returns a new array with all the unique elements from an array, with uniqueness determined by specific key. @@ -36103,10 +36082,13 @@ @return {Ember.ComputedProperty} computes a new array with all the unique elements from the dependent array @public */ function uniqBy(dependentKey, propertyKey) { + (true && !(!/[\[\]\{\}]/g.test(dependentKey)) && (0, _emberDebug.assert)('Dependent key passed to `Ember.computed.uniqBy` shouldn\'t contain brace expanding pattern.', !/[\[\]\{\}]/g.test(dependentKey))); + + var cp = new _emberMetal.ComputedProperty(function () { var uniq = (0, _native_array.A)(); var seen = Object.create(null); var list = (0, _emberMetal.get)(this, dependentKey); if ((0, _utils.isArray)(list)) { @@ -36216,11 +36198,11 @@ return false; } } return true; - }); + }, 'intersect'); return (0, _native_array.A)(results); }); } @@ -36256,11 +36238,12 @@ items from the first dependent array that are not in the second dependent array @public */ function setDiff(setAProperty, setBProperty) { - (true && !(arguments.length === 2) && (0, _emberDebug.assert)('Ember.computed.setDiff requires exactly two dependent arrays.', arguments.length === 2)); + (true && !(arguments.length === 2) && (0, _emberDebug.assert)('\`Ember.computed.setDiff\` requires exactly two dependent arrays.', arguments.length === 2)); + (true && !(!/[\[\]\{\}]/g.test(setAProperty) && !/[\[\]\{\}]/g.test(setBProperty)) && (0, _emberDebug.assert)('Dependent keys passed to `Ember.computed.setDiff` shouldn\'t contain brace expanding pattern.', !/[\[\]\{\}]/g.test(setAProperty) && !/[\[\]\{\}]/g.test(setBProperty))); var cp = new _emberMetal.ComputedProperty(function () { var setA = this.get(setAProperty); var setB = this.get(setBProperty); @@ -36326,11 +36309,11 @@ res.push(properties[key]); } } } return res; - }); + }, 'collect'); } /** A computed property which returns a new array with all the properties from the first dependent array sorted based on a property @@ -36396,11 +36379,11 @@ @return {Ember.ComputedProperty} computes a new sorted array based on the sort property array or callback function @public */ function sort(itemsKey, sortDefinition) { - (true && !(arguments.length === 2) && (0, _emberDebug.assert)('Ember.computed.sort requires two arguments: an array key to sort and ' + 'either a sort properties key or sort function', arguments.length === 2)); + (true && !(arguments.length === 2) && (0, _emberDebug.assert)('\`Ember.computed.sort\` requires two arguments: an array key to sort and ' + 'either a sort properties key or sort function', arguments.length === 2)); if (typeof sortDefinition === 'function') { return customSort(itemsKey, sortDefinition); } else { @@ -36831,11 +36814,16 @@ _rsvp.on('error', onerrorDefault); function onerrorDefault(reason) { var error = errorFor(reason); if (error) { - (0, _emberMetal.dispatchError)(error); + var overrideDispatch = (0, _emberMetal.getDispatchOverride)(); + if (overrideDispatch) { + overrideDispatch(error); + } else { + throw error; + } } } function errorFor(reason) { if (!reason) return; @@ -44911,11 +44899,11 @@ return adapter; } function setAdapter(value) { adapter = value; - if (value) { + if (value && typeof value.exception === 'function') { (0, _emberMetal.setDispatchOverride)(adapterDispatch); } else { (0, _emberMetal.setDispatchOverride)(null); } } @@ -48507,10 +48495,10 @@ */ }); enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.17.0-beta.6"; + exports.default = "2.17.0"; }); enifed("handlebars", ["exports"], function (exports) { "use strict"; // File ignored in coverage tests via setting in .istanbul.yml