{"id":21806691,"url":"https://github.com/hungtcs/pico-sandbox","last_synced_at":"2026-05-08T15:04:30.651Z","repository":{"id":37640158,"uuid":"505386788","full_name":"hungtcs/pico-sandbox","owner":"hungtcs","description":"Simple javascript expressions sandbox implement via Function","archived":false,"fork":false,"pushed_at":"2023-04-13T01:03:04.000Z","size":228,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-27T05:50:06.853Z","etag":null,"topics":["sandbox"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hungtcs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-06-20T10:03:06.000Z","updated_at":"2022-06-20T10:10:12.000Z","dependencies_parsed_at":"2024-11-27T12:39:40.965Z","dependency_job_id":null,"html_url":"https://github.com/hungtcs/pico-sandbox","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hungtcs%2Fpico-sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hungtcs%2Fpico-sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hungtcs%2Fpico-sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hungtcs%2Fpico-sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hungtcs","download_url":"https://codeload.github.com/hungtcs/pico-sandbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244759962,"owners_count":20505716,"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":["sandbox"],"created_at":"2024-11-27T12:29:18.370Z","updated_at":"2026-05-08T15:04:25.611Z","avatar_url":"https://github.com/hungtcs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pico Sandbox\n\nSimple javascript expressions sandbox implement via Function.  \n\n## Warning\n\nThe implementation of pico-sandbox is not absolutely secure, as it cannot restrict the JavaScript prototype chain. For example, the following code can bypass the limitations of the sandbox.\n\n```js\n''.constructor.__proto__.constructor(\"alert()\")()\n```\n\n## Installation\n\n```shell\nnpm install pico-sandbox\n```\n\n## Examples\n\n```typescript\nimport { Sandbox } from 'pico-sandbox';\n\nconst parser = Sandbox.compile('a + b');\nconst result = parser({ a: 1, b: 2 });\n\nconsole.log(result); // 3\n```\n\n### Throw On Undefined\n\n```typescript\nconst parser = Sandbox.compile('a + b', { throwOnUndefined: true });\nconst result = parser({ a: 1 }); // Error: b is not defined\n```\n\n### ES6 Template\n\n```typescript\nimport { Sandbox } from 'pico-sandbox';\n\nfunction compileTemplate(template: string, options: SandboxOptions = {}) {\n  return Sandbox.compile(`\\`${ template }\\``, options);\n}\n\nconst parser = compileTemplate('Hello ${ name }!');\nconst result = parser({ name: 'Pico' });\n\nconsole.log(result); // \"Hello Pico!\"\n```\n\n## Compile Options\n\n- **throwOnUndefined**: throw `ReferenceError` if variable is undefined in expression\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhungtcs%2Fpico-sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhungtcs%2Fpico-sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhungtcs%2Fpico-sandbox/lists"}