{"id":20713855,"url":"https://github.com/diffplug/jscriptbox","last_synced_at":"2025-07-20T02:32:59.400Z","repository":{"id":57727663,"uuid":"42751482","full_name":"diffplug/jscriptbox","owner":"diffplug","description":"Language-independent scripting environment","archived":false,"fork":false,"pushed_at":"2023-02-05T09:03:26.000Z","size":597,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-23T08:08:03.664Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diffplug.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-18T23:22:04.000Z","updated_at":"2024-12-02T18:16:48.000Z","dependencies_parsed_at":"2023-02-18T22:45:45.557Z","dependency_job_id":null,"html_url":"https://github.com/diffplug/jscriptbox","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fjscriptbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fjscriptbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fjscriptbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fjscriptbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diffplug","download_url":"https://codeload.github.com/diffplug/jscriptbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250395288,"owners_count":21423400,"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":[],"created_at":"2024-11-17T02:27:47.636Z","updated_at":"2025-07-20T02:32:59.382Z","avatar_url":"https://github.com/diffplug.png","language":"Java","readme":"# \u003cimg align=\"left\" src=\"jscriptbox.png\"\u003e JScriptBox: Make your scripting API language-independent\n\u003c!---freshmark shields\noutput = [\n  link(shield('Maven artifact', 'mavenCentral', 'com.diffplug.jscriptbox:jscriptbox', 'blue'), 'https://central.sonatype.com/artifact/com.diffplug.jscriptbox/jscriptbox/{{versionLast}}'),\n  link(shield('Changelog', 'changelog', '{{versionLast}}', 'blue'), 'CHANGELOG.md'),\n  link(shield('Javadoc', 'javadoc', 'here', 'blue'), 'https://javadoc.io/doc/com.diffplug.jscriptbox/jscriptbox')\n  ].join('\\n');\n--\u003e\n[![Maven artifact](https://img.shields.io/badge/mavenCentral-com.diffplug.jscriptbox%3Ajscriptbox-blue.svg)](https://central.sonatype.com/artifact/com.diffplug.jscriptbox/jscriptbox/3.0.1)\n[![Changelog](https://img.shields.io/badge/changelog-3.0.1-blue.svg)](CHANGELOG.md)\n[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug.jscriptbox/jscriptbox)\n\u003c!---freshmark /shields --\u003e\n\nWhen exposing a scripting API, you provide some variables and functions to the script, run the script, then look at which outputs were set and/or functions were called.  JScriptBox provides a mechanism for exposing a Java API to a scripting language in a way which is independent of the script language.  This means that if you write your code using JScriptBox, script authors can use any language supported by JSR-223, such as JavaScript, Ruby, Python, Scheme, [etc.](http://stackoverflow.com/a/14864450/1153071)\n\nAt present, only JavaScript is being used in the wild (in the [FreshMark](https://github.com/diffplug/freshmark) project), but PR's which enhance support for other languages are welcome.\n\n## Example\n\n```java\nprivate int square(int x) {\n  return x * x;\n}\n\n@Test\npublic void example() throws ScriptException {\n  TypedScriptEngine engine = JScriptBox.create()\n    .set(\"square\").toFunc1(this::square)\n    .set(\"x\").toValue(9)\n    .buildTyped(Nashorn.language());\n  int squareOfX = engine.eval(\"square(x)\", Integer.class);\n  Assert.assertEquals(81, squareOfX);\n}\n```\n\nIn the code above, we provide a `square`  function and an `x` variable.  We then build a Nashorn Javascript engine, but we could have passed any other language too.  To add a new language, just implement [Language](src/main/java/com/diffplug/jscriptbox/Language.java) (the existing [Nashorn](src/main/java/com/diffplug/jscriptbox/javascript/Nashorn.java) can be a helpful starting point).\n\n## Acknowledgements\n* Built by [gradle](http://gradle.org/).\n* Tested by [junit](http://junit.org/).\n* Maintained by [DiffPlug](http://www.diffplug.com/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffplug%2Fjscriptbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiffplug%2Fjscriptbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffplug%2Fjscriptbox/lists"}