Comparing version 6.0.0 to 6.0.1-beta.871
@@ -12,3 +12,3 @@ { | ||
"homepage": "https://github.com/tanepiper/node-bitly", | ||
"version": "6.0.0", | ||
"version": "6.0.1-beta.871", | ||
"author": { | ||
@@ -73,2 +73,3 @@ "name": "Tane Piper", | ||
}, | ||
"typings": "./global.d.ts", | ||
"dependencies": { | ||
@@ -75,0 +76,0 @@ "request": "^2.87.0", |
@@ -28,13 +28,24 @@ # node-bitly - Bitly API for nodejs | ||
### Code | ||
#### TypeScript / ES6 Imports | ||
```js | ||
import { BitlyClient } from 'bitly'; | ||
const bitly = new BitlyClient('<accessToken>', {}); | ||
try { | ||
return await bitly.shorten(uri); | ||
} catch(e) { | ||
throw e; | ||
async function init() { | ||
let result; | ||
try { | ||
result = await bitly.shorten('https://github.com/tanepiper/node-bitly'); | ||
} catch (e) { | ||
throw e; | ||
} | ||
return result; | ||
} | ||
init(); | ||
``` | ||
#### JavaScript | ||
```js | ||
@@ -44,8 +55,9 @@ const { BitlyClient } = require('bitly'); | ||
let result; | ||
try { | ||
const data = await bitly.shorten(uri); | ||
result = await bitly.shorten(uri); | ||
} catch(e) { | ||
throw e; | ||
} | ||
return data; | ||
return result; | ||
``` | ||
@@ -57,14 +69,15 @@ | ||
const BitlyClient = require('bitly'); | ||
const bitly = BitlyClient('<accessToken>'); | ||
const bitly = new BitlyClient('<accessToken>'); | ||
bitly.shorten('https://github.com/tanepiper/node-bitly') | ||
.then(function(result) { | ||
console.log(result); | ||
}) | ||
.catch(function(error) { | ||
console.error(error); | ||
}); | ||
bitly | ||
.shorten('https://github.com/tanepiper/node-bitly') | ||
.then(function(result) { | ||
console.log(result); | ||
}) | ||
.catch(function(error) { | ||
console.error(error); | ||
}); | ||
``` | ||
You can also do raw requests to any Bitly endpoint. With this you need to pass the access | ||
You can also do raw requests to any Bitly endpoint. With this you need to pass the access | ||
token to the method | ||
@@ -89,2 +102,2 @@ | ||
To run tests type `npm test`. Please note one test will fail if you use your own API key, please update the string accordingly. | ||
To run tests type `npm test`. Please note one test will fail if you use your own API key, please update the string accordingly. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
421985
0
100
2