Comparing version 1.1.0 to 2.0.0
15
index.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
function ghGot(path, opts, cb) { | ||
function ghGot(path, opts) { | ||
if (!path) { | ||
@@ -11,11 +11,6 @@ throw new Error('path required'); | ||
if (typeof opts === 'function') { | ||
cb = opts; | ||
opts = {}; | ||
} | ||
opts = objectAssign({json: true}, opts); | ||
opts.headers = objectAssign({ | ||
accept: 'application/vnd.github.v3+json', | ||
'accept': 'application/vnd.github.v3+json', | ||
'user-agent': 'https://github.com/sindresorhus/gh-got' | ||
@@ -39,3 +34,3 @@ }, opts.headers); | ||
return got(url, opts, cb); | ||
return got(url, opts); | ||
} | ||
@@ -51,4 +46,4 @@ | ||
].forEach(function (el) { | ||
ghGot[el] = function (url, opts, cb) { | ||
return ghGot(url, objectAssign({}, opts, {method: el.toUpperCase()}), cb); | ||
ghGot[el] = function (url, opts) { | ||
return ghGot(url, objectAssign({}, opts, {method: el.toUpperCase()})); | ||
}; | ||
@@ -55,0 +50,0 @@ }); |
{ | ||
"name": "gh-got", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Convenience wrapper for `got` to interact with the GitHub API", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "node test.js" | ||
"test": "xo && ava" | ||
}, | ||
@@ -37,8 +37,9 @@ "files": [ | ||
"dependencies": { | ||
"got": "^3.2.0", | ||
"object-assign": "^2.0.0" | ||
"got": "^4.1.1", | ||
"object-assign": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "0.0.4" | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
@@ -22,11 +22,11 @@ # gh-got [![Build Status](https://travis-ci.org/sindresorhus/gh-got.svg?branch=master)](https://travis-ci.org/sindresorhus/gh-got) | ||
got('https://api.github.com/users/sindresorhus', { | ||
json: true | ||
json: true, | ||
headers: { | ||
'accept': 'application/vnd.github.v3+json', | ||
'authorization': 'token ' + token; | ||
'authorization': 'token ' + token | ||
} | ||
}, function (err, data) { | ||
console.log(data.login); | ||
}).then(function (res) { | ||
console.log(res.body.login); | ||
//=> 'sindresorhus' | ||
}); | ||
}) | ||
``` | ||
@@ -39,6 +39,6 @@ | ||
ghGot('users/sindresorhus', {token: 'foo'}, function (err, data) { | ||
console.log(data.login); | ||
ghGot('users/sindresorhus', {token: 'foo'}).then(function (res) { | ||
console.log(res.body.login); | ||
//=> 'sindresorhus' | ||
}); | ||
}) | ||
``` | ||
@@ -57,3 +57,3 @@ | ||
Can be overriden globally with the `GITHUB_TOKEN` environment variable. | ||
Can be overridden globally with the `GITHUB_TOKEN` environment variable. | ||
@@ -67,3 +67,3 @@ ### endpoint | ||
Can be overriden globally with the `GITHUB_ENDPOINT` environment variable. | ||
Can be overridden globally with the `GITHUB_ENDPOINT` environment variable. | ||
@@ -70,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4269
2
38
+ Addedcapture-stack-trace@1.0.2(transitive)
+ Addedcreate-error-class@2.0.1(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedgot@4.2.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-plain-obj@1.1.0(transitive)
+ Addednode-status-codes@1.0.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpinkie@1.0.0(transitive)
+ Addedpinkie-promise@1.0.0(transitive)
+ Addedunzip-response@1.0.2(transitive)
- Removedgot@3.3.1(transitive)
- Removedinfinity-agent@2.0.3(transitive)
- Removednested-error-stacks@1.0.2(transitive)
- Removedobject-assign@2.1.1(transitive)
Updatedgot@^4.1.1
Updatedobject-assign@^4.0.1