Loading lib/jsduck/ast.rb +2 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,8 @@ module JsDuck "Array" elsif v.is_a?(Hash) "Object" elsif v == nil && ast["type"] == "Literal" && ast["raw"] =~ /\A\// "RegExp" else nil end Loading spec/ast_property_spec.rb +4 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ describe "JsDuck::Ast detects property with" do detect("/** */ var foo = false;")[:type].should == "Boolean" end it "regex" do detect("/** */ var foo = /abc/g;")[:type].should == "RegExp" end it "array" do detect("/** */ var foo = [];")[:type].should == "Array" end Loading Loading
lib/jsduck/ast.rb +2 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,8 @@ module JsDuck "Array" elsif v.is_a?(Hash) "Object" elsif v == nil && ast["type"] == "Literal" && ast["raw"] =~ /\A\// "RegExp" else nil end Loading
spec/ast_property_spec.rb +4 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ describe "JsDuck::Ast detects property with" do detect("/** */ var foo = false;")[:type].should == "Boolean" end it "regex" do detect("/** */ var foo = /abc/g;")[:type].should == "RegExp" end it "array" do detect("/** */ var foo = [];")[:type].should == "Array" end Loading