ruby-methods

0.0.2 • Public • Published

Use Ruby methods in JavaScript

Ruby = 5.times { |i| puts i }
JS   = (1).times(function(i){console.log(i);})
Ruby = 1.upto(5) { |i| puts i }
JS   = (1).upto(5, function(i){console.log(i);})
Ruby = 15.downto(10) { |i| puts i }
JS   = (15).downto(10, function(i){console.log(i);})
Ruby = [4, 5, 6].each { |element| puts "#{element}" }
JS = [4, 5, 6].each(function(index) { console.log(index + ": " + this); })

Readme

Keywords

Package Sidebar

Install

npm i ruby-methods

Weekly Downloads

1

Version

0.0.2

License

none

Unpacked Size

1.66 kB

Total Files

3

Last publish

Collaborators

  • gabamnml