File tree Expand file tree Collapse file tree 4 files changed +6
-38
lines changed Expand file tree Collapse file tree 4 files changed +6
-38
lines changed Original file line number Diff line number Diff line change 1- /**
2- * Assign properties from `props` to `obj`
3- * @template O, P The obj and props types
4- * @param {O } obj The object to copy properties to
5- * @param {P } props The object to copy properties from
6- * @returns {O & P }
7- */
8- export function assign ( obj , props ) {
9- for ( let i in props ) obj [ i ] = props [ i ] ;
10- return /** @type {O & P } */ ( obj ) ;
11- }
1+ export const assign = Object . assign ;
122
133/**
144 * Check if two objects have a different shape
@@ -29,5 +19,6 @@ export function shallowDiffers(a, b) {
2919 * @returns {boolean }
3020 */
3121export function is ( x , y ) {
22+ // TODO: can we replace this with Object.is?
3223 return ( x === y && ( x !== 0 || 1 / x === 1 / y ) ) || ( x !== x && y !== y ) ;
3324}
Original file line number Diff line number Diff line change 1- /**
2- * Assign properties from `props` to `obj`
3- * @template O, P The obj and props types
4- * @param {O } obj The object to copy properties to
5- * @param {P } props The object to copy properties from
6- * @returns {O & P }
7- */
8- export function assign ( obj , props ) {
9- for ( let i in props ) obj [ i ] = props [ i ] ;
10- return /** @type {O & P } */ ( obj ) ;
11- }
1+ export const assign = Object . assign ;
122
133export function isNaN ( value ) {
144 return value !== value ;
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ export function diff(
248248 c . state = c . _nextState ;
249249
250250 if ( c . getChildContext != null ) {
251- globalContext = assign ( assign ( { } , globalContext ) , c . getChildContext ( ) ) ;
251+ globalContext = assign ( { } , globalContext , c . getChildContext ( ) ) ;
252252 }
253253
254254 if ( isClassComponent && ! isNew && c . getSnapshotBeforeUpdate != null ) {
Original file line number Diff line number Diff line change 11import { EMPTY_ARR } from './constants' ;
22
33export const isArray = Array . isArray ;
4-
5- /**
6- * Assign properties from `props` to `obj`
7- * @template O, P The obj and props types
8- * @param {O } obj The object to copy properties to
9- * @param {P } props The object to copy properties from
10- * @returns {O & P }
11- */
12- export function assign ( obj , props ) {
13- // @ts -expect-error We change the type of `obj` to be `O & P`
14- for ( let i in props ) obj [ i ] = props [ i ] ;
15- return /** @type {O & P } */ ( obj ) ;
16- }
4+ export const assign = Object . assign ;
5+ export const slice = EMPTY_ARR . slice ;
176
187/**
198 * Remove a child node from its parent if attached. This is a workaround for
@@ -24,5 +13,3 @@ export function assign(obj, props) {
2413export function removeNode ( node ) {
2514 if ( node && node . parentNode ) node . parentNode . removeChild ( node ) ;
2615}
27-
28- export const slice = EMPTY_ARR . slice ;
You can’t perform that action at this time.
0 commit comments