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.7.1 to 3.8.0

6

dist/highlight.d.ts

@@ -8,2 +8,8 @@ import { NodeDefinition, ThemeDecorators } from "./interfaces";

source(source: string, tree: Tree, definitions?: NodeDefinition[]): R[];
/**
* Sometimes a single node contains multiple definitions. This function does that trick.
* @param text
* @param node
* @param definitions
*/
private decorateNode;

@@ -10,0 +16,0 @@ private decorateText;

39

dist/highlight.js

@@ -34,11 +34,22 @@ "use strict";

// For CSS
decoratedStrings.push(...this.decorateNode(wordInRange, nodes[currentToken], definitions));
decoratedStrings.push(this.decorateText("\n", "new_line"));
wordInRange += char;
if (wordInRange === nodes[currentToken].text) {
decoratedStrings.push(...this.decorateNode(wordInRange, nodes[currentToken], definitions));
currentToken += 1;
inRange = false;
wordInRange = "";
}
}
else if (((_a = nodes[currentToken]) === null || _a === void 0 ? void 0 : _a.type) === "text" || ((_b = nodes[currentToken]) === null || _b === void 0 ? void 0 : _b.type) === "raw_text") {
// For HTML
decoratedStrings.push(this.decorateText("\n", "new_line"));
if (currentToken < nodes.length || ((_c = nodes[currentToken]) === null || _c === void 0 ? void 0 : _c.text) === "\n") {
if (((_c = nodes[currentToken]) === null || _c === void 0 ? void 0 : _c.text) === "\n") {
decoratedStrings.push(this.decorateText("\n", "new_line"));
currentToken += 1;
wordInRange = "";
inRange = false;
}
else {
wordInRange += char;
inRange = true;
}
}

@@ -50,7 +61,6 @@ else {

}
wordInRange = "";
}
wordInRange = "";
row++;
columnAtLine = 0;
inRange = false;
continue;

@@ -96,2 +106,8 @@ }

}
/**
* Sometimes a single node contains multiple definitions. This function does that trick.
* @param text
* @param node
* @param definitions
*/
decorateNode(text, node, definitions) {

@@ -103,7 +119,4 @@ const decoratedStrings = [];

let wordInRange = "";
let matches = [];
if (definitions) {
matches = Highlight.findNodeDefinition(node, definitions);
}
if (matches.length === 0) {
const matches = definitions ? Highlight.findNodeDefinition(node, definitions) : [];
if (matches.length === 0 && text.includes("\n") === false) {
decoratedStrings.push(this.decorateText(text, node.type));

@@ -115,2 +128,6 @@ }

const char = text[column];
if (char === "\n") {
decoratedStrings.push(this.decorateText(char, "new_line"));
continue;
}
// calculate the column position relative to the startPosition

@@ -117,0 +134,0 @@ // of the node

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

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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