Ruby's Array module in TypeScript


We have 44 Ruby functions so far - help us add more

Got a rainy Sunday afternoon and a taste for a porting puzzle?

  • Get inspiration from the Ruby core documentation.
  • Click "New file" in the appropriate folder on GitHub. This will fork the project to your account, directly add the file to it, and send a Pull Request to us.

We will then review it. If it's useful to the project and in line with our contributing guidelines your work will become part of Locutus and you'll be automatically credited in the authors section accordingly.

Upstream Surface Inventory 14/137 shipped • 112 next 10%

Namespace-level inventory for Ruby 3.3: what we already ship, what we may still want, and what we intentionally skip or keep.

Array

Ruby 3.3 · Catalog source: version-pinned source manifest ruby:3.3:Array

11% shipped
14/126 shipped 112 next 11 explicit non-goals
Shipped (14)

Next

Most Ruby Array methods map naturally onto JS arrays and plain objects.

  • -
  • []
  • []=
  • *
  • &
  • +
  • <<
  • |
  • abbrev
  • all?
  • any?
  • append
  • assoc
  • at
  • chunk
  • chunk_while
  • clear
  • collect
  • collect_concat
  • collect!
  • combination
  • compact!
  • concat
  • count
  • cycle
  • deconstruct
  • delete
  • delete_at
  • delete_if
  • detect
  • difference
  • dig
  • drop
  • drop_while
  • empty?
  • entries
  • fetch
  • fill
  • filter
  • filter!
  • find
  • find_all
  • find_index
  • flat_map
  • flatten!
  • grep
  • grep_v
  • include?
  • index
  • inject
  • insert
  • intersect?
  • intersection
  • join
  • keep_if
  • length
  • map
  • map!
  • max
  • max_by
  • member?
  • min
  • min_by
  • minmax
  • minmax_by
  • new
  • none?
  • one?
  • partition
  • pop
  • prepend
  • product
  • push
  • rassoc
  • reduce
  • reject
  • reject!
  • repeated_combination
  • repeated_permutation
  • replace
  • reverse
  • reverse_each
  • reverse!
  • rindex
  • rotate
  • rotate!
  • select
  • select!
  • shift
  • shuffle
  • shuffle!
  • size
  • slice
  • slice_after
  • slice_before
  • slice!
  • sort
  • sort_by
  • sort_by!
  • sort!
  • sum
  • take
  • take_while
  • to_a
  • to_ary
  • to_h
  • transpose
  • try_convert
  • union
  • uniq!
  • unshift
  • values_at
Explicit non-goals (11)
  • chain Skip Lazy enumerator chaining is not a stable plain-value target.
  • each Skip Enumerator-driven iteration APIs are better expressed directly in JS.
  • each_cons Skip Enumerator-driven iteration APIs are better expressed directly in JS.
  • each_entry Skip Enumerator-driven iteration APIs are better expressed directly in JS.
  • each_index Skip Enumerator-driven iteration APIs are better expressed directly in JS.
  • each_slice Skip Enumerator-driven iteration APIs are better expressed directly in JS.
  • each_with_index Skip Enumerator-driven iteration APIs are better expressed directly in JS.
  • each_with_object Skip Enumerator-driven iteration APIs are better expressed directly in JS.
  • lazy Skip Lazy enumerators do not fit Locutus' plain-value model.
  • pack Skip Binary packing semantics do not map cleanly to JS plain values.
  • to_set Skip Ruby Set values are not a stable plain-value target for Locutus.

« More Ruby functions