{"id":19469018,"url":"https://github.com/adalinesimonian/jshiki","last_synced_at":"2025-04-25T11:32:54.447Z","repository":{"id":38971602,"uuid":"42029039","full_name":"adalinesimonian/jshiki","owner":"adalinesimonian","description":"Lightweight expression parsing and execution library for Node.js","archived":false,"fork":false,"pushed_at":"2024-11-01T18:48:06.000Z","size":5181,"stargazers_count":5,"open_issues_count":17,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-01T19:29:33.120Z","etag":null,"topics":["acorn","expression-evaluator","expression-parser","expressions","javascript","nodejs","npm","typescript"],"latest_commit_sha":null,"homepage":"https://jshiki.io","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/adalinesimonian.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["adalinesimonian"]}},"created_at":"2015-09-07T03:18:13.000Z","updated_at":"2023-01-11T19:55:07.000Z","dependencies_parsed_at":"2023-02-06T21:15:37.958Z","dependency_job_id":"bb202933-e8f4-4606-887d-b359be440165","html_url":"https://github.com/adalinesimonian/jshiki","commit_stats":{"total_commits":222,"total_committers":5,"mean_commits":44.4,"dds":0.472972972972973,"last_synced_commit":"a637e7eaf804e1b23092efc6aef47fd31bd8ecc8"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adalinesimonian%2Fjshiki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adalinesimonian%2Fjshiki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adalinesimonian%2Fjshiki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adalinesimonian%2Fjshiki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adalinesimonian","download_url":"https://codeload.github.com/adalinesimonian/jshiki/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224000418,"owners_count":17238978,"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","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":["acorn","expression-evaluator","expression-parser","expressions","javascript","nodejs","npm","typescript"],"created_at":"2024-11-10T18:45:51.661Z","updated_at":"2024-11-10T18:45:53.610Z","avatar_url":"https://github.com/adalinesimonian.png","language":"TypeScript","funding_links":["https://github.com/sponsors/adalinesimonian"],"categories":[],"sub_categories":[],"readme":"![j式 — jshiki](assets/logo/jshiki-readme-banner.svg)\n\n\u003ch2 align=\"center\"\u003eSafe and Easy Expression Evaluation for Node.js\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/adalinesimonian/jshiki/actions/workflows/main-test.yml\"\u003e\u003cimg alt=\"Build Status\" src=\"https://github.com/adalinesimonian/jshiki/actions/workflows/main-test.yml/badge.svg?branch=main\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://app.codecov.io/gh/adalinesimonian/jshiki\"\u003e\u003cimg alt=\"Codecov Coverage Status\" src=\"https://codecov.io/gh/adalinesimonian/jshiki/branch/main/graph/badge.svg?token=SrIwZvl2YA\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/jshiki\"\u003e\u003cimg alt=\"npm Version\" src=\"https://img.shields.io/npm/v/jshiki.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e\u003ca href=\"https://jshiki.io/latest/user-guide/\"\u003eDocumentation\u003c/a\u003e\u003c/strong\u003e |\n  \u003cstrong\u003e\u003ca href=\"https://github.com/adalinesimonian/jshiki/blob/main/CHANGELOG.md\"\u003eChange Log\u003c/a\u003e\u003c/strong\u003e\n\u003c/p\u003e\n\n---\n\njshiki provides a safe and easy way to evaluate expressions without worrying about external data being overwritten or accessed in unexpected ways. jshiki only has one lightweight dependency, [acorn], which it uses to parse expressions.\n\n\u003e **IMPORTANT!** jshiki is not a true sandbox. If you need to be able to evaluate arbitrary code of unknown origin, you may want to consider using [vm2] or a similar library.\n\n### Basic Usage\n\n```js\nconst jshiki = require('jshiki')\n\nlet result = jshiki.evaluate('(5 + 7) / 3') // result =\u003e 4\n// or\nlet expression = jshiki.parse('(5 + 7) / 3')\nresult = expression() // result =\u003e 4\n```\n\n### Accessing data\n\n```js\nconst code = \"`Hello! My name's ${name.trim()}`\"\n\nexpression = jshiki.parse(code)\nresult = expression({ name: ' Azumi ' })\n// result =\u003e \"Hello! My name's Azumi\"\n\n// or\nresult = jshiki.evaluate(code, {\n  scope: { name: ' Azumi ' },\n})\n// result =\u003e \"Hello! My name's Azumi\"\n```\n\n### Asynchronous evaluation\n\n```js\nconst asyncCode = \"`I'm ${await status()}...`\"\n\nexpression = jshiki.parseAsync(asyncCode)\nresult = await expression({\n  status: async () =\u003e 'waiting',\n})\n// result =\u003e \"I'm waiting...\"\n\n// or\nresult = await jshiki.evaluateAsync(asyncCode, {\n  scope: { status: async () =\u003e 'waiting' },\n})\n// result =\u003e \"I'm waiting...\"\n```\n\nFor more examples, features, and information on how to use jshiki, see the [documentation].\n\n## Discussion\n\nDiscuss jshiki on [GitHub discussions]. Make sure to follow the [code of conduct].\n\n## Contributing\n\nIf you're looking for a way to contribute to jshiki, see the [contribution guide].\n\n## Licence\n\n[MIT](LICENCE)\n\n[acorn]: https://github.com/acornjs/acorn\n[vm2]: https://github.com/patriksimek/vm2\n[documentation]: https://jshiki.io/latest/user-guide/\n[github discussions]: https://github.com/adalinesimonian/jshiki/discussions\n[code of conduct]: CODE_OF_CONDUCT.md\n[contribution guide]: CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadalinesimonian%2Fjshiki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadalinesimonian%2Fjshiki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadalinesimonian%2Fjshiki/lists"}