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

jsdoc-type-pratt-parser

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdoc-type-pratt-parser - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

2

dist/src/index.d.ts

@@ -14,2 +14,2 @@ /**

export * from './traverse';
export { visitorKeys } from './visitorKeys';
export * from './visitorKeys';
import { RootResult } from './result/RootResult';
export declare type ParseMode = 'closure' | 'jsdoc' | 'typescript';
/**
* This function parses the given expression in the given mode and produces a {@link ParseResult}.
* This function parses the given expression in the given mode and produces a {@link RootResult}.
* @param expression

@@ -11,3 +11,3 @@ * @param mode

* This function tries to parse the given expression in multiple modes and returns the first successful
* {@link ParseResult}. By default it tries `'typescript'`, `'closure'` and `'jsdoc'` in this order. If
* {@link RootResult}. By default it tries `'typescript'`, `'closure'` and `'jsdoc'` in this order. If
* no mode was successful it throws the error that was produced by the last parsing attempt.

@@ -14,0 +14,0 @@ * @param expression

@@ -10,3 +10,3 @@ import { NonRootResult } from './result/NonRootResult';

*/
declare type NodeVisitor = (node: NonRootResult, parentNode?: NonRootResult, property?: string) => void;
export declare type NodeVisitor = (node: NonRootResult, parentNode?: NonRootResult, property?: string) => void;
/**

@@ -19,2 +19,1 @@ * A function to traverse an AST. It traverses it depth first.

export declare function traverse(node: RootResult, onEnter?: NodeVisitor, onLeave?: NodeVisitor): void;
export {};
import { NonRootResult } from './result/NonRootResult';
declare type VisitorKeys = {
export declare type VisitorKeys = {
[P in NonRootResult as P['type']]: Array<keyof P>;
};
export declare const visitorKeys: VisitorKeys;
export {};
import 'mocha';
import { RootResult, ParseMode } from '../../src';
declare type JtpMode = 'jsdoc' | 'closure' | 'typescript' | 'permissive';
declare type CatharsisMode = 'jsdoc' | 'closure';
declare type CompareMode = ParseMode | 'fail' | 'differ';
export declare type JtpMode = 'jsdoc' | 'closure' | 'typescript' | 'permissive';
export declare type CatharsisMode = 'jsdoc' | 'closure';
export declare type CompareMode = ParseMode | 'fail' | 'differ';
export interface Fixture {

@@ -42,2 +42,1 @@ /**

export declare function testFixture(fixture: Fixture): void;
export {};
{
"name": "jsdoc-type-pratt-parser",
"version": "2.2.1",
"version": "2.2.2",
"description": "",

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

"build": "rollup -c",
"apidoc": "typedoc src/index.ts --out docs",
"apidoc": "typedoc --options typedoc.json",
"preversion": "npm test",

@@ -58,2 +58,3 @@ "prepublishOnly": "npm run build",

"typedoc": "^0.22.10",
"typedoc-plugin-merge-modules": "^3.1.0",
"typescript": "^4.5.4"

@@ -102,4 +103,3 @@ },

"access": "public"
},
"dependencies": {}
}
}

@@ -47,4 +47,4 @@ [![Npm Package](https://badgen.net/npm/v/jsdoc-type-pratt-parser)](https://www.npmjs.com/package/jsdoc-type-pratt-parser)

An API documentation can be found [here](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html).
It is still lacking in some points. Feel free to create issues or PRs to improve this.
An API documentation can be found [here](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/).
It is incomplete, but a good starting point. Please create issues or PRs if you don't find what you expect.

@@ -60,3 +60,3 @@ ## Available Grammars

[`stringify`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#stringify):
[`stringify`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#stringify):

@@ -69,4 +69,4 @@ ```js

You can customize the stringification by using [`stringifyRules`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#stringifyRules)
and [`transform`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#transform):
You can customize the stringification by using [`stringifyRules`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#stringifyRules)
and [`transform`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#transform):

@@ -84,4 +84,4 @@ ```js

You can also build your own transform rules by implementing the [`TransformRules<TransformResultType>`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#TransformRules) interface or you
can build upon the [identity ruleset](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#identityTransformRules) like this:
You can also build your own transform rules by implementing the [`TransformRules<TransformResultType>`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#TransformRules) interface or you
can build upon the [identity ruleset](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#identityTransformRules) like this:

@@ -102,3 +102,3 @@ ```js

[Catharsis compat mode](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#catharsisTransform):
[Catharsis compat mode](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#catharsisTransform):

@@ -111,3 +111,3 @@ ```js

[Jsdoctypeparser compat mode](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#jtpTransform):
[Jsdoctypeparser compat mode](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#jtpTransform):

@@ -122,3 +122,3 @@ ```js

You can traverse an AST with the [`traverse`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/modules.html#traverse) function:
You can traverse an AST with the [`traverse`](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/docs/index.html#traverse) function:

@@ -139,4 +139,4 @@ ```js

This parser runs most tests of https://github.com/hegemonic/catharsis and
https://github.com/jsdoctypeparser/jsdoctypeparser. It compares the results of the different parsing libraries. If you
This parser runs most tests of [catharsis](https://github.com/hegemonic/catharsis) and
[jsdoctypeparser](https://github.com/jsdoctypeparser/jsdoctypeparser). It compares the results of the different parsing libraries. If you
want to find out where the output differs, look in the tests for the comments `// This seems to be an error of ...` or

@@ -147,3 +147,3 @@ the `differ` keyword which indicates that differing results are produced.

A simple [performance comparision](benchmark/benchmark.js) using [Benchmark.js](https://benchmarkjs.com/) produced the following results:
A simple [performance comparison](benchmark/benchmark.js) using [Benchmark.js](https://benchmarkjs.com/) produced the following results:
```

@@ -150,0 +150,0 @@ Testing expression: Name

@@ -15,2 +15,2 @@ /**

export * from './traverse'
export { visitorKeys } from './visitorKeys'
export * from './visitorKeys'

@@ -62,2 +62,3 @@ import { Token, TokenType } from './Token'

// we are a bit more liberal than TypeScript here and allow `NaN`, `Infinity` and `-Infinity`
const numberRegex = /^(NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity))/

@@ -64,0 +65,0 @@ function getNumber (text: string): string|null {

@@ -22,3 +22,3 @@ import { Parser } from './Parser'

/**
* This function parses the given expression in the given mode and produces a {@link ParseResult}.
* This function parses the given expression in the given mode and produces a {@link RootResult}.
* @param expression

@@ -33,3 +33,3 @@ * @param mode

* This function tries to parse the given expression in multiple modes and returns the first successful
* {@link ParseResult}. By default it tries `'typescript'`, `'closure'` and `'jsdoc'` in this order. If
* {@link RootResult}. By default it tries `'typescript'`, `'closure'` and `'jsdoc'` in this order. If
* no mode was successful it throws the error that was produced by the last parsing attempt.

@@ -36,0 +36,0 @@ * @param expression

@@ -17,5 +17,5 @@ import { composeParslet } from './Parslet'

parenthesis: true,
returnType: parser.parseType(Precedence.ALL)
returnType: parser.parseType(Precedence.OBJECT)
}
}
})

@@ -12,3 +12,3 @@ import { NonRootResult } from './result/NonRootResult'

*/
type NodeVisitor = (node: NonRootResult, parentNode?: NonRootResult, property?: string) => void
export type NodeVisitor = (node: NonRootResult, parentNode?: NonRootResult, property?: string) => void

@@ -15,0 +15,0 @@ function _traverse<T extends NonRootResult, U extends NonRootResult> (node: T, parentNode?: U, property?: keyof U, onEnter?: NodeVisitor, onLeave?: NodeVisitor): void {

import { NonRootResult } from './result/NonRootResult'
type VisitorKeys = {
export type VisitorKeys = {
[P in NonRootResult as P['type']]: Array<keyof P>

@@ -5,0 +5,0 @@ }

Sorry, the diff of this file is too big to display

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