Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix: use assign instead of deprecated merge
Browse files Browse the repository at this point in the history
  • Loading branch information
wagenet authored and alexlafroscia committed Sep 11, 2018
1 parent 3bcd571 commit 22f63a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions addon/mixins/ajax-request.ts
Expand Up @@ -3,7 +3,7 @@ import EmberError from '@ember/error';
import Mixin from '@ember/object/mixin';
import { get } from '@ember/object';
import { isEmpty } from '@ember/utils';
import { merge } from '@ember/polyfills';
import { assign } from '@ember/polyfills';
import { run } from '@ember/runloop';
import { warn, runInDebug } from '@ember/debug';
import Ember from 'ember';
Expand Down Expand Up @@ -434,16 +434,15 @@ export default Mixin.create({
*/
_getFullHeadersHash(headers?: Headers): Headers {
const classHeaders = get(this, 'headers');
const _headers = merge({}, classHeaders);
return merge(_headers, headers);
return assign({}, classHeaders, headers);
},

/**
* Created a normalized set of options from the per-request and
* service-level settings
*/
options(url: string, options: AJAXOptions = {}): AJAXOptions {
options = merge({}, options);
options = assign({}, options);
options.url = this._buildURL(url, options);
options.type = options.type || 'GET';
options.dataType = options.dataType || 'json';
Expand Down
4 changes: 2 additions & 2 deletions addon/mixins/legacy/normalize-error-response.ts
@@ -1,7 +1,7 @@
import Mixin from '@ember/object/mixin';
import { isArray } from '@ember/array';
import { isNone } from '@ember/utils';
import { merge } from '@ember/polyfills';
import { assign } from '@ember/polyfills';

import isString from '../../-private/utils/is-string';
import { Headers } from '../../-private/types';
Expand Down Expand Up @@ -83,7 +83,7 @@ export default Mixin.create({
if (isJsonApiErrorResponse(payload)) {
return payload.errors.map(function(error) {
if (isObject(error)) {
const ret = merge({}, error);
const ret = assign({}, error);
ret.status = `${error.status}`;
return ret;
} else {
Expand Down
6 changes: 3 additions & 3 deletions tests/helpers/start-app.js
@@ -1,12 +1,12 @@
import Application from '../../app';
import config from '../../config/environment';
import { merge } from '@ember/polyfills';
import { assign } from '@ember/polyfills';
import { run } from '@ember/runloop';

export default function startApp(attrs) {
let attributes = merge({}, config.APP);
let attributes = assign({}, config.APP);
attributes.autoboot = true;
attributes = merge(attributes, attrs); // use defaults, but you can override;
attributes = assign(attributes, attrs); // use defaults, but you can override;

return run(() => {
let application = Application.create(attributes);
Expand Down

0 comments on commit 22f63a0

Please sign in to comment.