UNPKG

shift-interpreter

Version:

Shift-interpreter is an experimental JavaScript meta-interpreter useful for reverse engineering and analysis. One notable difference from other projects is that shift-interpreter retains state over an entire script but can be fed expressions and statement

39 lines 1.28 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.toString = exports.createReadlineInterface = exports.isBlockType = exports.isStatement = void 0; const readline_1 = __importDefault(require("readline")); function isStatement(node) { return node.type.match(/Statement/) || node.type.match('Declaration') ? true : false; } exports.isStatement = isStatement; function isBlockType(node) { switch (node.type) { case 'Script': case 'FunctionBody': case 'Block': return true; default: return false; } } exports.isBlockType = isBlockType; function createReadlineInterface() { const readline = readline_1.default.createInterface({ input: process.stdin, output: process.stdout, }); return (question) => { return new Promise(resolve => { readline.question(question, resolve); }); }; } exports.createReadlineInterface = createReadlineInterface; function toString(obj) { return obj.toString ? obj.toString() : '' + obj; } exports.toString = toString; //# sourceMappingURL=util.js.map