Socket
Socket
Sign inDemoInstall

gitio2

Package Overview
Dependencies
58
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.1.0

26

index.js

@@ -1,21 +0,5 @@

var request = require('request');
module.exports = function(url, callback) {
request({
url: 'https://git.io/create',
method: 'post',
form: {
'url': url
}
}, function(err, res, body) {
if (err) {
return callback(err);
}
if (res.statusCode < 300 && res.statusCode >= 200) {
callback(null, 'https://git.io/' + body);
} else {
callback(new Error('Git.io ' + res.headers.status));
}
});
};
module.exports = require('util').deprecate(function (url, callback) {
require('gitio')(url).then(function (url) {
callback(null, url)
}, callback)
}, 'gitio2: Deprecated. Use gitio instead.')

6

package.json
{
"name": "gitio2",
"version": "3.0.0",
"version": "3.1.0",
"author": "Félix Saparelli <me@passcod.name>",

@@ -9,3 +9,3 @@ "contributors": {

},
"description": "Wrapper around the git.io URL shortener",
"description": "Deprecated. Use gitio instead.",
"main": "./index",

@@ -23,4 +23,4 @@ "repository": {

"dependencies": {
"request": "^2.22.0"
"gitio": "^2.1.1"
}
}
Git.io 2
========
A simple module to call the [git.io url shortener service][0].
Updated to use its newer API.
__This is deprecated.__ The [original module] has been updated and is now
what you should use. This module will live on for backward compatibility
as a wrapper on top of the real module, but you should not trust that it
remains alive forever (and indeed the plan is to yank as soon as downloads
reach an acceptable level).
Install
-------
```bash
$ npm install gitio2
```
Usage
-----
```javascript
var gitio = require('gitio2');
gitio('https://github.com/passcod/node-gitio', console.log);
//=> null, http://git.io/abcde
// ^ error ^ short url
```
[0]: https://github.com/blog/985-git-io-github-url-shortener
[original module]: https://github.com/tanepiper/node-gitio

@@ -1,25 +0,15 @@

var gitio = require('./index');
console.log('(Results may not be in order)')
console.log('Input : Expected output')
var urls = [
["https://github.com/passcod/node-gitio", "https://git.io/AuAj"],
["https://passcod.name", "[Error: Git.io 500 Internal Server Error]"]
];
[
['https://github.com/passcod/node-gitio', 'https://git.io/AuAj'],
['https://passcod.name', 'The url https://passcod.name is not a valid address for git.io']
].map(function(url) {
console.log(url.join(' : '))
return url
}).forEach(function(source) {
require('.')(source[0], function(err, url) {
console.log(source[0], ':', err && err.message || url)
})
})
console.log("Input, Expected output");
urls.forEach(function(url) {
var source = url[0];
var result = url[1];
console.log(source + ', ' + result);
});
console.log("-----");
console.log("(Results may not be in order)");
urls.forEach(function(source) {
gitio(source[0], function(err, url) {
if (err) {
console.log("Got error: ", err);
} else {
console.log("Got URL: ", url);
}
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc