
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A tiny JavaScript interpreter written in TypeScript
Note: This project is experimental and not all JavaScript features are implemented! 1
Execute some JavaScript code:
// const Jinter = require('jintr').default;
import Jinter from 'jintr';
const code = `
function sayHiTo(person) {
console.log('Hi ' + person + '!');
}
sayHiTo('mom');
`
const jinter = new Jinter(code);
jinter.interpret();
Inject your own functions and variables into the interpreter;
// ...
jinter.visitor.on('println', (node: any, visitor: Visitor) => {
const args = node.arguments.map((arg: any) => visitor.visitNode(arg));
return console.log(...args);
});
// Ex: str.toArray();
jinter.visitor.on('toArray', (node: any, visitor: Visitor) => {
const obj = visitor.visitNode(node.callee.object);
return obj.split('');
});
// Or you can just intercept access to specific nodes;
jinter.visitor.on('myFn', (node: any, visitor: Visitor) => {
console.info('MyFn node just got accessed:', node);
return 'proceed'; // tells the interpreter to continue execution
});
jinter.interpret();
More examples are available in the test
& examples
folders.
Distributed under the MIT License.
This project was originally developed for use in YouTube.js. ↩
FAQs
A tiny JavaScript interpreter written in TypeScript.
The npm package jintr receives a total of 18,097 weekly downloads. As such, jintr popularity was classified as popular.
We found that jintr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.