dist/ember.prod.js in ember-source-2.17.0.beta.6 vs dist/ember.prod.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 @@ -9993,17 +9993,14 @@ for (i = 0; i < length - 2; 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); } }; @@ -25563,52 +25560,27 @@ @static @private */ - // 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 // Ember.onerror setter var dispatchOverride = void 0; - // dispatch error - // allows testing adapter to override dispatch - 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 @@ -28764,17 +28736,10 @@ return onerror; }; exports.setOnerror = function (handler) { onerror = handler; }; - exports.dispatchError = function (error) { - if (dispatchOverride) { - dispatchOverride(error); - } else { - defaultDispatch(error); - } - }; exports.setDispatchOverride = function (handler) { dispatchOverride = handler; }; exports.getDispatchOverride = function () { return dispatchOverride; @@ -34727,11 +34692,11 @@ @public */ function (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 @@ -34776,11 +34741,11 @@ */ ; exports.max = function (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 @@ -34825,11 +34790,11 @@ */ ; exports.min = function (dependentKey) { return reduceMacro(dependentKey, function (min, item) { return Math.min(min, item); - }, Infinity); + }, Infinity, 'min'); } /** Returns an array mapped via the callback @@ -34899,11 +34864,12 @@ @param {String} propertyKey @return {Ember.ComputedProperty} an array mapped to the specified key @public */ function (dependentKey, propertyKey) { - false && !(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'); + false && !(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'); + false && !!/[\[\]\{\}]/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); }); } @@ -34999,12 +34965,13 @@ @param {*} value @return {Ember.ComputedProperty} the filtered array @public */ function (dependentKey, propertyKey, value) { - var callback = void 0; + false && !!/[\[\]\{\}]/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 { @@ -35080,10 +35047,12 @@ @return {Ember.ComputedProperty} computes a new array with all the unique elements from the dependent array @public */ function (dependentKey, propertyKey) { + false && !!/[\[\]\{\}]/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)) { @@ -35199,11 +35168,11 @@ return false; } } return true; - }); + }, 'intersect'); return (0, _native_array.A)(results); }); } @@ -35240,11 +35209,12 @@ dependent array @public */ ; exports.setDiff = function (setAProperty, setBProperty) { - false && !(arguments.length === 2) && (0, _emberDebug.assert)('Ember.computed.setDiff requires exactly two dependent arrays.', arguments.length === 2); + false && !(arguments.length === 2) && (0, _emberDebug.assert)('\`Ember.computed.setDiff\` requires exactly two dependent arrays.', arguments.length === 2); + false && !(!/[\[\]\{\}]/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); @@ -35312,11 +35282,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 @@ -35383,11 +35353,11 @@ on the sort property array or callback function @public */ ; exports.sort = function (itemsKey, sortDefinition) { - false && !(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); + false && !(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 { return propertySort(itemsKey, sortDefinition); @@ -35395,11 +35365,13 @@ }; /** @module @ember/object */ - function reduceMacro(dependentKey, callback, initialValue) { + function reduceMacro(dependentKey, callback, initialValue, name) { + false && !!/[\[\]\{\}]/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; } @@ -35424,16 +35396,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) { + false && !_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 () { @@ -35471,11 +35451,11 @@ }); } }); return uniq; - }); + }, 'uniq'); }exports.union = uniq; function customSort(itemsKey, comparator) { return arrayMacro(itemsKey, function (value) { @@ -35897,13 +35877,20 @@ }); _rsvp.on('error', onerrorDefault); function onerrorDefault(reason) { - var error = errorFor(reason); + var error = errorFor(reason), + overrideDispatch; if (error) { - (0, _emberMetal.dispatchError)(error); + overrideDispatch = (0, _emberMetal.getDispatchOverride)(); + + if (overrideDispatch) { + overrideDispatch(error); + } else { + throw error; + } } } function errorFor(reason) { if (!reason) return; @@ -44506,10 +44493,10 @@ */ }); enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.17.0-beta.6"; + exports.default = "2.17.0"; }); enifed('node-module', ['exports'], function(_exports) { var IS_NODE = typeof module === 'object' && typeof module.require === 'function'; if (IS_NODE) { _exports.require = module.require;