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.3.4 to 0.3.5

.idea/.name

8

package.json
{
"name": "jsdc",
"version": "0.3.4",
"version": "0.3.5",
"description": "transform ecmascript6 to ecmascript5",

@@ -42,3 +42,5 @@ "maintainers": [

"ecmascript6",
"ecmascript5"
"ecmascript5",
"transform",
"compiler"
],

@@ -51,3 +53,3 @@ "author": "army8735",

"dependencies": {
"homunculus": "^0.2.7-3"
"homunculus": "^0.3.0-2"
},

@@ -54,0 +56,0 @@ "devDependencies": {

@@ -355,3 +355,3 @@ # Javascript Downcast

```
getter/setter会巧妙地设置到原型上:
getter/setter会通过`Object.defineProperty`巧妙地设置到原型上:
```js

@@ -365,7 +365,7 @@ class A{

function A(){}
A.prototype.b={get b(){}}["b"];
A.prototype.c={set c(d){}}["c"];
Object.defineProperty(A.prototype, "b", {get :function(){}});
Object.defineProperty(A.prototype, "c", {set :function(d){}});
```
`static`静态属性会附加在`function`本身:
`static`静态方法会附加在`function`本身:
```js

@@ -372,0 +372,0 @@ class A{

@@ -246,2 +246,5 @@ var homunculus = require('homunculus');

break;
case JsNode.PROPTNAME:
this.klass.prptn(node);
break;
case JsNode.MODULEBODY:

@@ -248,0 +251,0 @@ this.module.enter(node);

@@ -11,2 +11,3 @@ var homunculus = require('homunculus');

this.sup = {};
this.gs = {};
}).methods({

@@ -119,4 +120,8 @@ parse: function(node, start) {

if(start) {
var prptn = first.next();
this.gs[prptn.nid()] = true;
this.jsdc.ignore(prptn);
this.jsdc.append('Object.defineProperty(');
this.jsdc.append(o.name);
this.jsdc.append('.prototype.');
this.jsdc.append('.prototype, "');
if(token.content() == 'get') {

@@ -132,13 +137,6 @@ var n = first.next().first().first().token();

}
this.jsdc.append('={');
this.jsdc.append('", {');
}
else {
this.jsdc.appendBefore('}["');
if(token.content() == 'get') {
this.jsdc.appendBefore(o.g);
}
else {
this.jsdc.appendBefore(o.s);
}
this.jsdc.appendBefore('"];');
this.jsdc.appendBefore('});');
}

@@ -155,2 +153,7 @@ }

},
prptn: function(node) {
if(this.gs.hasOwnProperty(node.nid())) {
this.jsdc.append(':function');
}
},
super: function(node) {

@@ -157,0 +160,0 @@ this.jsdc.ignore(node);

@@ -247,2 +247,5 @@ define(function(require, exports, module) {

break;
case JsNode.PROPTNAME:
this.klass.prptn(node);
break;
case JsNode.MODULEBODY:

@@ -249,0 +252,0 @@ this.module.enter(node);

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

this.sup = {};
this.gs = {};
}).methods({

@@ -120,4 +121,8 @@ parse: function(node, start) {

if(start) {
var prptn = first.next();
this.gs[prptn.nid()] = true;
this.jsdc.ignore(prptn);
this.jsdc.append('Object.defineProperty(');
this.jsdc.append(o.name);
this.jsdc.append('.prototype.');
this.jsdc.append('.prototype, "');
if(token.content() == 'get') {

@@ -133,13 +138,6 @@ var n = first.next().first().first().token();

}
this.jsdc.append('={');
this.jsdc.append('", {');
}
else {
this.jsdc.appendBefore('}["');
if(token.content() == 'get') {
this.jsdc.appendBefore(o.g);
}
else {
this.jsdc.appendBefore(o.s);
}
this.jsdc.appendBefore('"];');
this.jsdc.appendBefore('});');
}

@@ -156,2 +154,7 @@ }

},
prptn: function(node) {
if(this.gs.hasOwnProperty(node.nid())) {
this.jsdc.append(':function');
}
},
super: function(node) {

@@ -158,0 +161,0 @@ this.jsdc.ignore(node);

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