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

jsdc

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdc - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

9

demo/Ai.js

@@ -245,2 +245,6 @@ (function() {

}
if(document.currentScript) {
fetch(module, document.currentScript.src || location.href.replace(/#.*/, ''));
return;
}
//ie下利用interactive特�?降低并发情况下非�?��性错误几�?

@@ -508,3 +512,3 @@ if(interactive) {

lock[id].shift();
if(lock[id].length) {
while(lock[id].length) {
var w = lock[id][0];

@@ -519,2 +523,5 @@ if(w.execed) {

}
else {
break;
}
}

@@ -521,0 +528,0 @@ });

2

demo/jssc.js

@@ -10,3 +10,3 @@ define(function(require, exports) {

function getText(node) {
return node.textContent || node.innerText || node.firstChild ? node.firstChild.nodeValue : '';
return node.textContent || node.innerText || (node.firstChild ? node.firstChild.nodeValue : '');
}

@@ -13,0 +13,0 @@ function parse(nodes) {

{
"name": "jsdc",
"version": "0.1.2",
"version": "0.1.3",
"description": "transform ecmascript6 to ecmascript5",

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

"engines": {
"node": ">= 0.11.0"
"node": ">= 0.10.0"
},
"readmeFilename": "README.md"
}

@@ -22,7 +22,6 @@ var Lexer = require('./lexer/Lexer'),

function init() {
function init(ignore) {
index = 0;
preHash = {};
res = '';
env = [0];
temp = '';

@@ -35,2 +34,6 @@ fold = null;

classes = [];
while(ignore[index]) {
res += ignore[index++].content();
}
env = [res.length];
}

@@ -193,3 +196,3 @@ function join(node, ignore) {

//����forEach
end = /([;\s\r\n])*$/.exec(res)[1];
end = /([,;\s\r\n])*$/.exec(res)[1];
end = res.length - end.length;

@@ -382,3 +385,3 @@ prefix = res.slice(0, end);

}
init();
init(ignore);
try {

@@ -385,0 +388,0 @@ join(node, ignore);

@@ -35,4 +35,6 @@ var Rule = require('./Rule'),

self.addMatch(new CompleteEqual(Token.SIGN, ']', Lexer.NOT_REG));
['~', '*=', '/=', '+=', '-=', '%=', '^=', '&=', '|=', '%', '^', '&&', '&', '*', '(', ')', '--', '-', '++', '+', '===', '==', '=', '!==', '!=', '!', '[', '{', '}', '||', '|', '\\', '>>>=', '<<<=', '<<<', '>>>', '>>=', '<<=', '<<', '>>', '>=', '<=', '<', '>', ',', '...', '.', '?:', '?', ':', ';', '/'].forEach(function(o) {
self.addMatch(new CompleteEqual(Token.SIGN, o, Lexer.IS_REG));
EcmascriptRule.SIGN.forEach(function(o) {
if(o != ']') {
self.addMatch(new CompleteEqual(Token.SIGN, o, Lexer.IS_REG));
}
});

@@ -47,4 +49,5 @@

}).statics({
KEYWORDS: 'abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface let long native new package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with'.split(' ')
KEYWORDS: 'abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with'.split(' '),
SIGN: ['~', '*=', '/=', '+=', '-=', '%=', '^=', '&=', '|=', '%', '^', '&&', '&', '*', '(', ')', '--', '-', '++', '+', '===', '==', '=', '!==', '!=', '!', '[', ']', '{', '}', '||', '|', '\\', '>>>=', '<<<=', '<<<', '>>>', '>>=', '<<=', '<<', '>>', '>=', '<=', '<', '>', ',', '...', '.', '?:', '?', ':', ';', '/']
});
module.exports = EcmascriptRule;
var Class = require('../util/Class'),
character = require('../util/character'),
types,
types = {},
Token = Class(function(type, content) {

@@ -19,2 +19,8 @@ this.t = type;

return Token.type(this.t);
},
val: function() {
if(this.t == Token.SIGN || this.t == Token.KEYWORD) {
return this.c;
}
return Token.type(this.t);
}

@@ -39,13 +45,8 @@ }).statics({

type: function(tag) {
if(character.isUndefined(types)) {
types = [];
Object.keys(Token).forEach(function(o) {
if(typeof Token[o] == 'number') {
types[Token[o]] = o;
}
});
}
return types[tag];
}
});
Object.keys(Token).forEach(function(o) {
types[Token[o]] = o.toLowerCase();
});
module.exports = Token;
var Class = require('../util/Class'),
Node = Class(function(type, token) {
Node = Class(function(type, children) {
this.type = type;
if(token) {
this.children = token;
if(type == Node.TOKEN) {
this.children = children;
}
else if(Array.isArray(children)) {
this.children = children;
}
else {
this.children = [];
this.children = children ? [children] : [];
}

@@ -35,2 +38,5 @@ return this;

}).statics({
PROGRAM: 'program',
ELEMS: 'elems',
ELEM: 'elem',
CSTSTMT: 'cststmt',

@@ -40,6 +46,7 @@ LETSTMT: 'letstmt',

VARDECL: 'vardecl',
VARDECLS: 'vardecls',
FNBODY: 'fnbody',
BLOCK: 'block',
ITERSTMT: 'iterstmt',
TOKEN: 'Token',
TOKEN: 'token',
FNPARAMS: 'fnparams',

@@ -46,0 +53,0 @@ BINDELEMENT: 'bindelement',

@@ -6,3 +6,7 @@ var Class = require('../util/Class'),

Node = require('./Node'),
Parser = Class(function(lexer) {
S = {},
SS = {};
S[Token.BLANK] = S[Token.TAB] = S[Token.COMMENT] = S[Token.LINE] = S[Token.ENTER] = true;
SS[Token.BLANK] = SS[Token.TAB] = SS[Token.ENTER] = true;
var Parser = Class(function(lexer) {
this.lexer = lexer;

@@ -106,7 +110,13 @@ this.look = null;

var token = this.tokens[i];
if([Token.BLANK, Token.TAB, Token.COMMENT, Token.LINE, Token.ENTER].indexOf(token.type()) != -1) {
if(S[token.type()]) {
if(token.content() == ':') {
return this.labstmt();
}
else {
break;
}
}
else {
break;
}
}

@@ -1287,3 +1297,3 @@ }

//���º��Ե�token
if([Token.BLANK, Token.TAB, Token.ENTER, Token.LINE, Token.COMMENT].indexOf(this.look.type()) != -1) {
if(S[this.look.type()]) {
this.ignores[this.index - 1] = this.look;

@@ -1324,3 +1334,3 @@ }

this.col += this.look.content().length;
if([Token.BLANK, Token.TAB, Token.ENTER].indexOf(this.look.type()) == -1) {
if(!SS[this.look.type()]) {
break;

@@ -1327,0 +1337,0 @@ }

@@ -23,7 +23,6 @@ define(function(require, exports) {

function init() {
function init(ignore) {
index = 0;
preHash = {};
res = '';
env = [0];
temp = '';

@@ -36,2 +35,6 @@ fold = null;

classes = [];
while(ignore[index]) {
res += ignore[index++].content();
}
env = [res.length];
}

@@ -194,3 +197,3 @@ function join(node, ignore) {

//����forEach
end = /([;\s\r\n])*$/.exec(res)[1];
end = /([,;\s\r\n])*$/.exec(res)[1];
end = res.length - end.length;

@@ -383,3 +386,3 @@ prefix = res.slice(0, end);

}
init();
init(ignore);
try {

@@ -386,0 +389,0 @@ join(node, ignore);

@@ -36,4 +36,6 @@ define(function(require, exports, module) {

self.addMatch(new CompleteEqual(Token.SIGN, ']', Lexer.NOT_REG));
['~', '*=', '/=', '+=', '-=', '%=', '^=', '&=', '|=', '%', '^', '&&', '&', '*', '(', ')', '--', '-', '++', '+', '===', '==', '=', '!==', '!=', '!', '[', '{', '}', '||', '|', '\\', '>>>=', '<<<=', '<<<', '>>>', '>>=', '<<=', '<<', '>>', '>=', '<=', '<', '>', ',', '...', '.', '?:', '?', ':', ';', '/'].forEach(function(o) {
self.addMatch(new CompleteEqual(Token.SIGN, o, Lexer.IS_REG));
EcmascriptRule.SIGN.forEach(function(o) {
if(o != ']') {
self.addMatch(new CompleteEqual(Token.SIGN, o, Lexer.IS_REG));
}
});

@@ -48,5 +50,6 @@

}).statics({
KEYWORDS: 'abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface let long native new package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with'.split(' ')
KEYWORDS: 'abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with'.split(' '),
SIGN: ['~', '*=', '/=', '+=', '-=', '%=', '^=', '&=', '|=', '%', '^', '&&', '&', '*', '(', ')', '--', '-', '++', '+', '===', '==', '=', '!==', '!=', '!', '[', ']', '{', '}', '||', '|', '\\', '>>>=', '<<<=', '<<<', '>>>', '>>=', '<<=', '<<', '>>', '>=', '<=', '<', '>', ',', '...', '.', '?:', '?', ':', ';', '/']
});
module.exports = EcmascriptRule;
});
define(function(require, exports, module) {
var Class = require('../util/Class'),
character = require('../util/character'),
types,
types = {},
Token = Class(function(type, content) {

@@ -20,2 +20,8 @@ this.t = type;

return Token.type(this.t);
},
val: function() {
if(this.t == Token.SIGN || this.t == Token.KEYWORD) {
return this.c;
}
return Token.type(this.t);
}

@@ -40,14 +46,9 @@ }).statics({

type: function(tag) {
if(character.isUndefined(types)) {
types = [];
Object.keys(Token).forEach(function(o) {
if(typeof Token[o] == 'number') {
types[Token[o]] = o;
}
});
}
return types[tag];
}
});
Object.keys(Token).forEach(function(o) {
types[Token[o]] = o.toLowerCase();
});
module.exports = Token;
});
define(function(require, exports, module) {
var Class = require('../util/Class'),
Node = Class(function(type, token) {
Node = Class(function(type, children) {
this.type = type;
if(token) {
this.children = token;
if(type == Node.TOKEN) {
this.children = children;
}
else if(Array.isArray(children)) {
this.children = children;
}
else {
this.children = [];
this.children = children ? [children] : [];
}

@@ -36,2 +39,5 @@ return this;

}).statics({
PROGRAM: 'program',
ELEMS: 'elems',
ELEM: 'elem',
CSTSTMT: 'cststmt',

@@ -41,6 +47,7 @@ LETSTMT: 'letstmt',

VARDECL: 'vardecl',
VARDECLS: 'vardecls',
FNBODY: 'fnbody',
BLOCK: 'block',
ITERSTMT: 'iterstmt',
TOKEN: 'Token',
TOKEN: 'token',
FNPARAMS: 'fnparams',

@@ -47,0 +54,0 @@ BINDELEMENT: 'bindelement',

@@ -7,3 +7,7 @@ define(function(require, exports, module) {

Node = require('./Node'),
Parser = Class(function(lexer) {
S = {},
SS = {};
S[Token.BLANK] = S[Token.TAB] = S[Token.COMMENT] = S[Token.LINE] = S[Token.ENTER] = true;
SS[Token.BLANK] = SS[Token.TAB] = SS[Token.ENTER] = true;
var Parser = Class(function(lexer) {
this.lexer = lexer;

@@ -107,7 +111,13 @@ this.look = null;

var token = this.tokens[i];
if([Token.BLANK, Token.TAB, Token.COMMENT, Token.LINE, Token.ENTER].indexOf(token.type()) != -1) {
if(S[token.type()]) {
if(token.content() == ':') {
return this.labstmt();
}
else {
break;
}
}
else {
break;
}
}

@@ -1288,3 +1298,3 @@ }

//���º��Ե�token
if([Token.BLANK, Token.TAB, Token.ENTER, Token.LINE, Token.COMMENT].indexOf(this.look.type()) != -1) {
if(S[this.look.type()]) {
this.ignores[this.index - 1] = this.look;

@@ -1325,3 +1335,3 @@ }

this.col += this.look.content().length;
if([Token.BLANK, Token.TAB, Token.ENTER].indexOf(this.look.type()) == -1) {
if(!SS[this.look.type()]) {
break;

@@ -1328,0 +1338,0 @@ }

Sorry, the diff of this file is not supported yet

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