Skip to content

Commit ea54edb

Browse files
authored
fix: replace extendObject utility w/ object spread (#7372)
1 parent c725249 commit ea54edb

File tree

7 files changed

+13
-100
lines changed

7 files changed

+13
-100
lines changed

src/lib/core/datetime/native-date-adapter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
*/
88

99
import {Inject, Injectable, Optional} from '@angular/core';
10-
import {extendObject} from '../util/object-extend';
1110
import {DateAdapter, MAT_DATE_LOCALE} from './date-adapter';
1211

13-
1412
// TODO(mmalerba): Remove when we no longer support safari 9.
1513
/** Whether the browser supports the Intl API. */
1614
const SUPPORTS_INTL_API = typeof Intl != 'undefined';
@@ -186,7 +184,7 @@ export class NativeDateAdapter extends DateAdapter<Date> {
186184
date = new Date(Date.UTC(
187185
date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(),
188186
date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
189-
displayFormat = extendObject({}, displayFormat, {timeZone: 'utc'});
187+
displayFormat = {...displayFormat, timeZone: 'utc'};
190188
}
191189
let dtf = new Intl.DateTimeFormat(this.locale, displayFormat);
192190
return this._stripDirectionalityCharacters(dtf.format(date));

src/lib/core/public-api.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export * from './placeholder/placeholder-options';
1818
export * from './ripple/index';
1919
export * from './selection/index';
2020
export * from './style/index';
21-
export * from './util/object-extend';
22-
2321

2422
// TODO: don't have this
2523
export * from './testing/month-constants';

src/lib/core/util/object-extend.spec.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/lib/core/util/object-extend.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/lib/dialog/dialog.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
import {Directionality} from '@angular/cdk/bidi';
910
import {ESCAPE} from '@angular/cdk/keycodes';
1011
import {
1112
BlockScrollStrategy,
1213
Overlay,
13-
OverlayRef,
1414
OverlayConfig,
15+
OverlayRef,
1516
ScrollStrategy,
1617
} from '@angular/cdk/overlay';
1718
import {ComponentPortal, ComponentType, PortalInjector, TemplatePortal} from '@angular/cdk/portal';
18-
import {filter} from 'rxjs/operators/filter';
19-
import {startWith} from 'rxjs/operators/startWith';
2019
import {Location} from '@angular/common';
2120
import {
2221
ComponentRef,
@@ -28,15 +27,15 @@ import {
2827
SkipSelf,
2928
TemplateRef,
3029
} from '@angular/core';
31-
import {extendObject} from '@angular/material/core';
32-
import {Directionality} from '@angular/cdk/bidi';
3330
import {Observable} from 'rxjs/Observable';
3431
import {defer} from 'rxjs/observable/defer';
32+
import {of as observableOf} from 'rxjs/observable/of';
33+
import {filter} from 'rxjs/operators/filter';
34+
import {startWith} from 'rxjs/operators/startWith';
3535
import {Subject} from 'rxjs/Subject';
3636
import {MatDialogConfig} from './dialog-config';
3737
import {MatDialogContainer} from './dialog-container';
3838
import {MatDialogRef} from './dialog-ref';
39-
import {of as observableOf} from 'rxjs/observable/of';
4039

4140

4241
export const MAT_DIALOG_DATA = new InjectionToken<any>('MatDialogData');
@@ -313,5 +312,5 @@ export class MatDialog {
313312
* @returns The new configuration object.
314313
*/
315314
function _applyConfigDefaults(config?: MatDialogConfig): MatDialogConfig {
316-
return extendObject(new MatDialogConfig(), config);
315+
return {...new MatDialogConfig(), ...config};
317316
}

src/lib/snack-bar/snack-bar.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77
*/
88

99
import {LiveAnnouncer} from '@angular/cdk/a11y';
10+
import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';
1011
import {Overlay, OverlayConfig, OverlayRef} from '@angular/cdk/overlay';
1112
import {ComponentPortal, ComponentType, PortalInjector} from '@angular/cdk/portal';
1213
import {ComponentRef, Injectable, Injector, Optional, SkipSelf} from '@angular/core';
13-
import {extendObject} from '@angular/material/core';
14+
import {first} from 'rxjs/operators/first';
15+
import {takeUntil} from 'rxjs/operators/takeUntil';
1416
import {SimpleSnackBar} from './simple-snack-bar';
1517
import {MAT_SNACK_BAR_DATA, MatSnackBarConfig} from './snack-bar-config';
1618
import {MatSnackBarContainer} from './snack-bar-container';
1719
import {MatSnackBarRef} from './snack-bar-ref';
18-
import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';
19-
import {takeUntil} from 'rxjs/operators/takeUntil';
20-
import {first} from 'rxjs/operators/first';
2120

2221

2322
/**
@@ -224,5 +223,5 @@ export class MatSnackBar {
224223
* @returns The new configuration object with defaults applied.
225224
*/
226225
function _applyConfigDefaults(config?: MatSnackBarConfig): MatSnackBarConfig {
227-
return extendObject(new MatSnackBarConfig(), config);
226+
return {...new MatSnackBarConfig(), ...config};
228227
}

tslint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
["fit"],
7676
["fdescribe"],
7777
["xit"],
78-
["xdescribe"]
78+
["xdescribe"],
79+
{"name": "Object.assign", "message": "Use the spread operator instead."}
7980
],
8081
// Disallows importing the whole RxJS library. Submodules can be still imported.
8182
"import-blacklist": [true, "rxjs", "rxjs/operators"],

0 commit comments

Comments
 (0)