fix: remove spread-operator usage to support Node 4

This commit is contained in:
zkochan
2017-01-20 01:59:34 +02:00
committed by Zoltan Kochan
parent d6f5c68cfd
commit 6345c19f95
2 changed files with 6 additions and 6 deletions

View File

@@ -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<Shrinkwrap | null> {

View File

@@ -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)