mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
add path-to-regexp definition.
This commit is contained in:
16
path-to-regexp/path-to-regexp-tests.ts
Normal file
16
path-to-regexp/path-to-regexp-tests.ts
Normal 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
20
path-to-regexp/path-to-regexp.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user