Skip to content

Commit f542e39

Browse files
committed
refactor: use ES6 construct instead of object-assign
BREAKING CHANGE: `object-assign` dependency is replaced by `tslib`
1 parent 1f9f800 commit f542e39

4 files changed

Lines changed: 6 additions & 11 deletions

File tree

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"es6-promise": "4.2.4",
1919
"form-data": "2.3.2",
2020
"isomorphic-fetch": "2.2.1",
21-
"object-assign": "4.1.1",
21+
"tslib": "1.9.2",
2222
"workfront-api-constants": "2.0.0"
2323
},
2424
"devDependencies": {
@@ -47,7 +47,6 @@
4747
"semver": "5.5.0",
4848
"should": "13.2.1",
4949
"ts-loader": "4.3.1",
50-
"tslib": "1.9.2",
5150
"tslint": "5.10.0",
5251
"tslint-config-prettier": "1.13.0",
5352
"tslint-loader": "3.6.0",

src/Api.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import * as NodeFormData from 'form-data'
2323
import 'isomorphic-fetch'
24-
import * as objectAssign from 'object-assign'
2524
import {Readable} from 'stream'
2625
import {INTERNAL_PREFIX} from 'workfront-api-constants'
2726

@@ -261,7 +260,7 @@ export class Api {
261260
params.action = action
262261
}
263262
if (actionArgs) {
264-
params = objectAssign(params, actionArgs)
263+
params = {...params, ...actionArgs}
265264
}
266265
return this.request(endPoint, params, null, Api.Methods.POST)
267266
}
@@ -415,11 +414,11 @@ export class Api {
415414
fields?: TFields,
416415
method: string = Api.Methods.GET
417416
): Promise<any> {
418-
const clonedParams = objectAssign({}, params)
417+
const clonedParams = {...params}
419418

420419
const alwaysUseGet = this._httpOptions.alwaysUseGet
421420

422-
const options = objectAssign({}, this._httpOptions)
421+
const options = {...this._httpOptions}
423422
if (alwaysUseGet && path !== 'login') {
424423
clonedParams.method = method
425424
options.method = Api.Methods.GET
@@ -512,7 +511,7 @@ export class Api {
512511
search(objCode: string, query?: object, fields?: TFields, useHttpPost = false) {
513512
let searchQuery, method
514513
if (useHttpPost) {
515-
searchQuery = objectAssign({}, query, {method: Api.Methods.GET})
514+
searchQuery = {...query, method: Api.Methods.GET}
516515
method = Api.Methods.POST
517516
} else {
518517
searchQuery = query

tslint.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
"member-access": false,
77
"no-string-literal": false,
88
"no-var-requires": false,
9-
"object-literal-key-quotes": [
10-
true,
11-
"as-needed"
12-
],
139
"object-literal-shorthand": false,
1410
"object-literal-sort-keys": false,
1511
"one-variable-per-declaration": false,

webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
entry: {
88
'./dist/workfront': './src/Api.ts'
99
},
10+
mode: 'development',
1011
output: {
1112
path: __dirname,
1213
filename: '[name].js',

0 commit comments

Comments
 (0)