Comparing version 3.0.3 to 4.0.0
{ | ||
"name": "bitly", | ||
"description": "A Bit.ly API library for Node.JS", | ||
"license": { | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
}, | ||
"tags": [ | ||
@@ -10,4 +14,8 @@ "url", | ||
], | ||
"version": "3.0.3", | ||
"author": "Tane Piper <piper.tane@gmail.com>", | ||
"version": "4.0.0", | ||
"author": { | ||
"name": "Tane Piper", | ||
"email": "piper.tane@gmail.com", | ||
"url": "https://github.com/tanepiper" | ||
}, | ||
"contributors": [ | ||
@@ -39,17 +47,27 @@ { | ||
"type": "git", | ||
"url": "http://github.com/tanepiper/node-bitly.git" | ||
"url": "https://github.com/tanepiper/node-bitly.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/tanepiper/node-bitly/issues" | ||
}, | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
"node": ">= 0.12.0" | ||
}, | ||
"scripts": { | ||
"test": "VCR_MODE=cache node_modules/.bin/nodeunit test" | ||
"compile": "babel --source-maps --out-dir lib/ src/", | ||
"test": "node_modules/.bin/mocha test/ --recursive --compilers js:babel/register", | ||
"coverage": "node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha -- --compilers js:babel/register --colors --reporter dot test/", | ||
"prepublish": "npm run compile" | ||
}, | ||
"devDependencies": { | ||
"nodeunit": "^0.9.1", | ||
"babel": "^5.8.29", | ||
"chai": "^3.4.0", | ||
"istanbul": "^0.4.0", | ||
"mocha": "^2.3.3", | ||
"sepia": "^2.0.1" | ||
}, | ||
"dependencies": { | ||
"q": "^1.4.1" | ||
} | ||
"valid-url": "^1.0.9" | ||
}, | ||
"main": "lib/bitly.js" | ||
} |
@@ -1,3 +0,2 @@ | ||
node-bitly - Bitly API for nodejs | ||
==================== | ||
# node-bitly - Bitly API for nodejs | ||
@@ -11,4 +10,12 @@ [![Build Status](https://secure.travis-ci.org/tanepiper/node-bitly.png)](http://travis-ci.org/tanepiper/node-bitly) | ||
Installation | ||
------------ | ||
### **** Important update from Version 4 onwards **** | ||
From version 4.0 of this library, the callback in methods have been removed and the library only provides | ||
promises for each method response. The library has also been re-written in ES2015/ES6. The transpiled version | ||
is only distributed via NPM, or can be created the command `npm run compile` if you fork the source. Finally | ||
support is no longer provided for `node < 0.12`. | ||
## Installation | ||
To install via NPM type the following: `npm install bitly` | ||
@@ -18,29 +25,33 @@ | ||
Usage | ||
----- | ||
## Usage | ||
This library uses the API provided by bitly and requires an OAuth token to use. | ||
To get your access token, visit https://bitly.com/a/oauth_apps (under Generic Access Token) | ||
See http://dev.bitly.com/ for format of returned objects from the API | ||
#### Code | ||
```js | ||
var Bitly = require('bitly'); | ||
var bitly = new Bitly('<YOUR ACCESS TOKEN>'); | ||
// To get your access token, visit https://bitly.com/a/oauth_apps (under Generic Access Token) | ||
// For ES2015/ES6 | ||
/** | ||
* With callback | ||
*/ | ||
bitly.shorten('https://github.com/tanepiper/node-bitly', function(err, response) { | ||
if (err) throw err; | ||
import Bitly from 'bitly'; | ||
// See http://dev.bitly.com/ for format of returned object | ||
var short_url = response.data.url | ||
let bitly = new Bitly('<YOUR ACCESS TOKEN>'); | ||
// Do something with data | ||
bitly.shorten('http://nodejs.org', (response) => { | ||
console.log(response); | ||
}, (error) => { | ||
console.log(error); | ||
}); | ||
/** | ||
* With promise | ||
*/ | ||
// For ES5 | ||
var Bitly = require('bitly'); | ||
var bitly = new Bitly('<YOUR ACCESS TOKEN>'); | ||
bitly.shorten('https://github.com/tanepiper/node-bitly') | ||
.then(function(response) { | ||
// See http://dev.bitly.com/ for format of returned object | ||
var short_url = response.data.url | ||
// Do something with data | ||
@@ -52,8 +63,7 @@ }, function(error) { | ||
Tests | ||
----- | ||
To run tests type `npm test` | ||
## Tests | ||
To run tests type `npm test`. For coverage type `npm run coverage` | ||
Bit.ly Features | ||
--------------- | ||
### Bit.ly Features | ||
This module is limited to the following API methods: | ||
@@ -60,0 +70,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
502396
33
936
0
78
5
2
+ Addedvalid-url@^1.0.9
+ Addedvalid-url@1.0.9(transitive)
- Removedq@^1.4.1
- Removedq@1.5.1(transitive)