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

@jeefo/parser

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jeefo/parser - npm Package Compare versions

Comparing version 0.0.27 to 0.0.28

24

ast_node_definition.js
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : ast_node_definition.js
* Created at : 2019-01-26
* Updated at : 2019-10-17
* Updated at : 2021-01-06
* Author : jeefo

@@ -50,17 +50,11 @@ * Purpose :

const Node = (new Function("I_AST_Node", `
class ${ class_name } extends I_AST_Node {
constructor () {
super();
this._id = "${
ast_node_definition.id
}";
this._type = "${
ast_node_definition.type
}";
this._precedence = ${
ast_node_definition.precedence
};
}
function ${class_name} () {
I_AST_Node.call(this);
this._id = "${ast_node_definition.id}";
this._type = "${ast_node_definition.type}";
this._precedence = ${ast_node_definition.precedence};
}
return ${ class_name };
${class_name}.prototype = Object.create(I_AST_Node.prototype);
return ${class_name};
`))(I_AST_Node);

@@ -67,0 +61,0 @@ // jshint evil:false

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : i_ast_node.js
* Created at : 2019-01-27
* Updated at : 2019-09-03
* Updated at : 2021-01-06
* Author : jeefo

@@ -21,55 +21,53 @@ * Purpose :

class I_AST_Node {
constructor () {
if (new.target === I_AST_Node) {
throw new Error("Interface class cannot be instantiated.");
}
function I_AST_Node () {
if (new.target === I_AST_Node) {
throw new Error("Interface class cannot be instantiated.");
}
}
print () {
const properties = Object.keys(this);
if (! properties.includes("id")) {
properties.unshift("id");
}
if (! properties.includes("type")) {
insert_at(properties, "type", 1);
}
if (! properties.includes("precedence")) {
insert_at(properties, "precedence", 2);
}
I_AST_Node.prototype.print = function () {
const properties = Object.keys(this);
if (! properties.includes("id")) {
properties.unshift("id");
}
if (! properties.includes("type")) {
insert_at(properties, "type", 1);
}
if (! properties.includes("precedence")) {
insert_at(properties, "precedence", 2);
}
let max_length = Math.max.apply(null, properties.map(property => property.length));
let rows = properties.map(property => {
let value = this[property];
if (Array.isArray(value)) {
value = `[${ value }]`;
if (value.length > 80) {
value = value.split(',').join(",\n");
}
} else if (typeof value === "string") {
value = value.replace(NEW_LINE_REGEXP, "\\n");
let max_length = Math.max.apply(null, properties.map(property => property.length));
let rows = properties.map(property => {
let value = this[property];
if (Array.isArray(value)) {
value = `[${ value }]`;
if (value.length > 80) {
value = value.split(',').join(",\n");
}
} else if (typeof value === "string") {
value = value.replace(NEW_LINE_REGEXP, "\\n");
}
return `${ property }${ ' '.repeat(max_length - property.length) } : ${ value }`;
});
return `${ property }${ ' '.repeat(max_length - property.length) } : ${ value }`;
});
max_length = Math.max.apply(null, rows.map(row => row.split('\n')[0].length));
rows = rows.map(row => `| ${ row }${ ' '.repeat(max_length - row.split('\n')[0].length) } |`);
max_length = Math.max.apply(null, rows.map(row => row.split('\n')[0].length));
rows = rows.map(row => `| ${ row }${ ' '.repeat(max_length - row.split('\n')[0].length) } |`);
const dash_line = `+${ '-'.repeat(max_length + 2) }+`;
rows.unshift(
dash_line,
`| AST_Node${ ' '.repeat(max_length - "AST_Node".length) } |`,
dash_line
);
rows.push(dash_line);
const dash_line = `+${ '-'.repeat(max_length + 2) }+`;
rows.unshift(
dash_line,
`| AST_Node${ ' '.repeat(max_length - "AST_Node".length) } |`,
dash_line
);
rows.push(dash_line);
console.log(rows.join('\n'));
}
console.log(rows.join('\n'));
};
toString () {
return `<${ this.constructor.name }>`;
}
}
I_AST_Node.prototype.toString = function () {
return `<${this.constructor.name}>`;
};
module.exports = I_AST_Node;
{
"name": "@jeefo/parser",
"version": "0.0.27",
"version": "0.0.28",
"description": "A library for parsing AST nodes. (under developing...)",

@@ -5,0 +5,0 @@ "author": {

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