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

@textlint/text-to-ast

Package Overview
Dependencies
Maintainers
3
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textlint/text-to-ast - npm Package Compare versions

Comparing version 13.4.0 to 13.4.1

4

lib/src/plaintext-parser.d.ts

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

import { TxtNode } from "@textlint/ast-node-types";
import type { TxtDocumentNode } from "@textlint/ast-node-types";
/**

@@ -7,3 +7,3 @@ * parse text and return ast mapped location info.

*/
export declare function parse(text: string): TxtNode;
export declare function parse(text: string): TxtDocumentNode;
//# sourceMappingURL=plaintext-parser.d.ts.map

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

import { TxtNode } from "@textlint/ast-node-types";
import type { TxtDocumentNode } from "@textlint/ast-node-types";
/**

@@ -7,3 +7,3 @@ * parse text and return ast mapped location info.

*/
export declare function parse(text: string): TxtNode;
export declare function parse(text: string): TxtDocumentNode;
//# sourceMappingURL=plaintext-parser.d.ts.map
{
"name": "@textlint/text-to-ast",
"version": "13.4.0",
"version": "13.4.1",
"description": "Parse plain text to AST with location info.",

@@ -45,6 +45,6 @@ "keywords": [

"dependencies": {
"@textlint/ast-node-types": "^13.4.0"
"@textlint/ast-node-types": "^13.4.1"
},
"devDependencies": {
"@textlint/ast-tester": "^13.4.0",
"@textlint/ast-tester": "^13.4.1",
"eol-converter-cli": "^1.0.8",

@@ -58,3 +58,3 @@ "mocha": "^10.2.0",

},
"gitHead": "6aad8fe8f9c76388d11a27be1d6fbf112b8e2396"
"gitHead": "12529a831ab27256c0a322b439420f741ad22029"
}
// LICENSE : MIT
"use strict";
import { Syntax } from "./plaintext-syntax";
import { TxtNode } from "@textlint/ast-node-types";
import type { TxtBreakNode, TxtDocumentNode, TxtNode, TxtParagraphNode } from "@textlint/ast-node-types";
import { TxtStrNode } from "@textlint/ast-node-types";
function parseLine(lineText: string, lineNumber: number, startIndex: number): TxtNode {
function parseLine(lineText: string, lineNumber: number, startIndex: number): TxtStrNode {
// Inline Node have `value`. It it not part of TxtNode.

@@ -32,3 +33,3 @@ // TODO: https://github.com/textlint/textlint/issues/141

*/
function createEndedBRNode({ prevNode, lineBreakText }: { prevNode: TxtNode; lineBreakText: string }): TxtNode {
function createEndedBRNode({ prevNode, lineBreakText }: { prevNode: TxtNode; lineBreakText: string }): TxtBreakNode {
return {

@@ -62,3 +63,3 @@ type: Syntax.Break,

startIndex: number;
}): TxtNode {
}): TxtBreakNode {
return {

@@ -86,3 +87,3 @@ type: Syntax.Break,

*/
function createParagraph(nodes: TxtNode[]): TxtNode {
function createParagraph(nodes: TxtStrNode[]): TxtParagraphNode {
const firstNode = nodes[0];

@@ -143,3 +144,3 @@ const lastNode = nodes[nodes.length - 1];

*/
export function parse(text: string): TxtNode {
export function parse(text: string): TxtDocumentNode {
const textLineByLine = splitTextByLine(text);

@@ -186,3 +187,3 @@ // it should be alternately Str and Break

return result;
}, [] as TxtNode[]);
}, [] as (TxtBreakNode | TxtParagraphNode)[]);
const lastLine = textLineByLine[textLineByLine.length - 1];

@@ -189,0 +190,0 @@ if (lastLine === undefined) {

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