-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ember.assign polyfill uses Object.assign directly
- Loading branch information
Showing
6 changed files
with
10 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// Export `assignPolyfill` for testing | ||
export { default as assign, assign as assignPolyfill } from './lib/assign'; | ||
export { assign } from './lib/assign'; | ||
|
||
export const hasPropertyAccessors = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import { deprecate } from '@ember/debug'; | |
export function assign<T, U>(target: T, source: U): T & U; | ||
export function assign<T, U, V>(target: T, source1: U, source2: V): T & U & V; | ||
export function assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W; | ||
export function assign(target: object, ...sources: any[]): any; | ||
export function assign(target: object, ...sources: object[]): object; | ||
/** | ||
Copy properties from a source object to a target object. Source arguments remain unchanged. | ||
|
@@ -29,7 +29,7 @@ export function assign(target: object, ...sources: any[]): any; | |
@public | ||
@static | ||
*/ | ||
export function assign(target: object) { | ||
export function assign(target: object): object { | ||
deprecate( | ||
'Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead.', | ||
false, | ||
|
@@ -44,26 +44,5 @@ export function assign(target: object) { | |
} | ||
); | ||
|
||
for (let i = 1; i < arguments.length; i++) { | ||
let arg = arguments[i]; | ||
if (!arg) { | ||
continue; | ||
} | ||
|
||
let updates = Object.keys(arg); | ||
|
||
for (let i = 0; i < updates.length; i++) { | ||
let prop = updates[i]; | ||
target[prop] = arg[prop]; | ||
} | ||
} | ||
|
||
return target; | ||
return Object.assign(target, ...arguments); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nlfurniss
Author
Contributor
|
||
} | ||
|
||
// Note: We use the bracket notation so | ||
// that the babel plugin does not | ||
// transform it. | ||
// https://www.npmjs.com/package/babel-plugin-transform-object-assign | ||
const { assign: _assign } = Object; | ||
export default (_assign || assign) as typeof assign; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@nlfurniss just a quick FYI, looks like there was an issue here, but a PR to fix has already landed
#19692