@ruby2js/ruby2js

5.1.1 • Public • Published

@ruby2js/ruby2js

npm node

Ruby2JS is an extensible Ruby to modern JavaScript transpiler.

Example usage

import { Ruby2JS } from '@ruby2js/ruby2js';

console.log(
  Ruby2JS.convert(
    '"2A".to_i(16)',
    {filters: ['functions']}
  ).toString()
)

An example of all supported options:

{
  autoexports: true,
  autoimports: {"[:LitElement]": "lit-element"},
  comparison: "identity",
  defs: {A: ["x", "@y"]},
  eslevel: 2021,
  exclude: ["each"],
  filters: ["functions"],
  include: ["class"],
  include_all: true,
  include_only: ["max"],
  import_from_skypack: true,
  or: "nullish",
  require_recurse: true,
  strict: true,
  template_literal_tags: ["color"],
  underscored_private: true,
  width: 40
}

Documentation

  • Visit ruby2js.com for detailed instructions and examples.
  • Read the main monorepo CHANGELOG for information on what's new in this package.

Testing

git clone https://github.com/ruby2js/ruby2js.git
cd ruby2js/packages/ruby2js
bundle install
yarn install
yarn build
yarn test

Contributing

  1. Fork it (https://github.com/ruby2js/ruby2js/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @ruby2js/ruby2js

Weekly Downloads

108

Version

5.1.1

License

MIT

Unpacked Size

4.51 MB

Total Files

4

Last publish

Collaborators

  • jaredwhite
  • rubys