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

kmdr-ast

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kmdr-ast - npm Package Compare versions

Comparing version 3.3.3 to 3.3.4

dist/nodeDefinition/logicalOperatorNodeDefinition.d.ts

2

dist/highlight.d.ts
import { Decorators, NodeDefinition } from "./interfaces";
import Tree from "./tree";
export default class Highlight<R extends string | Text | Element> {
export default class Highlight<R extends string | Text | Element | any> {
private static findNodeDefinition;

@@ -5,0 +5,0 @@ private mode;

@@ -13,7 +13,4 @@ "use strict";

static findNodeDefinition(node, definitions) {
const matches = definitions.filter(definition => {
const definitionRange = [
definition.startPosition,
definition.endPosition
];
const matches = definitions.filter((definition) => {
const definitionRange = [definition.startPosition, definition.endPosition];
const nodeRange = [node.startPosition, node.endPosition];

@@ -48,9 +45,7 @@ return (astNodePoint_1.default.areEqualRanges(nodeRange, definitionRange) ||

const point = new astNodePoint_1.default({ row, column: columnAtLine });
if (currentToken < nodes.length &&
astNodePoint_1.default.isInRange([startPosition, endPosition], point)) {
if (currentToken < nodes.length && astNodePoint_1.default.isInRange([startPosition, endPosition], point)) {
inRange = true;
wordInRange += char;
// if there's a token that spans till the end of the string
if (column === source.length - 1 ||
columnAtLine === nodes[currentToken].endPosition.column - 1) {
if (column === source.length - 1 || columnAtLine === nodes[currentToken].endPosition.column - 1) {
decoratedStrings.push(...this.decorateNode(wordInRange, nodes[currentToken], definitions));

@@ -100,14 +95,10 @@ wordInRange = "";

column: columnInNode,
row: startPosition.row
row: startPosition.row,
});
if (currentToken < matches.length &&
astNodePoint_1.default.isInRange([
matches[currentToken].startPosition,
matches[currentToken].endPosition
], point)) {
astNodePoint_1.default.isInRange([matches[currentToken].startPosition, matches[currentToken].endPosition], point)) {
inRange = true;
wordInRange += char;
// if there's a token that spans till the end of the string
if (column === text.length - 1 ||
columnInNode === matches[currentToken].endPosition.column - 1) {
if (column === text.length - 1 || columnInNode === matches[currentToken].endPosition.column - 1) {
decoratedStrings.push(this.decorateText(wordInRange, matches[currentToken].type, node, matches[currentToken]));

@@ -154,2 +145,4 @@ wordInRange = "";

return this.decorators.braces(text);
case "[[":
case "]]":
case "[":

@@ -156,0 +149,0 @@ case "]":

@@ -24,3 +24,3 @@ import { ArgumentSchema, OptionSchema, ProgramSchema, SubcommandSchema } from "kmdr-parser";

}
export interface Decorators<T extends Element | Text | string> {
export interface Decorators<T extends Element | Text | string | any> {
argument(text: string, node?: Node, definition?: NodeDefinition): T;

@@ -27,0 +27,0 @@ arithmeticOperator(text: string, node?: Node, definition?: NodeDefinition): T;

{
"name": "kmdr-ast",
"version": "3.3.3",
"version": "3.3.4",
"description": "Traverse the AST of an explanation by kmdr",

@@ -10,2 +10,3 @@ "main": "dist/index.js",

"dependencies": {
"@types/react": "^16.9.34",
"kmdr-parser": "^2.3.0"

@@ -12,0 +13,0 @@ },

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