This package is not in
npmjs.org yet, so for now it can be installed directly
from this repository.
$ npm install https://github.com/uncaughtxcptn/rbjs
For complete documentation, visit https://rbjs.uncaughtexception.wtf/.
To load the entire
rbjs library, which includes all the available methods:
import rbjs from 'rbjs';
proxied by passing it to the
const array = rbjs([1, 2, 3]); // `array` now contains all the implemented Ruby array methods array.count(2); // => 1
Using individual methods
The methods can also be used on their own, without importing the entire
library. This is done by importing the method definition directly.
import count from 'rbjs/methods/count'; count([1, 2, 3], 2); // => 1
The caveat of using
rbjs this way is that the array to operate on needs to be
passed as the first argument to the method being used.
If you want to use the ES5 build of this library, they can be imported from the
const rbjs = require('rbjs/es5'); const count = require('rbjs/es5/methods/count');
Thanks for wanting to contribute to this project! Please follow these steps:
- Open an issue in this repository about the contribution to be made
- Fork and clone this repository
- Install dependencies (
- Add your contributions
- Write tests for your added contributions
- Open a pull request to this repository