Skip to content

Commit

Permalink
fix(refactor): use arrow function
Browse files Browse the repository at this point in the history
  • Loading branch information
watilde committed Aug 4, 2017
1 parent f9433c2 commit 88f67cb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/install/installer/dat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const Dat = require('dat-node')

module.exports = (pkg, cwd) => {
return new Promise((resolve, reject) => {
Dat(cwd, {key: pkg.url, sparse: true}, function (e, dat) {
Dat(cwd, {key: pkg.url, sparse: true}, (e, dat) => {
if (e) return reject(e)
dat.joinNetwork()
dat.archive.readFile('/package.json', function (e, content) {
dat.archive.readFile('/package.json', (e, content) => {
if (e) {
dat.leaveNetwork()
reject(e)
Expand Down
2 changes: 1 addition & 1 deletion lib/install/installer/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (pkg, cwd) => {
}
return new Promise((resolve, reject) => {
const extract = tar.extract(cwd, {strip: 1})
extract.on('finish', function () {
extract.on('finish', () => {
resolve()
})
request.get(options)
Expand Down
2 changes: 1 addition & 1 deletion lib/install/installer/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (pkg, cwd) => {
}
return new Promise((resolve, reject) => {
const extract = tar.extract(cwd, {strip: 1})
extract.on('finish', function () {
extract.on('finish', () => {
resolve()
})
request.get(options)
Expand Down
4 changes: 2 additions & 2 deletions lib/install/resolver/fetchers/dat.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const rimraf = require('rimraf')
module.exports = (name, spec, result) => {
const tmp = path.join(os.tmpdir(), encodeURIComponent(spec))
return new Promise((resolve, reject) => {
Dat(tmp, {key: spec, sparse: true}, function (e, dat) {
Dat(tmp, {key: spec, sparse: true}, (e, dat) => {
if (e) return reject(e)
dat.joinNetwork()
dat.archive.readFile('/package.json', function (e, content) {
dat.archive.readFile('/package.json', (e, content) => {
if (e) {
dat.leaveNetwork()
reject(e)
Expand Down
6 changes: 3 additions & 3 deletions lib/install/resolver/fetchers/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ module.exports = (name, spec, result) => {
return new Promise((resolve, reject) => {
const extract = tar.extract()
var data = ''
extract.on('entry', function (header, stream, cb) {
extract.on('entry', (header, stream, cb) => {
const file = header.name.split('/').pop()
stream.on('data', function (chunk) {
stream.on('data', (chunk) => {
if (file === 'package.json') data += chunk
})
stream.on('end', function () {
stream.on('end', () => {
if (data) {
try {
const pkgJSON = JSON.parse(data)
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const prefix = process.platform === 'win32' ? ['-c', 'core.longpaths=true'] : []
module.exports = (cmds, opt) => {
opt = Object.assign({encoding: 'utf8'}, opt)
return new Promise((resolve, reject) => {
which('git', function (e, git) {
which('git', (e, git) => {
if (e) return reject(e)
const args = prefix.concat(cmds)
execFile(git, args, opt, (e, stdout) => {
Expand Down

0 comments on commit 88f67cb

Please sign in to comment.