Gathering detailed insights and metrics for expand-brackets
Gathering detailed insights and metrics for expand-brackets
Gathering detailed insights and metrics for expand-brackets
Gathering detailed insights and metrics for expand-brackets
nanomatch
Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)
@phoenix-plugin-registry/brackets-reverse-emmet
The reverse function of Emmet's "Expand Abbreviation". Returns HTML of selection to abbreviation. Please use from right-click
@devidw/brktfldg
Bracket folding. Collapse and expand all brackets on any website.
@phoenix-plugin-registry/itbaby.brackets-expand-selection-to-quotes
expand selection to quotes.
Expand POSIX bracket expressions (character classes) in glob patterns.
npm install expand-brackets
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
27 Stars
93 Commits
10 Forks
10 Watchers
3 Branches
9 Contributors
Updated on Apr 08, 2024
Latest Version
4.0.0
Package Id
expand-brackets@4.0.0
Size
7.09 kB
NPM Version
5.6.0
Node Version
8.9.4
Published on
Apr 30, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Expand POSIX bracket expressions (character classes) in glob patterns.
Install with npm:
1$ npm install --save expand-brackets
Install with yarn:
1$ yarn add expand-brackets
1var brackets = require('expand-brackets'); 2brackets(string[, options]);
Params
The main export is a function that takes the following parameters:
pattern
{String}: the pattern to convertoptions
{Object}: optionally supply an options objectreturns
{String}: returns a string that can be used to create a regexExample
1console.log(brackets('[![:lower:]]')); 2//=> '[^a-z]'
Parses the given POSIX character class pattern
and returns a
string that can be used for creating regular expressions for matching.
Params
pattern
{String}options
{Object}returns
{Object}Takes an array of strings and a POSIX character class pattern, and returns a new array with only the strings that matched the pattern.
Params
arr
{Array}: Array of strings to matchpattern
{String}: POSIX character class pattern(s)options
{Object}returns
{Array}Example
1const brackets = require('expand-brackets'); 2console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]')); 3//=> ['a'] 4 5console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+')); 6//=> ['a', 'ab']
Returns true if the specified string
matches the given brackets pattern
.
Params
string
{String}: String to matchpattern
{String}: Poxis patternoptions
{String}returns
{Boolean}Example
1const brackets = require('expand-brackets'); 2 3console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]')); 4//=> true 5console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]')); 6//=> false
Takes a POSIX character class pattern and returns a matcher function. The returned function takes the string to match as its only argument.
Params
pattern
{String}: Poxis patternoptions
{String}returns
{Boolean}Example
1const brackets = require('expand-brackets'); 2const isMatch = brackets.matcher('[[:lower:]].[[:upper:]]'); 3 4console.log(isMatch('a.a')); 5//=> false 6console.log(isMatch('a.A')); 7//=> true
Create a regular expression from the given pattern
.
Params
pattern
{String}: The pattern to convert to regex.options
{Object}returns
{RegExp}Example
1const brackets = require('expand-brackets'); 2const re = brackets.makeRe('[[:alpha:]]'); 3console.log(re); 4//=> /^(?:[a-zA-Z])$/
Parses the given POSIX character class pattern
and returns an object with the compiled output
and optional source map
.
Params
pattern
{String}options
{Object}returns
{Object}Example
1const brackets = require('expand-brackets'); 2console.log(brackets('[[:alpha:]]')); 3// { options: { source: 'string' }, 4// input: '[[:alpha:]]', 5// state: {}, 6// compilers: 7// { eos: [Function], 8// noop: [Function], 9// bos: [Function], 10// not: [Function], 11// escape: [Function], 12// text: [Function], 13// posix: [Function], 14// bracket: [Function], 15// 'bracket.open': [Function], 16// 'bracket.inner': [Function], 17// 'bracket.literal': [Function], 18// 'bracket.close': [Function] }, 19// output: '[a-zA-Z]', 20// ast: 21// { type: 'root', 22// errors: [], 23// nodes: [ [Object], [Object], [Object] ] }, 24// parsingErrors: [] }
Generate a source map for the given pattern.
Example
1var res = brackets('[:alpha:]', {sourcemap: true}); 2 3console.log(res.map); 4// { version: 3, 5// sources: [ 'brackets' ], 6// names: [], 7// mappings: 'AAAA,MAAS', 8// sourcesContent: [ '[:alpha:]' ] }
The following named POSIX bracket expressions are supported:
[:alnum:]
: Alphanumeric characters (a-zA-Z0-9]
)[:alpha:]
: Alphabetic characters (a-zA-Z]
)[:blank:]
: Space and tab ([ t]
)[:digit:]
: Digits ([0-9]
)[:lower:]
: Lowercase letters ([a-z]
)[:punct:]
: Punctuation and symbols. ([!"#$%&'()*+, -./:;<=>?@ [\]^_``{|}~]
)[:upper:]
: Uppercase letters ([A-Z]
)[:word:]
: Word characters (letters, numbers and underscores) ([A-Za-z0-9_]
)[:xdigit:]
: Hexadecimal digits ([A-Fa-f0-9]
)See posix-character-classes for more details.
Not supported
Breaking changes
expand-brackets
need to also use snapdragon 0.12.Breaking changes
expand-brackets
need to also use snapdragon 0.11.Breaking changes
Added features
.create
method to do what the main function did before v2.0.0In addition to performance and matching improvements, the v0.2.0 refactor adds complete POSIX character class support, with the exception of equivalence classes and POSIX.2 collating symbols which are not relevant to node.js usage.
Added features
source map example
1var brackets = require('expand-brackets'); 2var res = brackets('[:alpha:]'); 3console.log(res.map); 4 5{ version: 3, 6 sources: [ 'brackets' ], 7 names: [], 8 mappings: 'AAAA,MAAS', 9 sourcesContent: [ '[:alpha:]' ] }
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Commits | Contributor |
---|---|
69 | jonschlinkert |
13 | danez |
2 | MartinKolarik |
2 | es128 |
1 | doowb |
1 | eush77 |
1 | mjbvz |
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
Jon Schlinkert
Copyright © 2018, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on April 30, 2018.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 1/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More