You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
350 B
JavaScript

"use strict";
const Promise = require("bluebird");
const bhttp = require("bhttp");
module.exports = function shortenUrl(targetUrl) {
return Promise.try(() => {
return bhttp.get(`https://is.gd/create.php?format=simple&url=${encodeURIComponent(targetUrl)}`);
}).then((response) => {
return response.body.toString();
});
};