@types/braces
Advanced tools
Comparing version 2.3.0 to 3.0.0
@@ -1,47 +0,44 @@ | ||
// Type definitions for braces 2.3 | ||
// Type definitions for braces 3.0 | ||
// Project: https://github.com/micromatch/braces | ||
// Definitions by: vemoo <https://github.com/vemoo> | ||
// mrmlnc <https://github.com/mrmlnc> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
declare namespace braces { | ||
type Transform = (str: string) => string; | ||
interface Options { | ||
/** | ||
* Generate an "expanded" brace pattern (this option is unncessary with the `.expand` method, which does the same thing). | ||
* Limit the length of the input string. Useful when the input string is generated or your application allows | ||
* users to pass a string, et cetera. | ||
* | ||
* ```js | ||
* console.log(braces('a/{b,c}/d', {expand: true})); | ||
* //=> [ 'a/b/d', 'a/c/d' ] | ||
* ``` | ||
* @default 65536 | ||
* @example | ||
* console.log(braces('a/{b,c}/d', { maxLength: 3 })); | ||
* //=> throws an error | ||
*/ | ||
maxLength?: number; | ||
/** | ||
* Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method). | ||
* | ||
* @default undefined | ||
* @example | ||
* console.log(braces('a/{b,c}/d', { expand: true })); | ||
* //=> [ 'a/b/d', 'a/c/d' ] | ||
*/ | ||
expand?: boolean; | ||
/** | ||
* Enabled by default. | ||
* Remove duplicates from the returned array. | ||
* | ||
* ```js | ||
* console.log(braces('a/{b,c}/d')); | ||
* //=> [ 'a/(b|c)/d' ] | ||
* ``` | ||
* | ||
* @default true | ||
* @default undefined | ||
*/ | ||
optimize?: boolean; | ||
/** | ||
* Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options | ||
* | ||
* @default true | ||
*/ | ||
nodupes?: boolean; | ||
/** | ||
* When `braces.expand()` is used, or `options.expand` is true, brace patterns will automatically be [optimized](#optionsoptimize) | ||
* when the difference between the range minimum and range maximum exceeds the `rangeLimit`. | ||
* This is to prevent huge ranges from freezing your application. | ||
* To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` | ||
* is used or `options.expand` is true and the generated range will exceed the `rangeLimit`. | ||
* | ||
* You can set this to any number, or change `options.rangeLimit` to `Inifinity` to disable this altogether. | ||
* You can customize `options.rangeLimit` or set it to `Infinity` to disable this altogether. | ||
* | ||
* @default 250 | ||
* | ||
* @default 1000 | ||
* @example | ||
* ```js | ||
* // pattern exceeds the "rangeLimit", so it's optimized automatically | ||
@@ -53,4 +50,3 @@ * console.log(braces.expand('{1..1000}')); | ||
* console.log(braces.expand('{1..100}')); | ||
* //=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11' ... '89', 90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100'] | ||
* ``` | ||
* //=> ['1', '2', '3', '4', '5', …, '100'] | ||
*/ | ||
@@ -61,7 +57,6 @@ rangeLimit?: number; | ||
* | ||
* ```js | ||
* var range = braces.expand('x{a..e}y', { | ||
* transform: function(str) { | ||
* return 'foo' + str; | ||
* } | ||
* @default undefined | ||
* @example | ||
* const range = braces.expand('x{a..e}y', { | ||
* transform: (str) => `foo/${str}` | ||
* }); | ||
@@ -71,9 +66,7 @@ * | ||
* //=> [ 'xfooay', 'xfooby', 'xfoocy', 'xfoody', 'xfooey' ] | ||
* ``` | ||
* | ||
* @default undefined | ||
*/ | ||
transform?: (str: string) => string; | ||
transform?: Transform; | ||
/** | ||
* In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. | ||
* In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. | ||
* For example, `a{1,3}` will match the letter `a` one to three times. | ||
* | ||
@@ -86,6 +79,4 @@ * Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) | ||
* @default undefined | ||
* | ||
* @example | ||
* ```js | ||
* var braces = require('braces'); | ||
* const braces = require('braces'); | ||
* console.log(braces('a/b{1,3}/{x,y,z}')); | ||
@@ -97,3 +88,2 @@ * //=> [ 'a/b(1|3)/(x|y|z)' ] | ||
* //=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ] | ||
* ``` | ||
*/ | ||
@@ -100,0 +90,0 @@ quantifiers?: boolean; |
{ | ||
"name": "@types/braces", | ||
"version": "2.3.0", | ||
"version": "3.0.0", | ||
"description": "TypeScript definitions for braces", | ||
@@ -11,13 +11,20 @@ "license": "MIT", | ||
"githubUsername": "vemoo" | ||
}, | ||
{ | ||
"name": "mrmlnc", | ||
"url": "https://github.com/mrmlnc", | ||
"githubUsername": "mrmlnc" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/braces" | ||
}, | ||
"scripts": {}, | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "731b40a14e044056151ec4cd17873a4c2ccc16093a4456ad716d748542c34410", | ||
"typesPublisherContentHash": "5c1c8c7c174410ae2f4dff3d4e48a2957d9f7fa90b64dc73987141d7f4e97116", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -5,9 +5,9 @@ # Installation | ||
# Summary | ||
This package contains type definitions for braces (https://github.com/micromatch/braces). | ||
This package contains type definitions for braces ( https://github.com/micromatch/braces ). | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/braces | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/braces | ||
Additional Details | ||
* Last updated: Thu, 21 Dec 2017 23:29:46 GMT | ||
* Last updated: Mon, 22 Apr 2019 22:01:49 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: braces | ||
# Credits | ||
These definitions were written by vemoo <https://github.com/vemoo>. | ||
These definitions were written by vemoo <https://github.com/vemoo>, mrmlnc <https://github.com/mrmlnc>. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6336
98