{"id":17954707,"url":"https://github.com/luanrt/jinter","last_synced_at":"2025-10-07T17:08:58.569Z","repository":{"id":56870958,"uuid":"526519869","full_name":"LuanRT/Jinter","owner":"LuanRT","description":"A tiny JavaScript interpreter written in TypeScript ","archived":false,"fork":false,"pushed_at":"2025-09-11T03:37:03.000Z","size":515,"stargazers_count":37,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-18T05:23:31.750Z","etag":null,"topics":["interpreter","javascript","vm"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jintr","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LuanRT.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["LuanRT"],"ko_fi":"luanrt"}},"created_at":"2022-08-19T08:14:14.000Z","updated_at":"2025-09-13T17:02:05.000Z","dependencies_parsed_at":"2023-02-08T09:30:45.403Z","dependency_job_id":"6e0c0c80-3607-4651-b607-b9319c3a08b0","html_url":"https://github.com/LuanRT/Jinter","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.027027027027026973","last_synced_commit":"30a37388ff1503f3ae1852ae8e1875725408a2da"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/LuanRT/Jinter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuanRT%2FJinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuanRT%2FJinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuanRT%2FJinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuanRT%2FJinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuanRT","download_url":"https://codeload.github.com/LuanRT/Jinter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuanRT%2FJinter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278811851,"owners_count":26050183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interpreter","javascript","vm"],"created_at":"2024-10-29T10:19:34.300Z","updated_at":"2025-10-07T17:08:58.543Z","avatar_url":"https://github.com/LuanRT.png","language":"TypeScript","funding_links":["https://github.com/sponsors/LuanRT","https://ko-fi.com/luanrt"],"categories":[],"sub_categories":[],"readme":"[actions]: https://github.com/LuanRT/Jinter/actions\n\n\u003ch1 align=center\u003eJinter\u003c/h1\u003e\n\n\u003cp align=center\u003eA tiny JavaScript interpreter written in TypeScript\n\n\u003cdiv align=\"center\"\u003e\n\n  [![Tests](https://github.com/LuanRT/Jinter/actions/workflows/test.yml/badge.svg?branch=main)][actions]\n\n\n\u003c/div\u003e\n\n\u003e **Note**: This project was originally developed for use in [YouTube.js](https://github.com/LuanRT/YouTube.js).\n\n## Table of Contents \u003c!-- omit in toc --\u003e\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [API](#api)\n  - [`evaluate(input: string)`](#evaluateinput-string)\n  - [`visitor`](#visitor)\n  - [`scope`](#scope)\n- [License](#license)\n\n## Installation\n```sh\nnpm install jintr\n```\n\n## Usage\n\nExecute some JavaScript code:\n```ts\n// const Jinter = require('jintr').default;\nimport { Jinter } from 'jintr';\n\nconst code = `\n  function sayHiTo(person) {\n    console.log('Hi ' + person + '!');\n  }\n  \n  sayHiTo('mom');\n`\n\nconst jinter = new Jinter();\njinter.evaluate(code);\n```\n---\nInject your own functions, objects, etc:\n```ts\nimport { Jinter } from 'jintr';\n\nconst jinter = new Jinter();\n\nconst code = `\n  console.log(new SomeClass().a);\n  console.log('hello'.toArray());\n\n  function myFn() {\n    console.log('[myFn]: Who called me?');\n  }\n\n  myFn();\n`;\n\nclass SomeClass {\n  constructor() {\n    this.a = 'this is a test';\n  }\n}\n\njinter.defineObject('SomeClass', SomeClass);\n\n// Ex: str.toArray();\njinter.visitor.on('toArray', (node, visitor) =\u003e {\n  if (node.type === 'CallExpression' \u0026\u0026 node.callee.type === 'MemberExpression') {\n    const obj = visitor.visitNode(node.callee.object);\n    return obj.split('');\n  }\n});\n\n// Intercept function calls\njinter.visitor.on('myFn', (node) =\u003e {\n  if (node.type == 'CallExpression')\n    console.info('myFn was called!');\n  return '__continue_exec';\n});\n\njinter.evaluate(code);\n```\n\nFor more examples see [`/test`](https://github.com/LuanRT/Jinter/tree/main/test) and [`/examples`](https://github.com/LuanRT/Jinter/tree/main/examples).\n\n## API\n* Jinter()\n  * [`evaluate(input: string)`](#evaluate)\n  * [`visitor`](#visitor)\n  * [`scope`](#scope)\n\n### `evaluate(input: string)`\nEvaluates the given JavaScript code.\n\n### `visitor`\nThe node visitor. This is responsible for walking the AST and executing the nodes.\n\n### `scope`\nRepresents the global scope of the program.\n\n## License\nDistributed under the [MIT](https://choosealicense.com/licenses/mit/) License.\n\n\u003cp align=\"right\"\u003e\n  (\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluanrt%2Fjinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluanrt%2Fjinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluanrt%2Fjinter/lists"}