string-matches
Advanced tools
Comparing version 1.1.3 to 2.0.0
@@ -1,8 +0,2 @@ | ||
declare function stringMatches(str: string, regex: RegExp, maxMatches?: number): RegExpExecArray[]; | ||
declare const _default: typeof stringMatches & { | ||
default: typeof stringMatches; | ||
} | ||
declare namespace _default { | ||
export type type = typeof stringMatches; | ||
} | ||
export = _default; | ||
declare const stringMatches: (str: string, regex: RegExp, maxMatches?: number) => RegExpExecArray[]; | ||
export default stringMatches; |
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
/* STRING MATCHES */ | ||
function stringMatches(str, regex, maxMatches) { | ||
if (maxMatches === void 0) { maxMatches = Infinity; } | ||
/* MAIN */ | ||
const stringMatches = (str, regex, maxMatches = Infinity) => { | ||
if (regex.flags.indexOf('g') >= 0) { | ||
var matches = []; | ||
var match = void 0; | ||
const matches = []; | ||
let match; | ||
regex.lastIndex = 0; | ||
@@ -17,10 +15,7 @@ while (match = regex.exec(str)) { | ||
else { | ||
var match = regex.exec(str); | ||
const match = regex.exec(str); | ||
return match ? [match] : []; | ||
} | ||
} | ||
}; | ||
/* EXPORT */ | ||
module.exports = stringMatches; | ||
module.exports.default = stringMatches; | ||
Object.defineProperty(module.exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLG9CQUFvQjs7QUFFcEIsU0FBUyxhQUFhLENBQUcsR0FBVyxFQUFFLEtBQWEsRUFBRSxVQUFxQjtJQUFyQiwyQkFBQSxFQUFBLHFCQUFxQjtJQUV4RSxJQUFLLEtBQUssQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFHLEdBQUcsQ0FBRSxJQUFJLENBQUMsRUFBRztRQUV0QyxJQUFNLE9BQU8sR0FBc0IsRUFBRSxDQUFDO1FBRXRDLElBQUksS0FBSyxTQUFBLENBQUM7UUFFVixLQUFLLENBQUMsU0FBUyxHQUFHLENBQUMsQ0FBQztRQUVwQixPQUFRLEtBQUssR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFHLEdBQUcsQ0FBRSxFQUFHO1lBRW5DLE9BQU8sQ0FBQyxJQUFJLENBQUcsS0FBSyxDQUFFLENBQUM7WUFFdkIsSUFBSyxPQUFPLENBQUMsTUFBTSxLQUFLLFVBQVU7Z0JBQUcsTUFBTTtTQUU1QztRQUVELE9BQU8sT0FBTyxDQUFDO0tBRWhCO1NBQU07UUFFTCxJQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFHLEdBQUcsQ0FBRSxDQUFDO1FBRWpDLE9BQU8sS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUM7S0FFN0I7QUFFSCxDQUFDO0FBRUQsWUFBWTtBQUVaLGtCQUFlLGFBQWEsQ0FBQyJ9 | ||
export default stringMatches; |
{ | ||
"name": "string-matches", | ||
"version": "1.1.3", | ||
"repository": "github:fabiospampinato/string-matches", | ||
"version": "2.0.0", | ||
"description": "Retrieves all the matches of a regex in a string.", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"exports": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"clean:dist": "rimraf dist", | ||
"clean:coverage": "rimraf coverage .nyc_output", | ||
"clean": "npm run clean:dist && npm run clean:coverage", | ||
"compile": "tsc --skipLibCheck && tstei", | ||
"compile:watch": "tsc --skipLibCheck --watch", | ||
"test": "ava", | ||
"test:watch": "ava --watch", | ||
"coverage": "nyc --reporter=html ava", | ||
"report": "nyc report", | ||
"report:html": "open coverage/index.html", | ||
"prepublishOnly": "npm run clean && npm run compile && npm run coverage" | ||
"clean": "tsex clean", | ||
"compile": "tsex compile", | ||
"compile:watch": "tsex compile --watch", | ||
"test": "tsex test", | ||
"test:watch": "tsex test --watch", | ||
"prepublishOnly": "npm run clean && npm run compile && npm run test" | ||
}, | ||
"ava": { | ||
"files": [ | ||
"test/index.js" | ||
] | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/fabiospampinato/string-matches/issues" | ||
}, | ||
"license": "MIT", | ||
"author": { | ||
"name": "Fabio Spampinato", | ||
"email": "spampinabio@gmail.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/fabiospampinato/string-matches.git" | ||
}, | ||
"keywords": [], | ||
"dependencies": {}, | ||
"keywords": [ | ||
"string", | ||
"matches" | ||
], | ||
"devDependencies": { | ||
"ava": "^0.18.2", | ||
"ava-spec": "^1.1.0", | ||
"nyc": "^10.1.2", | ||
"rimraf": "^2.6.0", | ||
"typescript": "~3.0.3", | ||
"typescript-transform-export-interop": "^1.0.0" | ||
"fava": "^0.0.6", | ||
"tsex": "^1.1.2", | ||
"typescript": "^4.6.4" | ||
} | ||
} |
/* STRING MATCHES */ | ||
/* MAIN */ | ||
function stringMatches ( str: string, regex: RegExp, maxMatches = Infinity ): RegExpExecArray[] { | ||
const stringMatches = ( str: string, regex: RegExp, maxMatches = Infinity ): RegExpExecArray[] => { | ||
@@ -32,3 +32,3 @@ if ( regex.flags.indexOf ( 'g' ) >= 0 ) { | ||
} | ||
}; | ||
@@ -35,0 +35,0 @@ /* EXPORT */ |
/* IMPORT */ | ||
import {describe} from 'ava-spec'; | ||
import stringMatches from '../dist'; | ||
import {describe} from 'fava'; | ||
import stringMatches from '../dist/index.js'; | ||
/* STRING MATCHES */ | ||
/* MAIN */ | ||
@@ -13,4 +13,4 @@ describe ( 'stringMatches', it => { | ||
const test = 'A tidy tiger tied a tighter tie to tidy her tiny tail', | ||
matches = stringMatches ( test, /tidy/g ); | ||
const test = 'A tidy tiger tied a tighter tie to tidy her tiny tail'; | ||
const matches = stringMatches ( test, /tidy/g ); | ||
@@ -25,4 +25,4 @@ t.is ( matches.length, 2 ); | ||
const test = 'A tidy tiger tied a tighter tie to tidy her tiny tail', | ||
matches = stringMatches ( test, /tidy/ ); | ||
const test = 'A tidy tiger tied a tighter tie to tidy her tiny tail'; | ||
const matches = stringMatches ( test, /tidy/ ); | ||
@@ -35,4 +35,4 @@ t.is ( matches.length, 1 ); | ||
const test = 'A tidy tiger tied a tighter tie to tidy her tiny tail', | ||
matches = stringMatches ( test, /ti/g, 2 ); | ||
const test = 'A tidy tiger tied a tighter tie to tidy her tiny tail'; | ||
const matches = stringMatches ( test, /ti/g, 2 ); | ||
@@ -39,0 +39,0 @@ t.is ( matches.length, 2 ); |
{ | ||
"compilerOptions": { | ||
"alwaysStrict": true, | ||
"declaration": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"inlineSourceMap": true, | ||
"lib": ["dom", "scripthost", "es2015", "es2016", "es2017"], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"newLine": "LF", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": false, | ||
"outDir": "dist", | ||
"pretty": true, | ||
"strictNullChecks": true, | ||
"target": "es5" | ||
}, | ||
"include": [ | ||
"src" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
"extends": "tsex/tsconfig.json" | ||
} |
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
3
Yes
4606
66
2
1