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

homunculus

Package Overview
Dependencies
Maintainers
2
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homunculus - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

22

dist/parser/es6/Parser.js

@@ -72,13 +72,12 @@ (function(factory) {

if(this.look) {
for(var i = 0; i < this.length; i++) {
if({
'export': true,
'import': true,
'module': true
}.hasOwnProperty(this.look.content())) {
node.add(this.modulebody());
node.add(this.modulebody());
//未出现export时,此script不是一个模块
var leaves = node.leaf(0).leaves();
for(i = 0; i < leaves.length; i++) {
if(leaves[i].name() == Node.EXPORTDECL) {
return node;
}
}
node.add(this.scriptbody());
node.leaf(0).name(Node.SCRIPTBODY);
return node;
}

@@ -263,9 +262,2 @@ return node;

},
scriptbody: function() {
var node = new Node(Node.SCRIPTBODY);
while(this.look) {
node.add(this.stmtlitem());
}
return node;
},
stmtlitem: function(yYield) {

@@ -272,0 +264,0 @@ if(['function', 'class', 'let', 'const'].indexOf(this.look.content()) > -1) {

@@ -10,2 +10,3 @@ (function(factory) {

var Class = require('../util/Class');
var character = require('../util/character');
var Node = Class(function(type, children) {

@@ -27,3 +28,6 @@ this.type = type;

}).methods({
name: function() {
name: function(t) {
if(!character.isUndefined(t)) {
this.type = t;
}
return this.type;

@@ -30,0 +34,0 @@ },

{
"name": "homunculus",
"version": "0.2.1",
"version": "0.2.2",
"description": "A lexer&parser by Javascript",

@@ -5,0 +5,0 @@ "maintainers": [

@@ -101,3 +101,3 @@ # A lexer&parser by Javascript

* constructor(type:String, children:Node/Array<Node> = null) 传入类型和子节点
* name():String 返回节点类型
* name(t:String):String 读取/设置节点类型
* leaves():Array<Node> 返回子节点列表

@@ -104,0 +104,0 @@ * leaf(i:int):Node 返回第i个子节点

@@ -64,13 +64,12 @@ var IParser = require('../Parser');

if(this.look) {
for(var i = 0; i < this.length; i++) {
if({
'export': true,
'import': true,
'module': true
}.hasOwnProperty(this.look.content())) {
node.add(this.modulebody());
node.add(this.modulebody());
//未出现export时,此script不是一个模块
var leaves = node.leaf(0).leaves();
for(i = 0; i < leaves.length; i++) {
if(leaves[i].name() == Node.EXPORTDECL) {
return node;
}
}
node.add(this.scriptbody());
node.leaf(0).name(Node.SCRIPTBODY);
return node;
}

@@ -255,9 +254,2 @@ return node;

},
scriptbody: function() {
var node = new Node(Node.SCRIPTBODY);
while(this.look) {
node.add(this.stmtlitem());
}
return node;
},
stmtlitem: function(yYield) {

@@ -264,0 +256,0 @@ if(['function', 'class', 'let', 'const'].indexOf(this.look.content()) > -1) {

var Class = require('../util/Class');
var character = require('../util/character');
var Node = Class(function(type, children) {

@@ -18,3 +19,6 @@ this.type = type;

}).methods({
name: function() {
name: function(t) {
if(!character.isUndefined(t)) {
this.type = t;
}
return this.type;

@@ -21,0 +25,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