Skip to content

Commit 8be9c66

Browse files
authored
Merge pull request #7 from Collaborne/pr/typings
Provide TypeScript types
2 parents 1b51b7b + 82eca90 commit 8be9c66

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "2.0.3",
44
"description": "extracts and replaces values and IDs in URLs",
55
"main": "src/UrlValueParser.js",
6+
"types": "url-value-parser.d.ts",
67
"scripts": {
78
"test": "./node_modules/jasme/run.js"
89
},

url-value-parser.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
interface Options {
2+
/** use custom masks instead of built-in */
3+
replaceMasks?: string[]|RegExp[];
4+
/** add your custom masks additionally to the built-in ones */
5+
extraMasks?: string[]|RegExp[];
6+
/* when using built-in masks, count only long enough HEX values, DEFAULT: 7 */
7+
minHexLength?: number;
8+
/* when using built-in masks, count only long enough base64 values, DEFAULT: 66 */
9+
minBase64Length?: number;
10+
}
11+
12+
declare class UrlValueParser {
13+
constructor(options?: Options);
14+
15+
public parsePathValues(path: string): { chunks: string[], valueIndexes: number[]; }
16+
public replacePathValues(path: string, replacement: string): string;
17+
}
18+
19+
export = UrlValueParser;

0 commit comments

Comments
 (0)