Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string-matches

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-matches - npm Package Compare versions

Comparing version 1.1.3 to 2.0.0

license

10

dist/index.d.ts

@@ -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;

19

dist/index.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc