From 6345c19f9503d82d1d2ff73aaad4754190f82f84 Mon Sep 17 00:00:00 2001 From: zkochan Date: Fri, 20 Jan 2017 01:59:34 +0200 Subject: [PATCH] fix: remove spread-operator usage to support Node 4 --- src/fs/shrinkwrap.ts | 10 +++++----- src/install/fetchResolution.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fs/shrinkwrap.ts b/src/fs/shrinkwrap.ts index f7f723bfee..23abb365ef 100644 --- a/src/fs/shrinkwrap.ts +++ b/src/fs/shrinkwrap.ts @@ -17,23 +17,23 @@ export function lookupResolution(shrinkwrap: Shrinkwrap, dependency: string): Re if (item) { item = item as any as TarballResolution // tslint:disable-line if (item.tarball != null) { - return {...item, type: 'tarball'} as Resolution + return Object.assign({}, item, {type: 'tarball'}) as Resolution } item = item as any as GitRepositoryResolution // tslint:disable-line if (item.repo != null && item.commitId != null) { - return {...item, type: 'git-repo'} as Resolution + return Object.assign({}, item, {type: 'git-repo'}) as Resolution } item = item as any as DirectoryResolution // tslint:disable-line if (item.root != null) { - return {...item, type: 'directory'} as Resolution + return Object.assign({}, item, {type: 'directory'}) as Resolution } } return null } export function putResolution(shrinkwrap: Shrinkwrap, dependency: string, resolution: Resolution) { - let {type, ...item} = resolution - shrinkwrap[dependency] = item as Resolution + shrinkwrap[dependency] = Object.assign({}, resolution) + delete shrinkwrap[dependency].type } export async function read (pkgPath: string): Promise { diff --git a/src/install/fetchResolution.ts b/src/install/fetchResolution.ts index dfb37e5400..5edd99c50e 100644 --- a/src/install/fetchResolution.ts +++ b/src/install/fetchResolution.ts @@ -104,7 +104,7 @@ function execGit (args: string[], opts?: Object) { export function fetchFromTarball (dir: string, dist: PackageDist, opts: FetchOptions) { if (dist.tarball.startsWith('file:')) { - dist = {...dist, tarball: dist.tarball.slice(5)} + dist = Object.assign({}, dist, {tarball: dist.tarball.slice(5)}) return fetchFromLocalTarball(dir, dist) } else { return fetchFromRemoteTarball(dir, dist, opts)