1.0.4 • Published 5 years ago

linkstrip v1.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

Linkstrip

A small library for generating shorter links

Using the https://linkst.rip/ API

Install

$ npm i linkstrip

Usage

// frontend
import { Linkstrip } from "linkstrip";
// backend
import { NodeLinkstrip as Linkstrip } from "linkstrip";
// const Linkstrip = require("linkstrip").NodeLinkstrip;

let ls = new Linkstrip("https://linkst.rip/", "linkstrip");
ls.getLinkAsync()
  .then(link => console.log(link))
  .catch(e => console.log(e));

The Linkstrip constructor can take up to 2 arguments, the url and the slug for the link to be generated, respectively. There are three methods on the Linkstrip class:

Linkstrip.setUrl(:string) sets the url for the link to be generated.

Linkstrip.setSlug(:string) sets a custom slug for the linkst.rip url. Slugs must be between 5 and 100 characters, and may only contain a-z, 0-9, -_.~

Linkstrip.getLinkAsync() sends the url and slug info to the linkst.rip API, and returns a link if everything is acceptable. If not, an error will be thrown.

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago