Elixir modules in TypeScript
TypeScript implementations of 14 Elixir standard library functions across 4 modules. Each function is individually importable and tree-shakeable.
Enum Float Kernel StringWe have 14 Elixir functions so far - help us add more
Got a rainy Sunday afternoon and a taste for a porting puzzle?
- Get inspiration from the Elixir 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/1580 shipped · 332 next 1%
Locutus tracks 124 upstream namespaces for Elixir and sorts them into what is already shipped, what we still want, what we intentionally keep, and what still needs a decision.
This inventory now tracks Elixir's official `:elixir` app module surface, excluding tooling apps like Mix and IEx from the parity target scope.
In progress
Next
Elixir Float helpers are strong plain-value portability targets.
max_finitemin_finiteparsepowratioroundto_string
Explicit non-goals (2)
-
to_char_listCharlist conversion does not fit Locutus' plain-value model. -
to_charlistCharlist conversion does not fit Locutus' plain-value model.
Next
Elixir String helpers are strong plain-value portability targets.
atbag_distancebyte_slicecapitalizechunkcodepointscontains?duplicateends_with?equivalent?firstgraphemesjaro_distancelastljustlstripmatch?myers_differencenext_codepointnext_graphemenext_grapheme_sizenormalizepad_leadingpad_trailingprintable?replace_leadingreplace_prefixreplace_suffixreplace_trailingrjustrstripslicesplitsplit_atsplitterstarts_with?stripto_atomto_char_listto_charlistto_existing_atomto_floatto_integertrimtrim_leadingtrim_trailingvalid_character?valid?
Explicit non-goals (1)
-
replace_invalidInvalid-binary replacement semantics do not map cleanly to JS strings.
Shipped (6)
Next
Enum helpers are a high-value functional portability surface for Locutus.
all?any?atchunkchunk_bychunk_whileconcatcountcount_untildedupdedup_bydropdrop_everydrop_whileempty?fetchfetch!filterfilter_mapfindfind_indexfind_valueflat_mapflat_map_reducefrequenciesintersperseintojoinmapmap_everymap_interspersemap_joinmap_reducemaxmax_bymember?minmin_bymin_maxmin_max_bypartitionproductproduct_byreducerejectreversereverse_slicesliceslidesortsort_bysplitsplit_whilesplit_withsumsum_bytaketake_everytake_whileto_listuniquniq_byunzipwith_indexzip_reducezip_with
Explicit non-goals (4)
-
eachSide-effect-driven iteration is not a good Locutus target. -
randomRandomized enumeration helpers are lower-value than deterministic collection transforms. -
shuffleRandomized enumeration helpers are lower-value than deterministic collection transforms. -
take_randomRandomized enumeration helpers are lower-value than deterministic collection transforms.
Shipped (1)
Next
Binary slicing is a useful plain-value helper.
binary_partbinary_slice
Size helpers have a clean plain-value contract.
bit_sizebyte_sizelengthmap_sizetuple_size
Scalar helpers have a clean plain-value contract.
ceildivfloormaxminremroundtrunc
Tuple element access still has a clean plain-value contract.
elem
Head access has a clean plain-value contract.
hd
Type-predicate helpers have a clean plain-value contract.
is_atomis_binaryis_bitstringis_booleanis_floatis_functionis_integeris_listis_mapis_map_keyis_numberis_pidis_portis_referenceis_tuple
Tail access has a clean plain-value contract.
tl
Explicit non-goals (39)
-
-Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
--Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
!=Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
!==Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
*Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
**Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
/Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
+Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
++Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
<Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
<=Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
==Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
===Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
=~Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
>Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
>=Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
applyMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
exitMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
function_exported?Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
get_and_update_inMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
get_inMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
inspectMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
macro_exported?Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
make_refMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
nodeMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
notMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
pop_inMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
put_elemMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
put_inMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
selfMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
sendMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
spawnMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
spawn_linkMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
spawn_monitorMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
structMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
struct!Much of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
throwMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
to_timeoutMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values. -
update_inMuch of Elixir Kernel is syntax sugar, runtime introspection, or process management rather than plain values.
Keyword
Next
Keyword-list helpers can be modeled over entry arrays and plain objects.
deletedelete_firstdropequal?fetchfetch!filterfrom_keysgetget_and_updateget_and_update!get_lazyget_valueshas_key?intersectkeyskeyword?mapmergenewpoppop_firstpop_lazypop_valuespop!putput_newput_new_lazyrejectreplacereplace_lazyreplace!sizesplitsplit_withtaketo_listupdateupdate!validatevalidate!values
Map
Next
Immutable map helpers are strong plain-value portability targets.
deletedropequal?fetchfetch!filterfrom_keysgetget_and_updateget_and_update!get_lazyhas_key?intersectkeysmapmergenewpoppop_lazypop!putput_newput_new_lazyrejectreplacereplace_lazyreplace!sizesplitsplit_withtaketo_listupdateupdate!values
Explicit non-goals (1)
-
from_structStruct-specific reflection does not fit Locutus' plain-value model.
List
Next
Immutable list transforms are strong plain-value portability targets.
ascii_printable?deletedelete_atduplicateends_with?firstflattenfoldlfoldrimproper?insert_atkeydeletekeyfindkeyfind!keymember?keyreplacekeysortkeystorekeytakelastmyers_differencepop_atreplace_atstarts_with?to_floatto_integerto_stringto_tupleupdate_atwrapzip
Explicit non-goals (3)
-
to_atomAtom creation can exhaust the VM atom table and is not a good portability target. -
to_charlistCharlist conversion does not fit Locutus' plain-value model. -
to_existing_atomAtom-table lookup is runtime-sensitive and not a good portability target.
Base
Next
Base encoding helpers are strong plain-value portability targets.
decode16decode16!decode32decode32!decode64decode64!encode16encode32encode64hex_decode32hex_decode32!hex_encode32url_decode64url_decode64!url_encode64
Path
Next
Path manipulation helpers are strong plain-string portability targets.
absnamebasenamedirnameexpandextnamejoinrelativerelative_torelative_to_cwdrootnamesafe_relativesafe_relative_tosplittypewildcard
Integer
Next
Integer helpers are strong plain-value portability targets.
digitsextended_gcdfloor_divgcdmodparsepowto_stringundigits
Explicit non-goals (2)
-
to_char_listCharlist conversion does not fit Locutus' plain-value model. -
to_charlistCharlist conversion does not fit Locutus' plain-value model.
Version
Next
Semantic-version parsing and comparison helpers have a clean plain-value contract.
__struct__comparecompile_requirementmatch?parseparse_requirementparse_requirement!parse!to_string
OptionParser
Next
Argument parsing helpers have a useful plain-value portability contract.
nextparseparse_headparse_head!parse!splitto_argv
Tuple
Next
Tuple helpers still have a clean plain-value contract when modeled over arrays.
appenddelete_atduplicateinsert_atproductsumto_list
URI
Next
String-based encode/decode helpers have a clean plain-value contract.
decodedecode_querydecode_www_formencodeencode_queryencode_www_form
Explicit non-goals (13)
-
__struct__URI structs do not fit Locutus' current plain-value model by default. -
append_pathURI structs do not fit Locutus' current plain-value model by default. -
append_queryURI structs do not fit Locutus' current plain-value model by default. -
char_reserved?URI structs do not fit Locutus' current plain-value model by default. -
char_unescaped?URI structs do not fit Locutus' current plain-value model by default. -
char_unreserved?URI structs do not fit Locutus' current plain-value model by default. -
default_portURI structs do not fit Locutus' current plain-value model by default. -
mergeURI structs do not fit Locutus' current plain-value model by default. -
newURI structs do not fit Locutus' current plain-value model by default. -
new!URI structs do not fit Locutus' current plain-value model by default. -
parseURI structs do not fit Locutus' current plain-value model by default. -
query_decoderURI structs do not fit Locutus' current plain-value model by default. -
to_stringURI structs do not fit Locutus' current plain-value model by default.
Regex
Next
Regex replacement still has a clean plain-value contract.
replace
Match extraction still has a clean plain-value contract.
run
Explicit non-goals (16)
-
__struct__Compiled regex structs do not fit one stable plain-value contract by default. -
compileCompiled regex structs do not fit one stable plain-value contract by default. -
compile!Compiled regex structs do not fit one stable plain-value contract by default. -
escapeCompiled regex structs do not fit one stable plain-value contract by default. -
match?Compiled regex structs do not fit one stable plain-value contract by default. -
named_capturesCompiled regex structs do not fit one stable plain-value contract by default. -
namesCompiled regex structs do not fit one stable plain-value contract by default. -
optsCompiled regex structs do not fit one stable plain-value contract by default. -
re_patternCompiled regex structs do not fit one stable plain-value contract by default. -
recompileCompiled regex structs do not fit one stable plain-value contract by default. -
recompile!Compiled regex structs do not fit one stable plain-value contract by default. -
regex?Compiled regex structs do not fit one stable plain-value contract by default. -
scanCompiled regex structs do not fit one stable plain-value contract by default. -
sourceCompiled regex structs do not fit one stable plain-value contract by default. -
splitCompiled regex structs do not fit one stable plain-value contract by default. -
versionCompiled regex structs do not fit one stable plain-value contract by default.