Ruby's Array module in TypeScript
- bsearch
- bsearch_index
- compact
- filter_map
- first
- flatten
- group_by
- last
- permutation
- sample
- slice_when
- tally
- uniq
- zip
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
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.
-[][]=*&+<<|abbrevall?any?appendassocatchunkchunk_whileclearcollectcollect_concatcollect!combinationcompact!concatcountcycledeconstructdeletedelete_atdelete_ifdetectdifferencedigdropdrop_whileempty?entriesfetchfillfilterfilter!findfind_allfind_indexflat_mapflatten!grepgrep_vinclude?indexinjectinsertintersect?intersectionjoinkeep_iflengthmapmap!maxmax_bymember?minmin_byminmaxminmax_bynewnone?one?partitionpopprependproductpushrassocreducerejectreject!repeated_combinationrepeated_permutationreplacereversereverse_eachreverse!rindexrotaterotate!selectselect!shiftshuffleshuffle!sizesliceslice_afterslice_beforeslice!sortsort_bysort_by!sort!sumtaketake_whileto_ato_aryto_htransposetry_convertunionuniq!unshiftvalues_at
Explicit non-goals (11)
-
chainLazy enumerator chaining is not a stable plain-value target. -
eachEnumerator-driven iteration APIs are better expressed directly in JS. -
each_consEnumerator-driven iteration APIs are better expressed directly in JS. -
each_entryEnumerator-driven iteration APIs are better expressed directly in JS. -
each_indexEnumerator-driven iteration APIs are better expressed directly in JS. -
each_sliceEnumerator-driven iteration APIs are better expressed directly in JS. -
each_with_indexEnumerator-driven iteration APIs are better expressed directly in JS. -
each_with_objectEnumerator-driven iteration APIs are better expressed directly in JS. -
lazyLazy enumerators do not fit Locutus' plain-value model. -
packBinary packing semantics do not map cleanly to JS plain values. -
to_setRuby Set values are not a stable plain-value target for Locutus.