mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-18 12:08:59 +08:00
20 lines
537 B
TypeScript
20 lines
537 B
TypeScript
/// <reference path="hashids.d.ts" />
|
|
|
|
/* require hashids */
|
|
import Hashids = require("hashids");
|
|
|
|
/* creating class object */
|
|
var hashids = new Hashids("this is my salt");
|
|
|
|
/* encoding several numbers into one id */
|
|
var id = hashids.encode(1337, 5, 77, 12345678);
|
|
id = hashids.encode(1337);
|
|
id = hashids.encode(45, 434, 1313, 99);
|
|
|
|
/* decoding that id */
|
|
var numbers = hashids.decode(id);
|
|
numbers.length > 0 ? true : false;
|
|
|
|
hashids = new Hashids("this is my salt", 0, "abcdefgh123456789");
|
|
hashids = new Hashids("this is my salt", 8);
|