@ruby2js/ruby2js
v5.1.2
Published
Ruby to Javascript transpiler
Downloads
404
Readme
@ruby2js/ruby2js
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
- Fork it (https://github.com/ruby2js/ruby2js/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
License
MIT