add path-to-regexp definition.

This commit is contained in:
kiri 2015-03-16 03:26:24 +09:00
parent 95d860879f
commit 84a60d89c5
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,16 @@
/// <reference path='path-to-regexp.d.ts' />
import pathToRegexp = require('path-to-regexp');
var keys: string[] = [];
var re = pathToRegexp('/foo/:bar', keys);
re = pathToRegexp('/foo/:bar', keys, {
sensitive: true,
strict: false,
end: true
});
re = pathToRegexp('/foo/:bar', keys, {
sensitive: true
});

20
path-to-regexp/path-to-regexp.d.ts vendored Normal file
View File

@ -0,0 +1,20 @@
// Type definitions for path-to-regexp v1.0.3
// Project: https://github.com/pillarjs/path-to-regexp
// Definitions by: xica <https://github.com/xica>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "path-to-regexp" {
function pathToRegexp(path: string, keys: string[], options?: pathToRegexp.Options): RegExp;
module pathToRegexp {
interface Options {
sensitive?: boolean;
strict?: boolean;
end?: boolean;
}
}
export = pathToRegexp;
}