Giter Site home page Giter Site logo

andriichyzh / node-shortlink Goto Github PK

View Code? Open in Web Editor NEW
9.0 0.0 1.0 559 KB

Simple generation, encoding and decoding short links library for Node.js

Home Page: http://andreychizh.github.com/node-shortlink/

License: MIT License

JavaScript 100.00%

node-shortlink's Introduction

node-shortlink Build Status

Simple generation, encoding and decoding short links library for Node.js.

What?

Short links makes it easier for users to recall and share the locations of important documents and web sites.

This library is used by default Base58 encoding and can represent numeric values with fewer characters and easy understandable view.

Alphabet

base58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'

Installation

npm install shortlink --save

Usage

var shortlink = require('shortlink');

shortlink.generate(8);         // Random string of 8 characters, e.g. 'PJWn4T42'  
shortlink.encode(8515010570);  // 'dYrDZ5'
shortlink.decode('dYrDZ5');    // 8515010570

Running Tests

To run the test suite first invoke the following command within the repo, installing the development dependencies:

npm install

then run the tests:

npm test

Package manager page

NPM

Direct link to the package

License

Released under the MIT license. Copyright (c) 2013 Andrey Chizh.

node-shortlink's People

Contributors

andriichyzh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jmjmjmjmjm666

node-shortlink's Issues

Rename decode and encode methods.

If I understand correctly, string with URL is a source, and number is a result of URL encoding, therefore the name of method, which encode string to number as 'decode' is little confusing.
The same with method 'encode' - it decodes numeric representation of URL to string.
That's why I propose rename 'encode' to 'decode' and vice versa.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.