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

parse-latin

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-latin - npm Package Compare versions

Comparing version 6.0.2 to 7.0.0

2

index.d.ts

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

export {ParseLatin} from './lib/index.js'
export { ParseLatin } from "./lib/index.js";

@@ -1,11 +0,11 @@

export const affixSymbol: RegExp
export const newLine: RegExp
export const terminalMarker: RegExp
export const wordSymbolInner: RegExp
export const numerical: RegExp
export const digitStart: RegExp
export const lowerInitial: RegExp
export const surrogates: RegExp
export const punctuation: RegExp
export const word: RegExp
export const whiteSpace: RegExp
export const affixSymbol: RegExp;
export const newLine: RegExp;
export const terminalMarker: RegExp;
export const wordSymbolInner: RegExp;
export const numerical: RegExp;
export const digitStart: RegExp;
export const lowerInitial: RegExp;
export const surrogates: RegExp;
export const punctuation: RegExp;
export const word: RegExp;
export const whiteSpace: RegExp;
// This module is generated by `script/build-expressions.js`.
export const affixSymbol =
/^([!"').?\u00BB\u0F3B\u0F3D\u169C\u2019\u201D\u2026\u203A\u203D\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21\u2E23\u2E25\u2E27\u2E29\u2E56\u2E58\u2E5A\u2E5C\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63\]}])\1*$/
/^([!"').?\u0F3B\u0F3D\u169C\u2019\u201D\u2026\u203A\u203D\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21\u2E23\u2E25\u2E27\u2E29\u2E56\u2E58\u2E5A\u2E5C\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63\u00BB\]}])\1*$/
export const newLine = /^[ \t]*((\r?\n|\r)[\t ]*)+$/

@@ -5,0 +5,0 @@ export const terminalMarker = /^([!.?\u2026\u203D]+)$/

@@ -5,82 +5,79 @@ /**

export class ParseLatin {
/**
* Create a new parser.
*
* This additionally supports `retext`-like call: where an instance is
* created for each file, and the file is given on construction.
*
* @param {string | null | undefined} [doc]
* Value to parse.
* @param {VFile | null | undefined} [file]
* Corresponding file.
*/
constructor(doc?: string | null | undefined, file?: VFile | null | undefined)
/** @type {string | null} */
doc: string | null
/** @type {Array<Plugin<Root>>} */
tokenizeRootPlugins: Array<Plugin<Root>>
/** @type {Array<Plugin<Paragraph>>} */
tokenizeParagraphPlugins: Array<Plugin<Paragraph>>
/** @type {Array<Plugin<Sentence>>} */
tokenizeSentencePlugins: Array<Plugin<Sentence>>
/**
* Turn natural language into a syntax tree.
*
* @param {string | null | undefined} [value]
* Value to parse.
* @returns {Root}
* Tree.
*/
parse(value?: string | null | undefined): Root
/**
* Parse as a root.
*
* @param {string | null | undefined} [value]
* Value to parse.
* @returns {Root}
* Built tree.
*/
tokenizeRoot(value?: string | null | undefined): Root
/**
* Parse as a paragraph.
*
* @param {string | null | undefined} [value]
* Value to parse.
* @returns {Paragraph}
* Built tree.
*/
tokenizeParagraph(value?: string | null | undefined): Paragraph
/**
* Parse as a sentence.
*
* @param {string | null | undefined} [value]
* Value to parse.
* @returns {Sentence}
* Built tree.
*/
tokenizeSentence(value?: string | null | undefined): Sentence
/**
* Transform a `value` into a list of nlcsts.
*
* @param {string | null | undefined} [value]
* Value to parse.
* @returns {Array<SentenceContent>}
* Built sentence content.
*/
tokenize(value?: string | null | undefined): Array<SentenceContent>
/**
* Create a new parser.
*
* This additionally supports `retext`-like call: where an instance is
* created for each file, and the file is given on construction.
*
* @param {string | null | undefined} [doc]
* Value to parse (optional).
* @param {VFile | null | undefined} [file]
* Corresponding file (optional).
*/
constructor(doc?: string | null | undefined, file?: VFile | null | undefined);
/** @type {string | undefined} */
doc: string | undefined;
/** @type {Array<Plugin<Root>>} */
tokenizeRootPlugins: Array<Plugin<Root>>;
/** @type {Array<Plugin<Paragraph>>} */
tokenizeParagraphPlugins: Array<Plugin<Paragraph>>;
/** @type {Array<Plugin<Sentence>>} */
tokenizeSentencePlugins: Array<Plugin<Sentence>>;
/**
* Turn natural language into a syntax tree.
*
* @param {string | null | undefined} [value]
* Value to parse (optional).
* @returns {Root}
* Tree.
*/
parse(value?: string | null | undefined): Root;
/**
* Parse as a root.
*
* @param {string | null | undefined} [value]
* Value to parse (optional).
* @returns {Root}
* Built tree.
*/
tokenizeRoot(value?: string | null | undefined): Root;
/**
* Parse as a paragraph.
*
* @param {string | null | undefined} [value]
* Value to parse (optional).
* @returns {Paragraph}
* Built tree.
*/
tokenizeParagraph(value?: string | null | undefined): Paragraph;
/**
* Parse as a sentence.
*
* @param {string | null | undefined} [value]
* Value to parse (optional).
* @returns {Sentence}
* Built tree.
*/
tokenizeSentence(value?: string | null | undefined): Sentence;
/**
* Transform a `value` into a list of nlcsts.
*
* @param {string | null | undefined} [value]
* Value to parse (optional).
* @returns {Array<SentenceContent>}
* Built sentence content.
*/
tokenize(value?: string | null | undefined): Array<SentenceContent>;
}
export type Content = import('nlcst').Content
export type Paragraph = import('nlcst').Paragraph
export type Parent = import('nlcst').Parent
export type Root = import('nlcst').Root
export type Sentence = import('nlcst').Sentence
export type SentenceContent = import('nlcst').SentenceContent
export type VFile = import('vfile').VFile
export type Nodes = Content | Root
export type Parents = Extract<Nodes, Parent>
export type Nodes = import('nlcst').Nodes;
export type Parents = import('nlcst').Parents;
export type Paragraph = import('nlcst').Paragraph;
export type Root = import('nlcst').Root;
export type RootContent = import('nlcst').RootContent;
export type Sentence = import('nlcst').Sentence;
export type SentenceContent = import('nlcst').SentenceContent;
export type VFile = import('vfile').VFile;
/**
* Transform a node.
*/
export type Plugin<
Node extends import('nlcst').Content | import('nlcst').Root
> = (node: Node) => void
export type Plugin<Node extends import("nlcst").Nodes> = (node: Node) => undefined | void;
/**
* @typedef {import('nlcst').Content} Content
* @typedef {import('nlcst').Nodes} Nodes
* @typedef {import('nlcst').Parents} Parents
* @typedef {import('nlcst').Paragraph} Paragraph
* @typedef {import('nlcst').Parent} Parent
* @typedef {import('nlcst').Root} Root
* @typedef {import('nlcst').RootContent} RootContent
* @typedef {import('nlcst').Sentence} Sentence

@@ -12,8 +13,3 @@ * @typedef {import('nlcst').SentenceContent} SentenceContent

/**
* @typedef {Content | Root} Nodes
* @typedef {Extract<Nodes, Parent>} Parents
*/
/**
* @template {Root | Content} Node
* @template {Nodes} Node
* Node type.

@@ -24,3 +20,3 @@ * @callback Plugin

* The node.
* @returns {void}
* @returns {undefined | void}
* Nothing.

@@ -69,5 +65,5 @@ */

* @param {string | null | undefined} [doc]
* Value to parse.
* Value to parse (optional).
* @param {VFile | null | undefined} [file]
* Corresponding file.
* Corresponding file (optional).
*/

@@ -77,5 +73,4 @@ constructor(doc, file) {

// To do: next major: use `undefined`.
/** @type {string | null} */
this.doc = value ? String(value) : null
/** @type {string | undefined} */
this.doc = value ? String(value) : undefined

@@ -94,3 +89,3 @@ /** @type {Array<Plugin<Root>>} */

* @param {string | null | undefined} [value]
* Value to parse.
* Value to parse (optional).
* @returns {Root}

@@ -107,3 +102,3 @@ * Tree.

* @param {string | null | undefined} [value]
* Value to parse.
* Value to parse (optional).
* @returns {Root}

@@ -132,3 +127,3 @@ * Built tree.

* @param {string | null | undefined} [value]
* Value to parse.
* Value to parse (optional).
* @returns {Paragraph}

@@ -157,3 +152,3 @@ * Built tree.

* @param {string | null | undefined} [value]
* Value to parse.
* Value to parse (optional).
* @returns {Sentence}

@@ -179,3 +174,3 @@ * Built tree.

* @param {string | null | undefined} [value]
* Value to parse.
* Value to parse (optional).
* @returns {Array<SentenceContent>}

@@ -326,3 +321,3 @@ * Built sentence content.

* Split on this regex.
* @param {Content['type']} childType
* @param {Node['children'][number]['type']} childType
* Split this node type.

@@ -329,0 +324,0 @@ * @returns {Array<Node>}

@@ -1,5 +0,3 @@

export const breakImplicitSentences: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export type Sentence = import('nlcst').Sentence
export const breakImplicitSentences: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;
export type Sentence = import('nlcst').Sentence;

@@ -1,5 +0,3 @@

export const makeFinalWhiteSpaceSiblings: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph | import('nlcst').Root
>
export type Paragraph = import('nlcst').Paragraph
export type Root = import('nlcst').Root
export const makeFinalWhiteSpaceSiblings: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph | import("nlcst").Root>;
export type Paragraph = import('nlcst').Paragraph;
export type Root = import('nlcst').Root;

@@ -12,3 +12,3 @@ /**

/**
* @type {import('unist-util-modify-children').Modifier<Root | Paragraph>}
* @type {import('unist-util-modify-children').Modifier<Paragraph | Root>}
*/

@@ -15,0 +15,0 @@

@@ -1,5 +0,3 @@

export const makeInitialWhiteSpaceSiblings: import('unist-util-visit-children/lib/index.js').Visit<
import('nlcst').Paragraph | import('nlcst').Root
>
export type Paragraph = import('nlcst').Paragraph
export type Root = import('nlcst').Root
export const makeInitialWhiteSpaceSiblings: import("../../node_modules/unist-util-visit-children/lib/index.js").Visit<import("nlcst").Paragraph | import("nlcst").Root>;
export type Paragraph = import('nlcst').Paragraph;
export type Root = import('nlcst').Root;

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

export const mergeAffixExceptions: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export const mergeAffixExceptions: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;

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

export const mergeAffixSymbol: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export const mergeAffixSymbol: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;

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

export const mergeFinalWordSymbol: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Sentence
>
export type Sentence = import('nlcst').Sentence
export const mergeFinalWordSymbol: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Sentence>;
export type Sentence = import('nlcst').Sentence;

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

export const mergeInitialDigitSentences: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export const mergeInitialDigitSentences: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;

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

export const mergeInitialLowerCaseLetterSentences: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export const mergeInitialLowerCaseLetterSentences: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;

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

export const mergeInitialWordSymbol: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Sentence
>
export type Sentence = import('nlcst').Sentence
export const mergeInitialWordSymbol: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Sentence>;
export type Sentence = import('nlcst').Sentence;

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

export const mergeInitialisms: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Sentence
>
export type Sentence = import('nlcst').Sentence
export const mergeInitialisms: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Sentence>;
export type Sentence = import('nlcst').Sentence;

@@ -1,6 +0,4 @@

export const mergeInnerWordSlash: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Sentence
>
export type Sentence = import('nlcst').Sentence
export type SentenceContent = import('nlcst').SentenceContent
export type WordContent = import('nlcst').WordContent
export const mergeInnerWordSlash: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Sentence>;
export type Sentence = import('nlcst').Sentence;
export type SentenceContent = import('nlcst').SentenceContent;
export type WordContent = import('nlcst').WordContent;

@@ -1,5 +0,3 @@

export const mergeInnerWordSymbol: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Sentence
>
export type Sentence = import('nlcst').Sentence
export type WordContent = import('nlcst').WordContent
export const mergeInnerWordSymbol: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Sentence>;
export type Sentence = import('nlcst').Sentence;
export type WordContent = import('nlcst').WordContent;

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

export const mergeNonWordSentences: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export const mergeNonWordSentences: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;

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

export const mergePrefixExceptions: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export const mergePrefixExceptions: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;

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

export const mergeRemainingFullStops: import('unist-util-visit-children/lib/index.js').Visit<
import('nlcst').Paragraph
>
export type Paragraph = import('nlcst').Paragraph
export const mergeRemainingFullStops: import("../../node_modules/unist-util-visit-children/lib/index.js").Visit<import("nlcst").Paragraph>;
export type Paragraph = import('nlcst').Paragraph;

@@ -1,8 +0,6 @@

export const patchPosition: import('unist-util-visit-children/lib/index.js').Visit<
import('nlcst').Sentence | import('nlcst').Paragraph | import('nlcst').Root
>
export type Paragraph = import('nlcst').Paragraph
export type Sentence = import('nlcst').Sentence
export type Root = import('nlcst').Root
export type Node = import('unist').Node
export type Position = import('unist').Position
export const patchPosition: import("../../node_modules/unist-util-visit-children/lib/index.js").Visit<import("nlcst").Sentence | import("nlcst").Paragraph | import("nlcst").Root>;
export type Node = import('unist').Node;
export type Paragraph = import('nlcst').Paragraph;
export type Position = import('unist').Position;
export type Root = import('nlcst').Root;
export type Sentence = import('nlcst').Sentence;
/**
* @typedef {import('unist').Node} Node
* @typedef {import('nlcst').Paragraph} Paragraph
* @typedef {import('unist').Position} Position
* @typedef {import('nlcst').Root} Root
* @typedef {import('nlcst').Sentence} Sentence
* @typedef {import('nlcst').Root} Root
* @typedef {import('unist').Node} Node
* @typedef {import('unist').Position} Position
*/

@@ -14,3 +14,3 @@

/**
* @type {import('unist-util-visit-children').Visitor<Paragraph | Sentence | Root>}
* @type {import('unist-util-visit-children').Visitor<Paragraph | Root | Sentence>}
*/

@@ -17,0 +17,0 @@ function (child, index, node) {

@@ -1,5 +0,3 @@

export const removeEmptyNodes: import('unist-util-modify-children/lib/index.js').Modify<
import('nlcst').Paragraph | import('nlcst').Root
>
export type Paragraph = import('nlcst').Paragraph
export type Root = import('nlcst').Root
export const removeEmptyNodes: import("../../node_modules/unist-util-modify-children/lib/index.js").Modify<import("nlcst").Paragraph | import("nlcst").Root>;
export type Paragraph = import('nlcst').Paragraph;
export type Root = import('nlcst').Root;
{
"name": "parse-latin",
"version": "6.0.2",
"version": "7.0.0",
"description": "Latin-script (natural language) parser",

@@ -26,4 +26,3 @@ "license": "MIT",

"type": "module",
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [

@@ -35,8 +34,8 @@ "lib/",

"dependencies": {
"@types/nlcst": "^1.0.0",
"@types/unist": "^2.0.0",
"nlcst-to-string": "^3.0.0",
"unist-util-modify-children": "^3.0.0",
"unist-util-visit-children": "^2.0.0",
"vfile": "^5.0.0"
"@types/nlcst": "^2.0.0",
"@types/unist": "^3.0.0",
"nlcst-to-string": "^4.0.0",
"unist-util-modify-children": "^4.0.0",
"unist-util-visit-children": "^3.0.0",
"vfile": "^6.0.0"
},

@@ -47,6 +46,6 @@ "devDependencies": {

"@unicode/unicode-15.0.0": "^1.0.0",
"c8": "^7.0.0",
"c8": "^8.0.0",
"is-hidden": "^2.0.0",
"nlcst-test": "^3.0.0",
"prettier": "^2.0.0",
"nlcst-test": "^4.0.0",
"prettier": "^3.0.0",
"regenerate": "^1.0.0",

@@ -57,4 +56,4 @@ "remark-cli": "^11.0.0",

"typescript": "^5.0.0",
"unist-util-remove-position": "^4.0.0",
"xo": "^0.54.0"
"unist-util-remove-position": "^5.0.0",
"xo": "^0.55.0"
},

@@ -65,14 +64,14 @@ "scripts": {

"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
"test-api": "node --conditions development test/index.js",
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
"test": "npm run generate && npm run build && npm run format && npm run test-coverage"
"test": "npm run build && npm run format && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
},

@@ -87,11 +86,6 @@ "remarkConfig": {

"detail": true,
"strict": true,
"ignoreCatch": true
"ignoreCatch": true,
"strict": true
},
"xo": {
"prettier": true,
"rules": {
"max-depth": "off",
"no-misleading-character-class": "off"
},
"overrides": [

@@ -107,4 +101,10 @@ {

}
]
],
"prettier": true,
"rules": {
"max-depth": "off",
"no-misleading-character-class": "off",
"unicorn/prefer-at": "off"
}
}
}

@@ -61,3 +61,3 @@ # parse-latin

```js
import {ParseLatin} from 'https://esm.sh/parse-latin@6'
import {ParseLatin} from 'https://esm.sh/parse-latin@7'
```

@@ -69,3 +69,3 @@

<script type="module">
import {ParseLatin} from 'https://esm.sh/parse-latin@6?bundle'
import {ParseLatin} from 'https://esm.sh/parse-latin@7?bundle'
</script>

@@ -157,6 +157,9 @@ ```

This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 16.0+.
It also works in Deno and modern browsers.
Projects maintained by me are compatible with maintained versions of Node.js.
When I cut a new major release, I drop support for unmaintained versions of
Node.
This means I try to keep the current release line, `parse-latin@^7`, compatible
with Node.js 16.
## Security

@@ -163,0 +166,0 @@

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