From a061f8f1f09e01f85c5fda665424cdc118f5fd77 Mon Sep 17 00:00:00 2001 From: Nathaniel Furniss Date: Tue, 13 Jul 2021 10:55:44 -0700 Subject: [PATCH] Remove deprecated Ember.merge for v4.0 --- packages/@ember/deprecated-features/index.ts | 1 - packages/@ember/polyfills/index.ts | 6 -- packages/@ember/polyfills/lib/merge.ts | 56 ------------------- packages/@ember/polyfills/tests/merge_test.js | 21 ------- packages/ember/index.js | 3 +- packages/ember/tests/reexports_test.js | 1 - tests/docs/expected.js | 1 - 7 files changed, 1 insertion(+), 88 deletions(-) delete mode 100644 packages/@ember/polyfills/lib/merge.ts delete mode 100644 packages/@ember/polyfills/tests/merge_test.js diff --git a/packages/@ember/deprecated-features/index.ts b/packages/@ember/deprecated-features/index.ts index d750d8b3876..ccebdeeb475 100644 --- a/packages/@ember/deprecated-features/index.ts +++ b/packages/@ember/deprecated-features/index.ts @@ -5,7 +5,6 @@ export const SEND_ACTION = !!'3.4.0'; export const EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5'; -export const MERGE = !!'3.6.0-beta.1'; export const ROUTER_EVENTS = !!'4.0.0'; export const COMPONENT_MANAGER_STRING_LOOKUP = !!'3.8.0'; export const JQUERY_INTEGRATION = !!'3.9.0'; diff --git a/packages/@ember/polyfills/index.ts b/packages/@ember/polyfills/index.ts index 25ed10d0302..58f3eed8a65 100644 --- a/packages/@ember/polyfills/index.ts +++ b/packages/@ember/polyfills/index.ts @@ -1,10 +1,4 @@ -import { MERGE } from '@ember/deprecated-features'; -import { default as deprecatedMerge } from './lib/merge'; - -let merge = MERGE ? deprecatedMerge : undefined; - // Export `assignPolyfill` for testing export { default as assign, assign as assignPolyfill } from './lib/assign'; -export { merge }; export const hasPropertyAccessors = true; diff --git a/packages/@ember/polyfills/lib/merge.ts b/packages/@ember/polyfills/lib/merge.ts deleted file mode 100644 index dfd90473a17..00000000000 --- a/packages/@ember/polyfills/lib/merge.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { deprecate } from '@ember/debug'; - -/** - @module @ember/polyfills -*/ - -function merge(original: T, updates: U): T & U; - -/** - Merge the contents of two objects together into the first object. - - ```javascript - import { merge } from '@ember/polyfills'; - - merge({ first: 'Tom' }, { last: 'Dale' }); // { first: 'Tom', last: 'Dale' } - var a = { first: 'Yehuda' }; - var b = { last: 'Katz' }; - merge(a, b); // a == { first: 'Yehuda', last: 'Katz' }, b == { last: 'Katz' } - ``` - - @method merge - @static - @for @ember/polyfills - @param {Object} original The object to merge into - @param {Object} updates The object to copy properties from - @return {Object} - @deprecated - @public -*/ -function merge(original: object, updates: object) { - deprecate('Use of `merge` has been deprecated. Please use `assign` instead.', false, { - id: 'ember-polyfills.deprecate-merge', - until: '4.0.0', - url: 'https://deprecations.emberjs.com/v3.x/#toc_ember-polyfills-deprecate-merge', - for: 'ember-source', - since: { - enabled: '3.6.0-beta.1', - }, - }); - - if (updates === null || typeof updates !== 'object') { - return original; - } - - let props = Object.keys(updates); - let prop; - - for (let i = 0; i < props.length; i++) { - prop = props[i]; - original[prop] = updates[prop]; - } - - return original; -} - -export default merge; diff --git a/packages/@ember/polyfills/tests/merge_test.js b/packages/@ember/polyfills/tests/merge_test.js deleted file mode 100644 index 69ab885f0a0..00000000000 --- a/packages/@ember/polyfills/tests/merge_test.js +++ /dev/null @@ -1,21 +0,0 @@ -import { merge } from '..'; -import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; - -moduleFor( - 'Ember.merge', - class extends AbstractTestCase { - ['@test merging objects'](assert) { - let src1 = { a: 1 }; - let src2 = { b: 2 }; - expectDeprecation(() => { - merge(src1, src2); - }, 'Use of `merge` has been deprecated. Please use `assign` instead.'); - - assert.deepEqual( - src1, - { a: 1, b: 2 }, - 'merge copies values from second source object to first object' - ); - } - } -); diff --git a/packages/ember/index.js b/packages/ember/index.js index f0d1f8cab34..ad54f1167f4 100644 --- a/packages/ember/index.js +++ b/packages/ember/index.js @@ -98,7 +98,7 @@ import Resolver from '@ember/application/globals-resolver'; import ApplicationInstance from '@ember/application/instance'; import Engine from '@ember/engine'; import EngineInstance from '@ember/engine/instance'; -import { assign, merge } from '@ember/polyfills'; +import { assign } from '@ember/polyfills'; import { EMBER_EXTEND_PROTOTYPES, JQUERY_INTEGRATION } from '@ember/deprecated-features'; import { @@ -211,7 +211,6 @@ Ember.EngineInstance = EngineInstance; // ****@ember/polyfills**** Ember.assign = assign; -Ember.merge = merge; // ****@ember/-internals/utils**** Ember.generateGuid = utils.generateGuid; diff --git a/packages/ember/tests/reexports_test.js b/packages/ember/tests/reexports_test.js index 8960a2a1e1a..17a9a1780f5 100644 --- a/packages/ember/tests/reexports_test.js +++ b/packages/ember/tests/reexports_test.js @@ -373,7 +373,6 @@ let allExports = [ // @ember/polyfills ['assign', '@ember/polyfills', 'assign'], ['platform.hasPropertyAccessors', '@ember/polyfills', 'hasPropertyAccessors'], - ['merge', '@ember/polyfills', 'merge'], // @ember/routing/auto-location ['AutoLocation', '@ember/routing/auto-location', 'default'], diff --git a/tests/docs/expected.js b/tests/docs/expected.js index 340eefc7de2..177fe2934b8 100644 --- a/tests/docs/expected.js +++ b/tests/docs/expected.js @@ -366,7 +366,6 @@ module.exports = { 'match', 'matches', 'max', - 'merge', 'mergedProperties', 'meta', 'metadata',