{"id":17115760,"url":"https://github.com/pathikrit/babelfish","last_synced_at":"2026-04-30T07:32:27.923Z","repository":{"id":139970045,"uuid":"52938022","full_name":"pathikrit/BabelFish","owner":"pathikrit","description":"Invoke other languages from Scala on the JVM ","archived":false,"fork":false,"pushed_at":"2016-03-03T05:04:43.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-28T18:47:43.113Z","etag":null,"topics":["jvm","scala"],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/pathikrit.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-03-02T06:00:44.000Z","updated_at":"2021-04-16T07:40:11.000Z","dependencies_parsed_at":"2024-07-16T12:05:27.271Z","dependency_job_id":null,"html_url":"https://github.com/pathikrit/BabelFish","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pathikrit/BabelFish","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathikrit%2FBabelFish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathikrit%2FBabelFish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathikrit%2FBabelFish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathikrit%2FBabelFish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pathikrit","download_url":"https://codeload.github.com/pathikrit/BabelFish/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathikrit%2FBabelFish/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32458237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"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":["jvm","scala"],"created_at":"2024-10-14T17:46:25.714Z","updated_at":"2026-04-30T07:32:27.909Z","avatar_url":"https://github.com/pathikrit.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BabelFish [![License][licenseImg]][licenseLink] [![CircleCI][circleCiImg]][circleCiLink] [![Codacy][codacyImg]][codacyLink] [![Gitter][gitterImg]][gitterLink]\n\n`BabelFish` is a [dependency-free](build.sbt) [wrapper](src/main/scala/com/github/pathikrit/babelfish/Evaluator.scala) \naround [JSR 223](https://www.jcp.org/en/jsr/detail?id=223) that enables invoking other languages from Scala on the JVM.\n\nInvoking JavaScript:\n```scala\nval eval = new Evaluator.JavaScript\neval(\"function sum(a, b) { return a + b; }\")\n\nval i = eval.as[Int](\"sum(1, 2);\")\nassert(i + 3 == 6)\n```\n\nWe can use Scala's [Dynamic](http://www.scala-lang.org/files/archive/nightly/2.12.x/api/2.12.x/scala/Dynamic.html) too to invoke:\n```scala\nval j: Int = eval.sum(9, 7)\nassert(j == 16)\n```\n\nWe can even invoke `sum` through a Scala trait:\n```scala\ntrait Adder {\n  def sum(a: Int, b: Int): Int\n}\nval adder: Adder = eval.as[Adder]\nassert(adder.sum(7, 8) == 15)\n```\n\nNote that we can invoke `sum` for other types too:\n```scala\nassert(eval.sum[String](\"hello\", \"world\") == \"helloworld\")\neval.sum[Int](\"hello\", \"world\") // Exception!\n```\n\nSupport for objects:\n```scala\nval eval = new Evaluator.JavaScript\nval rick = eval(s\"\"\"\n  new function () {\n    this.name = \"Rick\";\n    this.age = 28;\n    this.sayHi = function (friend) {\n      return \"Hello \" + friend + \"! My name is \" + this.name;\n    }\n  };\n\"\"\")\nassert(rick.sayHi[String](\"Anna\") == \"Hello Anna! My name is Rick\")\nassert(rick.age[Int] == 28)\n```\n\nWe can even eval script files:\n```scala\nval eval = new Evaluator.JavaScript\nval $ = eval.file(\"scripts/lodash.min.js\")\nassert($.min[Int](Array(48, 12, 19, 23)) == 12)\n```\n\nSee the [tests](src/test/scala/com/github/pathikrit/babelfish/BabelFishSpec.scala) for more examples. [![codecov][codecovImg]][codecovLink]\n\n[licenseImg]: https://img.shields.io/github/license/pathikrit/BabelFish.svg\n[licenseImg2]: https://img.shields.io/:license-mit-blue.svg\n[licenseLink]: LICENSE\n\n[circleCiImg]: https://img.shields.io/circleci/project/pathikrit/BabelFish/master.svg\n[circleCiImg2]: https://circleci.com/gh/pathikrit/BabelFish/tree/master.svg\n[circleCiLink]: https://circleci.com/gh/pathikrit/BabelFish\n\n[codecovImg]: https://img.shields.io/codecov/c/github/pathikrit/BabelFish/master.svg\n[codecovImg2]: https://codecov.io/github/pathikrit/BabelFish/coverage.svg?branch=master\n[codecovLink]: http://codecov.io/github/pathikrit/BabelFish?branch=master\n\n[versionEyeImg2]: https://img.shields.io/versioneye/d/pathikrit/BabelFish.svg\n[versionEyeImg]: https://www.versioneye.com/user/projects/55f5e7de3ed894001e0003b1/badge.svg\n[versionEyeLink]: https://www.versioneye.com/user/projects/55f5e7de3ed894001e0003b1\n\n[codacyImg]: https://img.shields.io/codacy/014bfb25162b469bb0538cca7b4ec18d.svg\n[codacyImg2]: https://api.codacy.com/project/badge/grade/014bfb25162b469bb0538cca7b4ec18d\n[codacyLink]: https://www.codacy.com/app/pathikrit/BabelFish/dashboard\n\n[mavenImg]: https://img.shields.io/maven-central/v/com.github.pathikrit/BabelFish_2.11.svg\n[mavenImg2]: https://maven-badges.herokuapp.com/maven-central/com.github.pathikrit/BabelFish_2.11/badge.svg\n[mavenLink]: http://search.maven.org/#search%7Cga%7C1%7CBabelFish\n\n[gitterImg]: https://img.shields.io/gitter/room/pathikrit/BabelFish.svg\n[gitterImg2]: https://badges.gitter.im/Join%20Chat.svg\n[gitterLink]: https://gitter.im/pathikrit/BabelFish\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpathikrit%2Fbabelfish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpathikrit%2Fbabelfish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpathikrit%2Fbabelfish/lists"}