jsdoctypeparser
Advanced tools
Comparing version 0.0.2 to 1.0.0
{ | ||
"name": "jsdoctypeparser", | ||
"description": "Strict JsDoc type expression parser", | ||
"version": "0.0.2", | ||
"version": "1.0.0", | ||
"author": "Orga Chem <orga.chem.job@gmail.com>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -17,3 +17,3 @@ // This script licensed under the MIT. | ||
}, | ||
'build a primitive type name': function(test) { | ||
'Build a primitive type name': function(test) { | ||
builder.setTypeString('boolean'); | ||
@@ -34,3 +34,3 @@ union = builder.build(); | ||
}, | ||
'build a global type name': function(test) { | ||
'Build a global type name': function(test) { | ||
builder.setTypeString('Window'); | ||
@@ -51,3 +51,3 @@ union = builder.build(); | ||
}, | ||
'build an user-defined type name': function(test) { | ||
'Build an user-defined type name': function(test) { | ||
builder.setTypeString('goog.ui.Menu'); | ||
@@ -68,3 +68,3 @@ union = builder.build(); | ||
}, | ||
'build a generic type has a parameter': function(test) { | ||
'Build a generic type has a parameter': function(test) { | ||
builder.setTypeString('Array.<string>'); | ||
@@ -98,3 +98,3 @@ union = builder.build(); | ||
}, | ||
'build a generic type has 2 parameters': function(test) { | ||
'Build a generic type has 2 parameters': function(test) { | ||
builder.setTypeString('Object.<string, number>'); | ||
@@ -138,3 +138,3 @@ union = builder.build(); | ||
}, | ||
'build a JsDoc-formal generic type': function(test) { | ||
'Build a JsDoc-formal generic type': function(test) { | ||
builder.setTypeString('String[]'); | ||
@@ -168,3 +168,3 @@ union = builder.build(); | ||
}, | ||
'build a formal type union': function(test) { | ||
'Build a formal type union': function(test) { | ||
builder.setTypeString('(number|boolean)'); | ||
@@ -200,3 +200,3 @@ union = builder.build(); | ||
}, | ||
'build a informal type union': function(test) { | ||
'Build a informal type union': function(test) { | ||
builder.setTypeString('number|boolean'); | ||
@@ -232,3 +232,3 @@ union = builder.build(); | ||
}, | ||
'build a record type with an entry': function(test) { | ||
'Build a record type with an entry': function(test) { | ||
builder.setTypeString('{myNum}'); | ||
@@ -263,3 +263,3 @@ union = builder.build(); | ||
}, | ||
'build a record type with 2 entries': function(test) { | ||
'Build a record type with 2 entries': function(test) { | ||
builder.setTypeString('{myNum: number, myObject}'); | ||
@@ -307,3 +307,3 @@ union = builder.build(); | ||
}, | ||
'build a generic type has a parameter as a record type': function(test) { | ||
'Build a generic type has a parameter as a record type': function(test) { | ||
builder.setTypeString('Array.<{length}>'); | ||
@@ -352,3 +352,3 @@ union = builder.build(); | ||
}, | ||
'build a nullable type has a nullable type operator on the head': function(test) { | ||
'Build a nullable type has a nullable type operator on the head': function(test) { | ||
builder.setTypeString('?number'); | ||
@@ -369,3 +369,3 @@ union = builder.build(); | ||
}, | ||
'build a nullable type has a nullable type operator on the tail': function(test) { | ||
'Build a nullable type has a nullable type operator on the tail': function(test) { | ||
builder.setTypeString('goog.ui.Component?'); | ||
@@ -386,3 +386,3 @@ union = builder.build(); | ||
}, | ||
'build a non-nullable type has a nullable type operator on the head': function(test) { | ||
'Build a non-nullable type has a nullable type operator on the head': function(test) { | ||
builder.setTypeString('!Object'); | ||
@@ -403,3 +403,3 @@ union = builder.build(); | ||
}, | ||
'build a non-nullable type has a nullable type operator on the tail': function(test) { | ||
'Build a non-nullable type has a nullable type operator on the tail': function(test) { | ||
builder.setTypeString('Object!'); | ||
@@ -420,3 +420,3 @@ union = builder.build(); | ||
}, | ||
'build a function type': function(test) { | ||
'Build a function type': function(test) { | ||
builder.setTypeString('Function'); | ||
@@ -437,3 +437,3 @@ union = builder.build(); | ||
}, | ||
'build a function type has no parameters': function(test) { | ||
'Build a function type has no parameters': function(test) { | ||
builder.setTypeString('function()'); | ||
@@ -459,3 +459,3 @@ union = builder.build(); | ||
}, | ||
'build a function type has a parameter': function(test) { | ||
'Build a function type has a parameter': function(test) { | ||
builder.setTypeString('function(string)'); | ||
@@ -491,3 +491,3 @@ union = builder.build(); | ||
}, | ||
'build a function type has 2 parameters': function(test) { | ||
'Build a function type has 2 parameters': function(test) { | ||
builder.setTypeString('function(string, boolean)'); | ||
@@ -533,3 +533,3 @@ union = builder.build(); | ||
}, | ||
'build a function type has a return': function(test) { | ||
'Build a function type has a return': function(test) { | ||
builder.setTypeString('function(): number'); | ||
@@ -564,3 +564,3 @@ union = builder.build(); | ||
}, | ||
'build a function type has a context': function(test) { | ||
'Build a function type has a context': function(test) { | ||
builder.setTypeString('function(this:goog.ui.Menu, string)'); | ||
@@ -605,3 +605,3 @@ union = builder.build(); | ||
}, | ||
'build a constructor type': function(test) { | ||
'Build a constructor type': function(test) { | ||
builder.setTypeString('function(new:goog.ui.Menu, string)'); | ||
@@ -646,3 +646,3 @@ union = builder.build(); | ||
}, | ||
'build a function type has a variable parameter': function(test) { | ||
'Build a function type has a variable parameter': function(test) { | ||
builder.setTypeString('function(string, ...[number]): number'); | ||
@@ -697,3 +697,3 @@ union = builder.build(); | ||
}, | ||
'build a function type has parameters have some type operators': function(test) { | ||
'Build a function type has parameters have some type operators': function(test) { | ||
builder.setTypeString('function(?string=, number=)'); | ||
@@ -739,3 +739,3 @@ union = builder.build(); | ||
}, | ||
'build a goog.ui.Component#forEachChild': function(test) { | ||
'Build a goog.ui.Component#forEachChild': function(test) { | ||
builder.setTypeString('function(this:T,?,number):?'); | ||
@@ -797,3 +797,3 @@ union = builder.build(); | ||
}, | ||
'build a variable type': function(test) { | ||
'Build a variable type': function(test) { | ||
builder.setTypeString('...number'); | ||
@@ -813,3 +813,3 @@ union = builder.build(); | ||
}, | ||
'build an optional type has an optional type operator on the head': function(test) { | ||
'Build an optional type has an optional type operator on the head': function(test) { | ||
builder.setTypeString('=number'); | ||
@@ -830,3 +830,3 @@ union = builder.build(); | ||
}, | ||
'build an optional type has an optional type operator on the tail': function(test) { | ||
'Build an optional type has an optional type operator on the tail': function(test) { | ||
builder.setTypeString('number='); | ||
@@ -847,3 +847,3 @@ union = builder.build(); | ||
}, | ||
'build an optional type with a "undefined" keyword': function(test) { | ||
'Build an optional type with a "undefined" keyword': function(test) { | ||
builder.setTypeString('Object|undefined'); | ||
@@ -864,3 +864,3 @@ union = builder.build(); | ||
}, | ||
'build an optional type with a "void" keyword': function(test) { | ||
'Build an optional type with a "void" keyword': function(test) { | ||
builder.setTypeString('Object|void'); | ||
@@ -881,3 +881,3 @@ union = builder.build(); | ||
}, | ||
'build an all type': function(test) { | ||
'Build an all type': function(test) { | ||
builder.setTypeString('*'); | ||
@@ -897,3 +897,3 @@ union = builder.build(); | ||
}, | ||
'build an unknown type': function(test) { | ||
'Build an unknown type': function(test) { | ||
builder.setTypeString('?'); | ||
@@ -913,3 +913,3 @@ union = builder.build(); | ||
}, | ||
'build an unknown type with an "unknown" keyword': function(test) { | ||
'Build an unknown type with an "unknown" keyword': function(test) { | ||
builder.setTypeString('unknown'); | ||
@@ -929,3 +929,33 @@ union = builder.build(); | ||
}, | ||
'build an illegal generic type': function(test) { | ||
'Build an undefined type with an "undefined" keyword': function(test) { | ||
builder.setTypeString('undefined'); | ||
union = builder.build(); | ||
test.equal(union.types.length, 0); | ||
test.equal(union.optional, true); | ||
test.equal(union.nullable, false); | ||
test.equal(union.nonNullable, false); | ||
test.equal(union.variable, false); | ||
test.equal(union.all, false); | ||
test.equal(union.unknown, false); | ||
test.equal(union.toString(), 'undefined'); | ||
test.equal(union.toHtml(), 'undefined'); | ||
test.done(); | ||
}, | ||
'Build a null type with an "null" keyword': function(test) { | ||
builder.setTypeString('null'); | ||
union = builder.build(); | ||
test.equal(union.types.length, 0); | ||
test.equal(union.optional, false); | ||
test.equal(union.nullable, true); | ||
test.equal(union.nonNullable, false); | ||
test.equal(union.variable, false); | ||
test.equal(union.all, false); | ||
test.equal(union.unknown, false); | ||
test.equal(union.toString(), 'null'); | ||
test.equal(union.toHtml(), 'null'); | ||
test.done(); | ||
}, | ||
'Build an illegal generic type': function(test) { | ||
builder.setTypeString('Array.<a'); | ||
@@ -943,3 +973,3 @@ union = builder.build(); | ||
}, | ||
'build an illegal function type': function(test) { | ||
'Build an illegal function type': function(test) { | ||
builder.setTypeString('function(string:'); | ||
@@ -957,3 +987,3 @@ union = builder.build(); | ||
}, | ||
'build an illegal type union': function(test) { | ||
'Build an illegal type union': function(test) { | ||
builder.setTypeString('|string'); | ||
@@ -960,0 +990,0 @@ union = builder.build(); |
@@ -43,103 +43,103 @@ // This script licensed under the MIT. | ||
}, | ||
'analize a primitive type name': function(test) { | ||
'Analize a primitive type name': function(test) { | ||
lexer.analize('boolean'); | ||
test.done(); | ||
}, | ||
'analize a global type name': function(test) { | ||
'Analize a global type name': function(test) { | ||
lexer.analize('Window'); | ||
test.done(); | ||
}, | ||
'analize an user-defined type name': function(test) { | ||
'Analize an user-defined type name': function(test) { | ||
lexer.analize('goog.ui.Menu'); | ||
test.done(); | ||
}, | ||
'analize a generic type has a parameter': function(test) { | ||
'Analize a generic type has a parameter': function(test) { | ||
lexer.analize('Array.<string>'); | ||
test.done(); | ||
}, | ||
'analize a generic type has 2 parameters': function(test) { | ||
'Analize a generic type has 2 parameters': function(test) { | ||
lexer.analize('Object.<string, number>'); | ||
test.done(); | ||
}, | ||
'analize a JsDoc-formal generic type': function(test) { | ||
'Analize a JsDoc-formal generic type': function(test) { | ||
lexer.analize('String[]'); | ||
test.done(); | ||
}, | ||
'analize a formal type union': function(test) { | ||
'Analize a formal type union': function(test) { | ||
lexer.analize('(number|boolean)'); | ||
test.done(); | ||
}, | ||
'analize a informal type union': function(test) { | ||
'Analize a informal type union': function(test) { | ||
lexer.analize('number|boolean'); | ||
test.done(); | ||
}, | ||
'analize a record type with an entry': function(test) { | ||
'Analize a record type with an entry': function(test) { | ||
lexer.analize('{myNum}'); | ||
test.done(); | ||
}, | ||
'analize a record type with 2 entries': function(test) { | ||
'Analize a record type with 2 entries': function(test) { | ||
lexer.analize('{myNum: number, myObject}'); | ||
test.done(); | ||
}, | ||
'analize a generic type has a parameter as a record type': function(test) { | ||
'Analize a generic type has a parameter as a record type': function(test) { | ||
lexer.analize('Array.<{length}>'); | ||
test.done(); | ||
}, | ||
'analize a nullable type has a nullable type operator on the head': function(test) { | ||
'Analize a nullable type has a nullable type operator on the head': function(test) { | ||
lexer.analize('?number'); | ||
test.done(); | ||
}, | ||
'analize a nullable type has a nullable type operator on the tail': function(test) { | ||
'Analize a nullable type has a nullable type operator on the tail': function(test) { | ||
lexer.analize('goog.ui.Component?'); | ||
test.done(); | ||
}, | ||
'analize a non-nullable type has a nullable type operator on the head': function(test) { | ||
'Analize a non-nullable type has a nullable type operator on the head': function(test) { | ||
lexer.analize('!Object'); | ||
test.done(); | ||
}, | ||
'analize a non-nullable type has a nullable type operator on the tail': function(test) { | ||
'Analize a non-nullable type has a nullable type operator on the tail': function(test) { | ||
lexer.analize('Object!'); | ||
test.done(); | ||
}, | ||
'analize a function type': function(test) { | ||
'Analize a function type': function(test) { | ||
lexer.analize('Function'); | ||
test.done(); | ||
}, | ||
'analize a function type has no parameters': function(test) { | ||
'Analize a function type has no parameters': function(test) { | ||
lexer.analize('function()'); | ||
test.done(); | ||
}, | ||
'analize a function type has a parameter': function(test) { | ||
'Analize a function type has a parameter': function(test) { | ||
lexer.analize('function(string)'); | ||
test.done(); | ||
}, | ||
'analize a function type has 2 parameters': function(test) { | ||
'Analize a function type has 2 parameters': function(test) { | ||
lexer.analize('function(string, boolean)'); | ||
test.done(); | ||
}, | ||
'analize a function type has a return': function(test) { | ||
'Analize a function type has a return': function(test) { | ||
lexer.analize('function(): number'); | ||
test.done(); | ||
}, | ||
'analize a function type has a context': function(test) { | ||
'Analize a function type has a context': function(test) { | ||
lexer.analize('function(this:goog.ui.Menu, string)'); | ||
test.done(); | ||
}, | ||
'analize a constructor type': function(test) { | ||
'Analize a constructor type': function(test) { | ||
lexer.analize('function(new:goog.ui.Menu, string)'); | ||
test.done(); | ||
}, | ||
'analize a function type has a variable parameter': function(test) { | ||
'Analize a function type has a variable parameter': function(test) { | ||
lexer.analize('function(string, ...[number]): number'); | ||
test.done(); | ||
}, | ||
'analize a function type has parameters have some type operators': function(test) { | ||
'Analize a function type has parameters have some type operators': function(test) { | ||
lexer.analize('function(?string=, number=)'); | ||
test.done(); | ||
}, | ||
'analize a goog.ui.Component#forEachChild': function(test) { | ||
'Analize a goog.ui.Component#forEachChild': function(test) { | ||
lexer.analize('function(this:T,?,number):?'); | ||
test.done(); | ||
}, | ||
'analize a goog.ui.Component#forEachChild without callbacks': function(test) { | ||
'Analize a goog.ui.Component#forEachChild without callbacks': function(test) { | ||
var lexer = new TypeLexer(); | ||
@@ -149,35 +149,35 @@ lexer.analize('function(this:T,?,number):?'); | ||
}, | ||
'analize a variable type': function(test) { | ||
'Analize a variable type': function(test) { | ||
lexer.analize('...number'); | ||
test.done(); | ||
}, | ||
'analize an optional type has an optional type operator on the head': function(test) { | ||
'Analize an optional type has an optional type operator on the head': function(test) { | ||
lexer.analize('=number'); | ||
test.done(); | ||
}, | ||
'analize an optional type has an optional type operator on the tail': function(test) { | ||
'Analize an optional type has an optional type operator on the tail': function(test) { | ||
lexer.analize('number='); | ||
test.done(); | ||
}, | ||
'analize an optional type with a "undefined" keyword': function(test) { | ||
'Analize an optional type with a "undefined" keyword': function(test) { | ||
lexer.analize('Object|undefined'); | ||
test.done(); | ||
}, | ||
'analize an optional type with a "void" keyword': function(test) { | ||
'Analize an optional type with a "void" keyword': function(test) { | ||
lexer.analize('Object|void'); | ||
test.done(); | ||
}, | ||
'analize an all type': function(test) { | ||
'Analize an all type': function(test) { | ||
lexer.analize('*'); | ||
test.done(); | ||
}, | ||
'analize an unknown type': function(test) { | ||
'Analize an unknown type': function(test) { | ||
lexer.analize('?'); | ||
test.done(); | ||
}, | ||
'analize an unknown type with an "unknown" keyword': function(test) { | ||
'Analize an unknown type with an "unknown" keyword': function(test) { | ||
lexer.analize('unknown'); | ||
test.done(); | ||
}, | ||
'analize an illegal generic type': function(test) { | ||
'Analize an illegal generic type': function(test) { | ||
test.throws(function() { | ||
@@ -188,3 +188,3 @@ lexer.analize('Array.<a'); | ||
}, | ||
'analize an illegal function type': function(test) { | ||
'Analize an illegal function type': function(test) { | ||
test.throws(function() { | ||
@@ -195,3 +195,3 @@ lexer.analize('function(string:'); | ||
}, | ||
'analize an illegal type union': function(test) { | ||
'Analize an illegal type union': function(test) { | ||
test.throws(function() { | ||
@@ -198,0 +198,0 @@ lexer.analize('|string'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
108342
3327
1
13