Ruby's String module in TypeScript
- capitalize
- chomp
- chop
- delete_prefix
- delete_suffix
- downcase
- end_with
- gsub
- include
- length
- reverse
- start_with
- strip
- tr
- upcase
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 15/149 shipped • 116 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.
String
11%
shipped
15/131 shipped
116 next
18 explicit non-goals
Shipped (15)
-
capitalize -
chomp -
chop -
delete_prefix -
delete_suffix -
downcase -
end_with? -
gsub -
include? -
length -
reverse -
start_with? -
strip -
tr -
upcase
Next
Most Ruby String methods are strong plain-value portability targets.
-@[][]=*%++@<<<<==~>>=ascii_only?between?capitalize!casecmpcasecmp?centercharschomp!chop!chrclampclearcodepointsconcatcountdedupdeletedelete_prefix!delete_suffix!delete!downcase!dumpempty?getbytegrapheme_clustersgsub!hexindexinsertiseucisjisissjisisutf8kconvlinesljustlstriplstrip!matchmatch?newnextnext!octordparse_csvpartitionprependreplacereverse!rindexrjustrpartitionrstriprstrip!scanscrubscrub!setbyteshellescapeshellsplitsizesliceslice!splitsqueezesqueeze!strip!subsub!succsucc!sumswapcaseswapcase!to_cto_fto_ito_json_rawto_json_raw_objectto_rto_strto_symtoeuctojistolocaletosjistoutf16toutf32toutf8tr_str_s!tr!try_convertundumpunicode_normalizeunicode_normalize!unicode_normalized?unpackunpack1upcase!uptovalid_encoding?
Explicit non-goals (18)
-
bRuby's binary-string clone helper adds little value in JS. -
byteindexByte-oriented string APIs do not fit Locutus' current plain-value model. -
byterindexByte-oriented string APIs do not fit Locutus' current plain-value model. -
bytesByte-oriented string APIs do not fit Locutus' current plain-value model. -
bytesizeByte-oriented string APIs do not fit Locutus' current plain-value model. -
bytesliceByte-oriented string APIs do not fit Locutus' current plain-value model. -
bytespliceByte-oriented string APIs do not fit Locutus' current plain-value model. -
cryptPassword-hash wrappers are security-sensitive and not a good Locutus target. -
each_byteEnumerator-driven iteration APIs are better expressed directly in JS. -
each_charEnumerator-driven iteration APIs are better expressed directly in JS. -
each_codepointEnumerator-driven iteration APIs are better expressed directly in JS. -
each_grapheme_clusterEnumerator-driven iteration APIs are better expressed directly in JS. -
each_lineEnumerator-driven iteration APIs are better expressed directly in JS. -
encodeEncoding-object semantics do not fit Locutus' plain-value model. -
encode!Encoding-object semantics do not fit Locutus' plain-value model. -
encodingEncoding objects are not a stable plain-value target. -
force_encodingEncoding mutation does not fit Locutus' plain-value model. -
internSymbol-table interning does not fit Locutus' plain-value model.