New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

good-enough-parser

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

good-enough-parser - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

dist/cjs/query/handler.d.ts

4

dist/cjs/lang/index.js

@@ -17,3 +17,3 @@ "use strict";

const query_1 = require("../query");
const util_1 = require("../query/util");
const clone_1 = require("../util/clone");
const groovy_1 = require("./groovy");

@@ -37,3 +37,3 @@ const python_1 = require("./python");

const result = checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.context;
return result && (0, util_1.clone)(result);
return result && (0, clone_1.clone)(result);
}

@@ -40,0 +40,0 @@ }

@@ -9,2 +9,3 @@ "use strict";

const tree_matcher_1 = require("./matchers/tree-matcher");
const regex_1 = require("./regex");
class AbstractBuilder {

@@ -81,3 +82,3 @@ sym(arg1, arg2) {

function coerceSymOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
return {

@@ -115,3 +116,3 @@ value: arg1,

function coerceOpOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
return {

@@ -149,3 +150,3 @@ value: arg1,

function coerceCommentOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
return {

@@ -183,3 +184,3 @@ value: arg1,

function coerceNumOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
return {

@@ -297,3 +298,3 @@ value: arg1,

this.opts.match.forEach((m) => {
if (typeof m === 'string' || m instanceof RegExp) {
if (typeof m === 'string' || (0, regex_1.isRegex)(m)) {
const contentMatcher = new str_matcher_1.StrContentMatcher({

@@ -337,3 +338,3 @@ value: m,

function coerceStrOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
if (arg1 === '') {

@@ -368,3 +369,3 @@ return {

typeof arg1.match === 'string' ||
arg1.match instanceof RegExp) {
(0, regex_1.isRegex)(arg1.match)) {
return {

@@ -371,0 +372,0 @@ type: 'str-content',

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommentMatcher = void 0;
const util_1 = require("../util");
const handler_1 = require("../handler");
const regex_1 = require("../regex");
const abstract_matcher_1 = require("./abstract-matcher");

@@ -11,3 +12,3 @@ const skipBeforeComment = ['whitespace', '_start', 'newline'];

this.comment = value;
this.handler = (0, util_1.coerceHandler)(handler);
this.handler = (0, handler_1.safeHandler)(handler);
}

@@ -27,3 +28,3 @@ canSkip(node) {

}
else if (this.comment instanceof RegExp) {
else if ((0, regex_1.isRegex)(this.comment)) {
isMatched = this.comment.test(node.value);

@@ -30,0 +31,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumMatcher = void 0;
const util_1 = require("../util");
const handler_1 = require("../handler");
const regex_1 = require("../regex");
const abstract_matcher_1 = require("./abstract-matcher");

@@ -10,3 +11,3 @@ class NumMatcher extends abstract_matcher_1.AbstractMatcher {

this.num = value;
this.handler = (0, util_1.coerceHandler)(handler);
this.handler = (0, handler_1.safeHandler)(handler);
}

@@ -22,3 +23,3 @@ match(checkpoint) {

}
else if (this.num instanceof RegExp) {
else if ((0, regex_1.isRegex)(this.num)) {
isMatched = this.num.test(node.value);

@@ -25,0 +26,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpMatcher = void 0;
const util_1 = require("../util");
const handler_1 = require("../handler");
const regex_1 = require("../regex");
const abstract_matcher_1 = require("./abstract-matcher");

@@ -10,3 +11,3 @@ class OpMatcher extends abstract_matcher_1.AbstractMatcher {

this.op = value;
this.handler = (0, util_1.coerceHandler)(handler);
this.handler = (0, handler_1.safeHandler)(handler);
}

@@ -22,3 +23,3 @@ match(checkpoint) {

}
else if (this.op instanceof RegExp) {
else if ((0, regex_1.isRegex)(this.op)) {
isMatched = this.op.test(node.value);

@@ -25,0 +26,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StrNodeMatcher = exports.StrTplMatcher = exports.StrContentMatcher = void 0;
const util_1 = require("../util");
const handler_1 = require("../handler");
const regex_1 = require("../regex");
const abstract_matcher_1 = require("./abstract-matcher");

@@ -10,3 +11,3 @@ class StrContentMatcher extends abstract_matcher_1.AbstractMatcher {

this.content = value !== null && value !== void 0 ? value : null;
this.handler = (0, util_1.coerceHandler)(handler);
this.handler = (0, handler_1.safeHandler)(handler);
}

@@ -21,3 +22,3 @@ match(checkpoint) {

}
else if (this.content instanceof RegExp) {
else if ((0, regex_1.isRegex)(this.content)) {
isMatched = this.content.test(node.value);

@@ -39,4 +40,4 @@ }

this.matcher = config.matcher;
this.preHandler = (0, util_1.coerceHandler)(config.preHandler);
this.postHandler = (0, util_1.coerceHandler)(config.postHandler);
this.preHandler = (0, handler_1.safeHandler)(config.preHandler);
this.postHandler = (0, handler_1.safeHandler)(config.postHandler);
}

@@ -73,4 +74,4 @@ match(checkpoint) {

this.matchers = (_a = opts.matchers) !== null && _a !== void 0 ? _a : null;
this.preHandler = (0, util_1.coerceHandler)(opts.preHandler);
this.postHandler = (0, util_1.coerceHandler)(opts.postHandler);
this.preHandler = (0, handler_1.safeHandler)(opts.preHandler);
this.postHandler = (0, handler_1.safeHandler)(opts.postHandler);
}

@@ -77,0 +78,0 @@ match(checkpoint) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SymMatcher = void 0;
const util_1 = require("../util");
const handler_1 = require("../handler");
const regex_1 = require("../regex");
const abstract_matcher_1 = require("./abstract-matcher");

@@ -10,3 +11,3 @@ class SymMatcher extends abstract_matcher_1.AbstractMatcher {

this.sym = value;
this.handler = (0, util_1.coerceHandler)(handler);
this.handler = (0, handler_1.safeHandler)(handler);
}

@@ -22,3 +23,3 @@ match(checkpoint) {

}
else if (this.sym instanceof RegExp) {
else if ((0, regex_1.isRegex)(this.sym)) {
isMatched = this.sym.test(node.value);

@@ -25,0 +26,0 @@ }

@@ -5,3 +5,3 @@ "use strict";

const parser_1 = require("../../parser");
const util_1 = require("../util");
const handler_1 = require("../handler");
const abstract_matcher_1 = require("./abstract-matcher");

@@ -24,4 +24,4 @@ class TreeMatcher extends abstract_matcher_1.AbstractMatcher {

: 1024 * 1024;
this.preHandler = (0, util_1.coerceHandler)(config.preHandler);
this.postHandler = (0, util_1.coerceHandler)(config.postHandler);
this.preHandler = (0, handler_1.safeHandler)(config.preHandler);
this.postHandler = (0, handler_1.safeHandler)(config.postHandler);
}

@@ -28,0 +28,0 @@ walkToNextSignificantNode(cursor) {

import { createLexer } from '../lexer';
import { createCursor, createTree } from '../parser';
import { buildRoot } from '../query';
import { clone } from '../query/util';
import { clone } from '../util/clone';
import { lang as groovy } from './groovy';

@@ -6,0 +6,0 @@ import { lang as python } from './python';

@@ -6,2 +6,3 @@ import { AltMatcher, ManyMatcher, OpMatcher, SeqMatcher, SymMatcher, } from './matchers';

import { TreeMatcher } from './matchers/tree-matcher';
import { isRegex } from './regex';
class AbstractBuilder {

@@ -78,3 +79,3 @@ sym(arg1, arg2) {

function coerceSymOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || isRegex(arg1)) {
return {

@@ -111,3 +112,3 @@ value: arg1,

function coerceOpOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || isRegex(arg1)) {
return {

@@ -144,3 +145,3 @@ value: arg1,

function coerceCommentOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || isRegex(arg1)) {
return {

@@ -177,3 +178,3 @@ value: arg1,

function coerceNumOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || isRegex(arg1)) {
return {

@@ -286,3 +287,3 @@ value: arg1,

this.opts.match.forEach((m) => {
if (typeof m === 'string' || m instanceof RegExp) {
if (typeof m === 'string' || isRegex(m)) {
const contentMatcher = new StrContentMatcher({

@@ -326,3 +327,3 @@ value: m,

function coerceStrOptions(arg1, arg2) {
if (typeof arg1 === 'string' || arg1 instanceof RegExp) {
if (typeof arg1 === 'string' || isRegex(arg1)) {
if (arg1 === '') {

@@ -357,3 +358,3 @@ return {

typeof arg1.match === 'string' ||
arg1.match instanceof RegExp) {
isRegex(arg1.match)) {
return {

@@ -360,0 +361,0 @@ type: 'str-content',

@@ -1,2 +0,3 @@

import { coerceHandler } from '../util';
import { safeHandler } from '../handler';
import { isRegex } from '../regex';
import { AbstractMatcher } from './abstract-matcher';

@@ -8,3 +9,3 @@ const skipBeforeComment = ['whitespace', '_start', 'newline'];

this.comment = value;
this.handler = coerceHandler(handler);
this.handler = safeHandler(handler);
}

@@ -24,3 +25,3 @@ canSkip(node) {

}
else if (this.comment instanceof RegExp) {
else if (isRegex(this.comment)) {
isMatched = this.comment.test(node.value);

@@ -27,0 +28,0 @@ }

@@ -1,2 +0,3 @@

import { coerceHandler } from '../util';
import { safeHandler } from '../handler';
import { isRegex } from '../regex';
import { AbstractMatcher } from './abstract-matcher';

@@ -7,3 +8,3 @@ export class NumMatcher extends AbstractMatcher {

this.num = value;
this.handler = coerceHandler(handler);
this.handler = safeHandler(handler);
}

@@ -19,3 +20,3 @@ match(checkpoint) {

}
else if (this.num instanceof RegExp) {
else if (isRegex(this.num)) {
isMatched = this.num.test(node.value);

@@ -22,0 +23,0 @@ }

@@ -1,2 +0,3 @@

import { coerceHandler } from '../util';
import { safeHandler } from '../handler';
import { isRegex } from '../regex';
import { AbstractMatcher } from './abstract-matcher';

@@ -7,3 +8,3 @@ export class OpMatcher extends AbstractMatcher {

this.op = value;
this.handler = coerceHandler(handler);
this.handler = safeHandler(handler);
}

@@ -19,3 +20,3 @@ match(checkpoint) {

}
else if (this.op instanceof RegExp) {
else if (isRegex(this.op)) {
isMatched = this.op.test(node.value);

@@ -22,0 +23,0 @@ }

@@ -1,2 +0,3 @@

import { coerceHandler } from '../util';
import { safeHandler } from '../handler';
import { isRegex } from '../regex';
import { AbstractMatcher } from './abstract-matcher';

@@ -7,3 +8,3 @@ export class StrContentMatcher extends AbstractMatcher {

this.content = value !== null && value !== void 0 ? value : null;
this.handler = coerceHandler(handler);
this.handler = safeHandler(handler);
}

@@ -18,3 +19,3 @@ match(checkpoint) {

}
else if (this.content instanceof RegExp) {
else if (isRegex(this.content)) {
isMatched = this.content.test(node.value);

@@ -35,4 +36,4 @@ }

this.matcher = config.matcher;
this.preHandler = coerceHandler(config.preHandler);
this.postHandler = coerceHandler(config.postHandler);
this.preHandler = safeHandler(config.preHandler);
this.postHandler = safeHandler(config.postHandler);
}

@@ -68,4 +69,4 @@ match(checkpoint) {

this.matchers = (_a = opts.matchers) !== null && _a !== void 0 ? _a : null;
this.preHandler = coerceHandler(opts.preHandler);
this.postHandler = coerceHandler(opts.postHandler);
this.preHandler = safeHandler(opts.preHandler);
this.postHandler = safeHandler(opts.postHandler);
}

@@ -72,0 +73,0 @@ match(checkpoint) {

@@ -1,2 +0,3 @@

import { coerceHandler } from '../util';
import { safeHandler } from '../handler';
import { isRegex } from '../regex';
import { AbstractMatcher } from './abstract-matcher';

@@ -7,3 +8,3 @@ export class SymMatcher extends AbstractMatcher {

this.sym = value;
this.handler = coerceHandler(handler);
this.handler = safeHandler(handler);
}

@@ -19,3 +20,3 @@ match(checkpoint) {

}
else if (this.sym instanceof RegExp) {
else if (isRegex(this.sym)) {
isMatched = this.sym.test(node.value);

@@ -22,0 +23,0 @@ }

import { isTree } from '../../parser';
import { coerceHandler } from '../util';
import { safeHandler } from '../handler';
import { AbstractMatcher } from './abstract-matcher';

@@ -20,4 +20,4 @@ export class TreeMatcher extends AbstractMatcher {

: 1024 * 1024;
this.preHandler = coerceHandler(config.preHandler);
this.postHandler = coerceHandler(config.postHandler);
this.preHandler = safeHandler(config.preHandler);
this.postHandler = safeHandler(config.postHandler);
}

@@ -24,0 +24,0 @@ walkToNextSignificantNode(cursor) {

{
"name": "good-enough-parser",
"description": "Parse and query computer programs source code",
"version": "1.1.3",
"version": "1.1.4",
"repository": "git@github.com:zharinov/good-enough-parser.git",

@@ -6,0 +6,0 @@ "author": "Sergei Zharinov",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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