mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #4943 from stpettersens/master
Type definitions and tests for node shortid module
This commit is contained in:
10
shortid/shortid-tests.ts
Normal file
10
shortid/shortid-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/// <reference path="shortid.d.ts" />
|
||||
|
||||
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
|
||||
12
shortid/shortid.d.ts
vendored
Normal file
12
shortid/shortid.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for shortid
|
||||
// Project: https://github.com/dylang/shortid
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user