Gathering detailed insights and metrics for execall2
Gathering detailed insights and metrics for execall2
Gathering detailed insights and metrics for execall2
Gathering detailed insights and metrics for execall2
npm install execall2
Typescript
Module System
Node Version
NPM Version
TypeScript (58.47%)
JavaScript (41.53%)
Total Downloads
42,044
Last Day
18
Last Week
111
Last Month
435
Last Year
6,807
8 Stars
1,670 Commits
1 Forks
2 Watchers
1 Branches
12 Contributors
Updated on Mar 12, 2025
Latest Version
2.0.26
Package Id
execall2@2.0.26
Unpacked Size
22.09 kB
Size
6.74 kB
File Count
10
NPM Version
lerna/6.6.2/node@v22.6.0+x64 (win32)
Node Version
22.6.0
Published on
Aug 24, 2024
Cumulative downloads
Total Downloads
Last Day
100%
18
Compared to previous day
Last Week
65.7%
111
Compared to previous week
Last Month
-19.4%
435
Compared to previous month
Last Year
22.8%
6,807
Compared to previous year
2
Find multiple RegExp matches in a string
Instead of having to iterate over RegExp#exec
, immutable, and with a nicer result format.
1$ npm install execall2
1import execall from 'execall2'; 2import * as execall from 'execall2'; 3import { execall } from 'execall2'; 4import execall = require('execall2'); 5const execall = require('execall2');
1let t = execall(/(?<k>.)/g, '123456789'); 2 3console.dir(t, { 4 colors: true, 5}); 6 7console.log('getOwnPropertyNames', Object.getOwnPropertyNames(t)); 8 9let {re, input} = t; 10 11console.log('== hidden property =='); 12 13console.dir({re, input}, { 14 colors: true, 15}); 16 17console.log('== hidden property symbol =='); 18 19// @ts-ignore 20console.dir([execall.SYMBOL, t[0][execall.SYMBOL] === t], { 21 colors: true, 22}); 23 24console.log('== JSON.stringify =='); 25console.log(JSON.stringify(t));
1[ [ '1', '1', index: 0, groups: { k: '1' }, match: '1', sub: [ '1' ] ], 2 [ '2', '2', index: 1, groups: { k: '2' }, match: '2', sub: [ '2' ] ], 3 [ '3', '3', index: 2, groups: { k: '3' }, match: '3', sub: [ '3' ] ], 4 [ '4', '4', index: 3, groups: { k: '4' }, match: '4', sub: [ '4' ] ], 5 [ '5', '5', index: 4, groups: { k: '5' }, match: '5', sub: [ '5' ] ], 6 [ '6', '6', index: 5, groups: { k: '6' }, match: '6', sub: [ '6' ] ], 7 [ '7', '7', index: 6, groups: { k: '7' }, match: '7', sub: [ '7' ] ], 8 [ '8', '8', index: 7, groups: { k: '8' }, match: '8', sub: [ '8' ] ], 9 [ '9', '9', index: 8, groups: { k: '9' }, match: '9', sub: [ '9' ] ] ] 10getOwnPropertyNames [ '0', '1', '2', '3', '4', '5', '6', '7', '8', 'length', 're', 'input' ] 11== hidden property == 12{ re: /(?<k>.)/g, input: '123456789' } 13== hidden property symbol == 14[ Symbol(execall), true ] 15== JSON.stringify == 16[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"]]
1execall(/(\d+)/g, '$200 and $400'); 2/* 3[ [ '200', 4 '200', 5 index: 1, 6 groups: undefined, 7 match: '200', 8 sub: [ '200' ] ], 9 [ '400', 10 '400', 11 index: 10, 12 groups: undefined, 13 match: '400', 14 sub: [ '400' ] ] ] 15*/
Returns an array of objects with a match, sub-matches, and index.
1declare function execAll<T extends RegExp = RegExp>(inputRegExp: T | RegExp, input: string, options?: IExecAllOptions<T>): IMatches<T>;
Type: regexp
Regular expression to match against the input
.
Type: string
Type: IExecAllOptions
1export interface IExecAllOptions<T extends RegExp = RegExp> 2{ 3 resetLastIndex?: boolean, 4 cloneRegexp?: ICloneRegexp<T>, 5} 6 7export interface ICloneRegexp<T extends RegExp = RegExp> 8{ 9 (inputRegExp: T | RegExp, ...argv): T 10}
MIT © Sindre Sorhus
No vulnerabilities found.