Tcl commands in TypeScript
TypeScript implementations of 16 Tcl standard library functions across 1 module. Each function is individually importable and tree-shakeable.
string- compare
- equal
- first
- last
- length
- map
- match
- range
- regsub
- repeat
- reverse
- tolower
- toupper
- trim
- trimleft
- trimright
We have 16 Tcl functions so far - help us add more
Got a rainy Sunday afternoon and a taste for a porting puzzle?
- Get inspiration from the Tcl command reference.
- 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/277 shipped · 68 next 5%
Locutus tracks 13 upstream namespaces for Tcl 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 Tcl's broader core command surface and standard ensembles first, excluding only host-specific extension ecosystems beyond core Tcl.
In progress
Shipped (16)
Next
Tcl string subcommands map naturally onto JS string and array values.
catindexreplacetotitlewordendwordstart
Intentional extras
Explicit non-goals (2)
-
bytelengthByte-length helpers add little value in a UTF-16 JS runtime. -
isTcl classifier subcommands are too broad and type-system-specific for one clean port.
standalone core commands
Next
List/string concatenation has a clean plain-value contract.
concat
Scalar expression helpers are useful portability targets.
expr
Formatting helpers are strong plain-value portability targets.
format
Joining helpers have a clean plain-value contract.
join
List destructuring helpers can be represented as plain arrays.
lassign
Indexed access has a clean plain-value contract.
lindex
Pure list insertion has a clean plain-value contract.
linsert
List construction has a clean plain-value contract.
list
Size helpers have a clean plain-value contract.
llength
List slicing has a clean plain-value contract.
lrange
Repetition helpers have a clean plain-value contract.
lrepeat
Pure list replacement has a clean plain-value contract.
lreplace
Reversal helpers have a clean plain-value contract.
lreverse
Search helpers have a clean plain-value contract.
lsearch
Sorting helpers have a clean plain-value contract.
lsort
Regex matching is a strong plain-value portability target.
regexp
Regex replacement is a strong plain-value portability target.
regsub
Parsing helpers have a clean plain-value contract.
scan
String splitting is a strong plain-value portability target.
split
Explicit non-goals (70)
-
afterTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
appendTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
applyTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
auto_execokTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
auto_importTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
auto_loadTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
auto_load_indexTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
auto_qualifyTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
breakTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
caseTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
catchTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
cdTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
closeTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
continueTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
coroutineTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
eofTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
errorTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
evalTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
execTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
exitTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
fblockedTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
fconfigureTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
fcopyTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
fileeventTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
flushTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
forTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
foreachTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
getsTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
globTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
globalTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
historyTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
ifTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
incrTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
interpTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
lappendVariable-backed list mutation is outside Locutus' value-only model. -
lmapCallback-driven mapping does not fit one stable Locutus contract yet. -
loadTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
lsetVariable-backed list mutation is outside Locutus' value-only model. -
openTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
pidTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
procTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
putsTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
pwdTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
readTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
renameTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
returnTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
seekTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
setTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
socketTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
sourceTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
substTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
switchTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
tailcallTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
tclLogTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
tellTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
throwTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
timeTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
traceTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
tryTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
unknownTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
unloadTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
unsetTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
updateTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
uplevelTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
upvarTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
variableTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
vwaitTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
whileTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
yieldTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist. -
yieldtoTcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
dict ensemble
Next
Tcl dictionary transforms map naturally onto JS plain objects and arrays.
createexistsfiltergetkeysmapmergeremovereplacesizevalues
Explicit non-goals (9)
-
appendVariable-backed dictionary mutation is outside Locutus' value-only model. -
forCallback-style iteration is not a good Locutus portability target. -
incrVariable-backed numeric mutation is outside Locutus' value-only model. -
infoInternal representation details are not a stable plain-value target. -
lappendVariable-backed dictionary mutation is outside Locutus' value-only model. -
setVariable-backed dictionary mutation is outside Locutus' value-only model. -
unsetVariable-backed dictionary mutation is outside Locutus' value-only model. -
updateVariable-backed dictionary mutation is outside Locutus' value-only model. -
withScoped variable mutation is outside Locutus' value-only model.
file ensemble
Next
Path decomposition helpers are strong plain-string portability targets.
dirnameextensionrootnametail
Path joining has a clean plain-string contract.
join
Path normalization helpers have a useful plain-string contract.
nativenamenormalize
Path classification has a clean plain-string contract.
pathtype
Path metadata helpers have a clean plain-string contract.
separator
Path splitting has a clean plain-value contract.
split
Explicit non-goals (24)
-
atimeMost filesystem helpers depend on host state or mutate the filesystem. -
attributesMost filesystem helpers depend on host state or mutate the filesystem. -
channelsMost filesystem helpers depend on host state or mutate the filesystem. -
copyMost filesystem helpers depend on host state or mutate the filesystem. -
deleteMost filesystem helpers depend on host state or mutate the filesystem. -
executableMost filesystem helpers depend on host state or mutate the filesystem. -
existsMost filesystem helpers depend on host state or mutate the filesystem. -
isdirectoryMost filesystem helpers depend on host state or mutate the filesystem. -
isfileMost filesystem helpers depend on host state or mutate the filesystem. -
linkMost filesystem helpers depend on host state or mutate the filesystem. -
lstatMost filesystem helpers depend on host state or mutate the filesystem. -
mkdirMost filesystem helpers depend on host state or mutate the filesystem. -
mtimeMost filesystem helpers depend on host state or mutate the filesystem. -
ownedMost filesystem helpers depend on host state or mutate the filesystem. -
readableMost filesystem helpers depend on host state or mutate the filesystem. -
readlinkMost filesystem helpers depend on host state or mutate the filesystem. -
renameMost filesystem helpers depend on host state or mutate the filesystem. -
sizeMost filesystem helpers depend on host state or mutate the filesystem. -
statMost filesystem helpers depend on host state or mutate the filesystem. -
systemMost filesystem helpers depend on host state or mutate the filesystem. -
tempfileMost filesystem helpers depend on host state or mutate the filesystem. -
typeMost filesystem helpers depend on host state or mutate the filesystem. -
volumesMost filesystem helpers depend on host state or mutate the filesystem. -
writableMost filesystem helpers depend on host state or mutate the filesystem.
clock ensemble
Next
Clock formatting and conversion helpers still have a useful plain-value contract.
addclicksformatmicrosecondsmillisecondsscanseconds
array ensemble
Next
Presence predicates have a clean plain-value contract.
exists
Whole-array extraction can be represented as plain objects or entry arrays.
get
Key enumeration has a clean plain-value contract.
names
Size helpers have a clean plain-value contract.
size
Explicit non-goals (7)
-
anymoreTcl arrays are variable-backed dictionaries rather than direct plain values. -
donesearchTcl arrays are variable-backed dictionaries rather than direct plain values. -
nextelementTcl arrays are variable-backed dictionaries rather than direct plain values. -
setTcl arrays are variable-backed dictionaries rather than direct plain values. -
startsearchTcl arrays are variable-backed dictionaries rather than direct plain values. -
statisticsTcl arrays are variable-backed dictionaries rather than direct plain values. -
unsetTcl arrays are variable-backed dictionaries rather than direct plain values.
encoding ensemble
Next
Encoding conversion helpers are useful portability targets when kept in string space.
convertfromconverttonames
binary ensemble
Next
Textual base64 and hex decoding still has a useful plain-string contract.
decode
Textual base64 and hex encoding still has a useful plain-string contract.
encode
info ensemble
Next
Runtime version reporting has a clean plain-value contract.
patchleveltclversion
Explicit non-goals (24)
-
argsTcl introspection commands depend on runtime program state rather than plain values. -
bodyTcl introspection commands depend on runtime program state rather than plain values. -
classTcl introspection commands depend on runtime program state rather than plain values. -
cmdcountTcl introspection commands depend on runtime program state rather than plain values. -
commandsTcl introspection commands depend on runtime program state rather than plain values. -
completeTcl introspection commands depend on runtime program state rather than plain values. -
coroutineTcl introspection commands depend on runtime program state rather than plain values. -
defaultTcl introspection commands depend on runtime program state rather than plain values. -
errorstackTcl introspection commands depend on runtime program state rather than plain values. -
existsTcl introspection commands depend on runtime program state rather than plain values. -
frameTcl introspection commands depend on runtime program state rather than plain values. -
functionsTcl introspection commands depend on runtime program state rather than plain values. -
globalsTcl introspection commands depend on runtime program state rather than plain values. -
hostnameHostname lookup depends on host environment. -
levelTcl introspection commands depend on runtime program state rather than plain values. -
libraryTcl introspection commands depend on runtime program state rather than plain values. -
loadedTcl introspection commands depend on runtime program state rather than plain values. -
localsTcl introspection commands depend on runtime program state rather than plain values. -
nameofexecutableTcl introspection commands depend on runtime program state rather than plain values. -
objectTcl introspection commands depend on runtime program state rather than plain values. -
procsTcl introspection commands depend on runtime program state rather than plain values. -
scriptTcl introspection commands depend on runtime program state rather than plain values. -
sharedlibextensionTcl introspection commands depend on runtime program state rather than plain values. -
varsTcl introspection commands depend on runtime program state rather than plain values.
namespace ensemble
Next
Namespace string decomposition has a clean plain-value contract.
qualifierstail
Explicit non-goals (17)
-
childrenNamespace mutation and introspection revolve around Tcl runtime program state. -
codeNamespace mutation and introspection revolve around Tcl runtime program state. -
currentNamespace mutation and introspection revolve around Tcl runtime program state. -
deleteNamespace mutation and introspection revolve around Tcl runtime program state. -
ensembleNamespace mutation and introspection revolve around Tcl runtime program state. -
evalNamespace mutation and introspection revolve around Tcl runtime program state. -
existsNamespace mutation and introspection revolve around Tcl runtime program state. -
exportNamespace mutation and introspection revolve around Tcl runtime program state. -
forgetNamespace mutation and introspection revolve around Tcl runtime program state. -
importNamespace mutation and introspection revolve around Tcl runtime program state. -
inscopeNamespace mutation and introspection revolve around Tcl runtime program state. -
originNamespace mutation and introspection revolve around Tcl runtime program state. -
parentNamespace mutation and introspection revolve around Tcl runtime program state. -
pathNamespace mutation and introspection revolve around Tcl runtime program state. -
unknownNamespace mutation and introspection revolve around Tcl runtime program state. -
upvarNamespace mutation and introspection revolve around Tcl runtime program state. -
whichNamespace mutation and introspection revolve around Tcl runtime program state.
package command family
Next
Version comparison has a clean plain-value contract.
vcompare
Version constraint checks have a clean plain-value contract.
vsatisfies
Explicit non-goals (8)
-
forgetPackage loading and availability depend on the host runtime and install state. -
ifneededPackage loading and availability depend on the host runtime and install state. -
namesPackage loading and availability depend on the host runtime and install state. -
presentPackage loading and availability depend on the host runtime and install state. -
providePackage loading and availability depend on the host runtime and install state. -
requirePackage loading and availability depend on the host runtime and install state. -
unknownPackage loading and availability depend on the host runtime and install state. -
versionsPackage loading and availability depend on the host runtime and install state.