mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Added type defs for balanced-match (#35051)
This commit is contained in:
committed by
Wesley Wigham
parent
088f477d65
commit
d8e0586da4
@@ -0,0 +1,8 @@
|
||||
import Balanced = require("balanced-match");
|
||||
|
||||
const balanced = new Balanced();
|
||||
|
||||
balanced.balanced('{', '}', 'pre{in{nested}}post');
|
||||
balanced.balanced('{', '}', 'pre{first}between{second}post');
|
||||
balanced.balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post');
|
||||
balanced.range('{', '}', 'pre{in{nested}}post');
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for balanced-match 1.0
|
||||
// Project: https://github.com/juliangruber/balanced-match
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Output {
|
||||
/**
|
||||
* The index of the first match of a
|
||||
*/
|
||||
start: number;
|
||||
/**
|
||||
* The index of the matching b
|
||||
*/
|
||||
end: number;
|
||||
/**
|
||||
* The preamble, a and b not included
|
||||
*/
|
||||
pre: string;
|
||||
/**
|
||||
* The match, a and b not included
|
||||
*/
|
||||
body: string;
|
||||
/**
|
||||
* The postscript, a and b not included
|
||||
*/
|
||||
post: string;
|
||||
}
|
||||
|
||||
declare class Balanced {
|
||||
balanced(a: string|RegExp, b: string|RegExp, str: string): Output|void;
|
||||
|
||||
range(a: string|RegExp, b: string|RegExp, str: string): Output|void;
|
||||
}
|
||||
|
||||
export = Balanced;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"balanced-match-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user