diff --git a/shortid/shortid-tests.ts b/shortid/shortid-tests.ts new file mode 100644 index 0000000000..31ee0df1d1 --- /dev/null +++ b/shortid/shortid-tests.ts @@ -0,0 +1,10 @@ +/// + +import shortid = require('shortid'); + +var my_short_id: string = shortid.generate(); +console.log(my_short_id); + +console.log('Is valid short id? => %s', shortid.isValid(my_short_id)); // => true +console.log('Is valid short id? => %s', shortid.isValid(5)); // => false +console.log('Is valid short id? => %s', shortid.isValid('i have spaces')); // => false diff --git a/shortid/shortid.d.ts b/shortid/shortid.d.ts new file mode 100644 index 0000000000..049e539695 --- /dev/null +++ b/shortid/shortid.d.ts @@ -0,0 +1,12 @@ +// Type definitions for shortid +// Project: https://github.com/dylang/shortid +// Definitions by: Sam Saint-Pettersen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "shortid" { + export function generate(): string; + export function characters(string: string): string; + export function isValid(id: any): boolean; + export function worker(integer: number): void; + export function seed(float: number): void; +}