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

@typedefs/parser

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typedefs/parser - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

38

build/lib.js

@@ -92,16 +92,3 @@ const { Fn, fn,

}
const parseUnion = () => {
const types = []
while(peek() != ')') {
const type = parseType()
types.push(type)
if (peek() == ')') {
consume()
break
}
if (peek() != '|') throw new Error('Expecting | for union')
consume()
}
return types
}
const parseRecord = () => {

@@ -130,3 +117,3 @@ const props = {}

/** @type {!_typedefsParser.Type} */
const type = {}
let type = {}
let applicationWithDot

@@ -144,3 +131,8 @@ /** @type {string} */

consume()
type.union = parseUnion()
type = {
...parseType(),
...type, // preserve nullable
}
if (peek() != ')') throw new Error('Expecting closing )')
consume()
return type

@@ -158,3 +150,3 @@ } else if (token == '{') {

type.name = token
type.name = peek()
consume()

@@ -178,3 +170,13 @@ if ([fn, Fn].includes(token)) {

}
return type
if (peek() != '|') return type
const union = [type]
while(peek() == '|') {
consume()
const nextType = parseType(true)
const u = nextType.union ? nextType.union : [nextType]
union.push(...u)
}
return { union }
}

@@ -181,0 +183,0 @@

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

## 27 April 2019
### [1.1.0](https://github.com/artdecocode/parser/compare/v1.0.3...v1.1.0)
- [feature] Implement the union type without parenthesis.
## 26 April 2019

@@ -2,0 +8,0 @@

{
"name": "@typedefs/parser",
"version": "1.0.3",
"version": "1.1.0",
"description": "The Parser For JSDoc Types.",

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

@@ -103,4 +103,4 @@ # @typedefs/parser

application:
[ { nullable: true,
union: [ { name: 'string' }, { name: 'symbol' } ] } ] } ] }
[ { union: [ { name: 'string' }, { name: 'symbol' } ],
nullable: true } ] } ] }

@@ -107,0 +107,0 @@ Records:

@@ -92,16 +92,3 @@ import { Fn, fn,

}
const parseUnion = () => {
const types = []
while(peek() != ')') {
const type = parseType()
types.push(type)
if (peek() == ')') {
consume()
break
}
if (peek() != '|') throw new Error('Expecting | for union')
consume()
}
return types
}
const parseRecord = () => {

@@ -130,3 +117,3 @@ const props = {}

/** @type {!_typedefsParser.Type} */
const type = {}
let type = {}
let applicationWithDot

@@ -144,3 +131,8 @@ /** @type {string} */

consume()
type.union = parseUnion()
type = {
...parseType(),
...type, // preserve nullable
}
if (peek() != ')') throw new Error('Expecting closing )')
consume()
return type

@@ -158,3 +150,3 @@ } else if (token == '{') {

type.name = token
type.name = peek()
consume()

@@ -178,3 +170,13 @@ if ([fn, Fn].includes(token)) {

}
return type
if (peek() != '|') return type
const union = [type]
while(peek() == '|') {
consume()
const nextType = parseType(true)
const u = nextType.union ? nextType.union : [nextType]
union.push(...u)
}
return { union }
}

@@ -181,0 +183,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