Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
feat: normalize NAME API (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias authored and daviddias committed Jan 5, 2018
1 parent 1b10821 commit 9b8ef48
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/name/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

const promisify = require('promisify-es6')

const transform = function (res, callback) {
callback(null, {
name: res.Name,
value: res.Value
})
}

module.exports = (send) => {
return promisify((args, opts, callback) => {
if (typeof (opts) === 'function') {
callback = opts
opts = {}
}
send({

send.andTransform({
path: 'name/publish',
args: args,
qs: opts
}, callback)
}, transform, callback)
})
}
9 changes: 7 additions & 2 deletions src/name/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

const promisify = require('promisify-es6')

const transform = function (res, callback) {
callback(null, res.Path)
}

module.exports = (send) => {
return promisify((args, opts, callback) => {
if (typeof (opts) === 'function') {
callback = opts
opts = {}
}
send({

send.andTransform({
path: 'name/resolve',
args: args,
qs: opts
}, callback)
}, transform, callback)
})
}

0 comments on commit 9b8ef48

Please sign in to comment.