Go packages in TypeScript
TypeScript implementations of 87 Go standard library functions across 9 modules. Each function is individually importable and tree-shakeable.
filepath net path sort strconv strings- Compare
- Contains
- ContainsAny
- Count
- Cut
- CutPrefix
- CutSuffix
- EqualFold
- Fields
- HasPrefix
- HasSuffix
- Index
- IndexAny
- Join
- LastIndex
- LastIndexAny
- Repeat
- Replace
- ReplaceAll
- Split
- SplitN
- ToLower
- ToUpper
- Trim
- TrimLeft
- TrimPrefix
- TrimRight
- TrimSpace
- TrimSuffix
- Add
- AddDate
- After
- Before
- Date
- Equal
- Format
- Parse
- ParseDuration
- ParseInLocation
- Round
- Sub
- Truncate
- Unix
- UnixMicro
- UnixMilli
Help us add more
Got a rainy Sunday afternoon and a taste for a porting puzzle?
- Get inspiration from Go strings documentation, Go strings source, Go strings examples source, GopherJS.
- 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 87/4570 shipped · 231 next 2%
Locutus tracks 802 upstream namespaces for Go 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 Go's full public stdlib package surface, using `go list std` for package discovery and `go doc -all` for callable entry discovery.
Complete
Shipped (7)
Explicit non-goals (12)
-
AfterMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
AfterFuncTimer callbacks are side-effectful runtime scheduling APIs. -
FixedZoneMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
LoadLocationTimezone database loading depends on host runtime state. -
LoadLocationFromTZDataTimezone database loading depends on host runtime state. -
NewTickerMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
NewTimerMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
NowMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
SinceMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
SleepMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
TickMuch of Go time depends on locations, timers, and rich time values beyond JS plain values. -
UntilMuch of Go time depends on locations, timers, and rich time values beyond JS plain values.
In progress
Next
Go path helpers are strong plain string portability targets.
Split
Shipped (6)
Next
Request-URI parsing is a useful plain-value helper.
ParseRequestURI
URL escaping is a strong plain-value target.
PathUnescape
Explicit non-goals (2)
-
UserMuch of net/url revolves around mutable URL and Values objects rather than plain values. -
UserPasswordMuch of net/url revolves around mutable URL and Values objects rather than plain values.
Next
Constant-time scalar comparison helpers fit plain-value portability well.
ConstantTimeByteEqConstantTimeLessOrEq
Explicit non-goals (1)
-
XORBytesMutable byte-buffer APIs do not fit Locutus' current plain-value model.
Shipped (29)
Next
Go strings helpers are core portability targets for Locutus.
ContainsFuncContainsRuneFieldsFuncIndexByteIndexFuncIndexRuneLastIndexByteLastIndexFuncMapSplitAfterSplitAfterNTitleToLowerSpecialToTitleToTitleSpecialToUpperSpecialToValidUTF8TrimFuncTrimLeftFuncTrimRightFunc
Explicit non-goals (3)
-
CloneA string clone helper adds little value in JavaScript. -
NewReaderReader objects are not a stable plain-value target. -
NewReplacerReplacer objects are not a stable plain-value target.
Next
Filepath helpers are high-value plain string portability targets.
FromSlashIsLocalMatchSplitSplitListToSlashVolumeName
Explicit non-goals (7)
-
AbsAbsolute-path resolution depends on process working-directory state. -
EvalSymlinksSymlink resolution depends on filesystem state. -
GlobFilesystem globbing depends on host state. -
HasPrefixDeprecated path-prefix checks add little value to the roadmap. -
LocalizeOS-specific path localization depends on host path semantics. -
WalkFilesystem traversal depends on host state and callback side effects. -
WalkDirFilesystem traversal depends on host state and callback side effects.
Shipped (10)
Next
Parse and format helpers are strong plain-value portability targets.
CanBackquoteFormatUintIsGraphicIsPrintParseUintQuotedPrefixQuoteRuneQuoteRuneToASCIIQuoteRuneToGraphicQuoteToASCIIQuoteToGraphicUnquoteChar
Explicit non-goals (12)
-
AppendBoolByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendFloatByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendIntByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendQuoteByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendQuoteRuneByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendQuoteRuneToASCIIByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendQuoteRuneToGraphicByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendQuoteToASCIIByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendQuoteToGraphicByte-slice append APIs do not fit Locutus' current plain-value model. -
AppendUintByte-slice append APIs do not fit Locutus' current plain-value model. -
FormatComplexComplex-number formatting does not fit JS plain values. -
ParseComplexComplex-number parsing does not fit JS plain values.
Next
Time comparison has a clean plain-value contract.
Compare
Zero-time checks have a clean plain-value contract.
IsZero
Explicit non-goals (34)
-
AppendFormatMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
ClockMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
DateMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
DayMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
GobDecodeMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
GobEncodeMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
GoStringMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
HourMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
InMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
IsDSTMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
ISOWeekMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
LocalMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
LocationMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
MarshalBinaryMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
MarshalJSONMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
MarshalTextMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
MinuteMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
MonthMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
NanosecondMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
SecondMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
StringMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UnixMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UnixMicroMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UnixMilliMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UnixNanoMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UnmarshalBinaryMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UnmarshalJSONMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UnmarshalTextMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
UTCMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
WeekdayMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
YearMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
YearDayMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
ZoneMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract. -
ZoneBoundsMany time.Time methods revolve around rich time values, locations, or serialization details beyond one stable plain-value contract.
Shipped (1)
-
Encode
Next
Query-value lookup has a useful plain-value contract.
Get
Query-value membership checks have a useful plain-value contract.
Has
Explicit non-goals (3)
-
AddURL values methods revolve around mutable multi-value maps rather than one plain-value contract. -
DelURL values methods revolve around mutable multi-value maps rather than one plain-value contract. -
SetURL values methods revolve around mutable multi-value maps rather than one plain-value contract.
Shipped (2)
Next
Index search helpers are useful plain-value targets.
Find
Search helpers have a clean plain-value contract.
SearchSearchFloat64sSearchInts
Explicit non-goals (13)
-
Float64sMost sort APIs depend on mutable slices or callback-driven ordering. -
Float64sAreSortedMost sort APIs depend on mutable slices or callback-driven ordering. -
GuessingGameMost sort APIs depend on mutable slices or callback-driven ordering. -
IntsMost sort APIs depend on mutable slices or callback-driven ordering. -
IntsAreSortedMost sort APIs depend on mutable slices or callback-driven ordering. -
IsSortedMost sort APIs depend on mutable slices or callback-driven ordering. -
ReverseMost sort APIs depend on mutable slices or callback-driven ordering. -
SliceMost sort APIs depend on mutable slices or callback-driven ordering. -
SliceIsSortedMost sort APIs depend on mutable slices or callback-driven ordering. -
SliceStableMost sort APIs depend on mutable slices or callback-driven ordering. -
SortMost sort APIs depend on mutable slices or callback-driven ordering. -
StableMost sort APIs depend on mutable slices or callback-driven ordering. -
StringsMost sort APIs depend on mutable slices or callback-driven ordering.
Shipped (4)
Next
IP mask construction has a clean plain-value contract.
CIDRMaskIPv4Mask
IPv4 construction has a clean plain-value contract.
IPv4
MAC parsing has a clean plain-value contract.
ParseMAC
Explicit non-goals (37)
-
DialMost net helpers depend on sockets, DNS, or host network state. -
DialIPMost net helpers depend on sockets, DNS, or host network state. -
DialTCPMost net helpers depend on sockets, DNS, or host network state. -
DialTimeoutMost net helpers depend on sockets, DNS, or host network state. -
DialUDPMost net helpers depend on sockets, DNS, or host network state. -
DialUnixMost net helpers depend on sockets, DNS, or host network state. -
FileConnMost net helpers depend on sockets, DNS, or host network state. -
FileListenerMost net helpers depend on sockets, DNS, or host network state. -
FilePacketConnMost net helpers depend on sockets, DNS, or host network state. -
InterfaceAddrsMost net helpers depend on sockets, DNS, or host network state. -
InterfaceByIndexMost net helpers depend on sockets, DNS, or host network state. -
InterfaceByNameMost net helpers depend on sockets, DNS, or host network state. -
InterfacesMost net helpers depend on sockets, DNS, or host network state. -
ListenMost net helpers depend on sockets, DNS, or host network state. -
ListenIPMost net helpers depend on sockets, DNS, or host network state. -
ListenMulticastUDPMost net helpers depend on sockets, DNS, or host network state. -
ListenPacketMost net helpers depend on sockets, DNS, or host network state. -
ListenTCPMost net helpers depend on sockets, DNS, or host network state. -
ListenUDPMost net helpers depend on sockets, DNS, or host network state. -
ListenUnixMost net helpers depend on sockets, DNS, or host network state. -
ListenUnixgramMost net helpers depend on sockets, DNS, or host network state. -
LookupAddrMost net helpers depend on sockets, DNS, or host network state. -
LookupCNAMEMost net helpers depend on sockets, DNS, or host network state. -
LookupHostMost net helpers depend on sockets, DNS, or host network state. -
LookupIPMost net helpers depend on sockets, DNS, or host network state. -
LookupMXMost net helpers depend on sockets, DNS, or host network state. -
LookupNSMost net helpers depend on sockets, DNS, or host network state. -
LookupPortMost net helpers depend on sockets, DNS, or host network state. -
LookupSRVMost net helpers depend on sockets, DNS, or host network state. -
LookupTXTMost net helpers depend on sockets, DNS, or host network state. -
PipeMost net helpers depend on sockets, DNS, or host network state. -
ResolveIPAddrMost net helpers depend on sockets, DNS, or host network state. -
ResolveTCPAddrMost net helpers depend on sockets, DNS, or host network state. -
ResolveUDPAddrMost net helpers depend on sockets, DNS, or host network state. -
ResolveUnixAddrMost net helpers depend on sockets, DNS, or host network state. -
TCPAddrFromAddrPortMost net helpers depend on sockets, DNS, or host network state. -
UDPAddrFromAddrPortMost net helpers depend on sockets, DNS, or host network state.
Shipped (1)
Next
Escaping helpers have a clean plain-value contract.
EscapedFragmentEscapedPath
URL host decomposition is a useful plain-value helper.
HostnamePort
URL absolute checks have a clean plain-value contract.
IsAbs
Request-URI formatting is a useful plain-value helper.
RequestURI
Explicit non-goals (7)
-
JoinPathURL object methods often revolve around structured URL state rather than one plain-value contract. -
MarshalBinaryURL object methods often revolve around structured URL state rather than one plain-value contract. -
ParseURL object methods often revolve around structured URL state rather than one plain-value contract. -
QueryURL object methods often revolve around structured URL state rather than one plain-value contract. -
RedactedURL object methods often revolve around structured URL state rather than one plain-value contract. -
StringURL object methods often revolve around structured URL state rather than one plain-value contract. -
UnmarshalBinaryURL object methods often revolve around structured URL state rather than one plain-value contract.
math
Next
Scalar math helpers are strong Go portability targets.
AbsAcosAcoshAsinAsinhAtanAtan2AtanhCbrtCeilCopysignCosCoshDimErfErfcErfcinvErfinvExpExp2Expm1Float32bitsFloat32frombitsFloat64bitsFloat64frombitsFloorFMAFrexpGammaHypotIlogbInfIsInfIsNaNJ0J1JnLdexpLgammaLogLog10Log1pLog2LogbMaxMinModModfNaNNextafterNextafter32PowPow10RemainderRoundRoundToEvenSignbitSinSincosSinhSqrtTanTanhTruncY0Y1Yn
bits
Next
Bit-twiddling helpers over integers are strong scalar portability targets.
AddAdd32Add64DivDiv32Div64LeadingZerosLeadingZeros16LeadingZeros32LeadingZeros64LeadingZeros8LenLen16Len32Len64Len8MulMul32Mul64OnesCountOnesCount16OnesCount32OnesCount64OnesCount8RemRem32Rem64ReverseReverse16Reverse32Reverse64Reverse8ReverseBytesReverseBytes16ReverseBytes32ReverseBytes64RotateLeftRotateLeft16RotateLeft32RotateLeft64RotateLeft8SubSub32Sub64TrailingZerosTrailingZeros16TrailingZeros32TrailingZeros64TrailingZeros8
slices
Next
Pure slice transforms and search helpers are strong portability targets when they do not mutate caller-owned state.
AllAppendSeqBackwardBinarySearchCollect
Slice chunking has a clean plain-value contract.
Chunk
Adjacent de-duplication has a clean plain-value contract.
Compact
Lexicographic slice comparison has a clean plain-value contract.
Compare
Slice concatenation maps naturally onto JS arrays.
Concat
Membership checks have a clean plain-value contract.
Contains
Non-mutating delete semantics can be modeled as array slicing.
Delete
Slice equality has a clean plain-value contract.
Equal
Membership search has a clean plain-value contract.
Index
Pure slice insertion has a clean plain-value contract.
Insert
Order checks have a clean plain-value contract.
IsSorted
Aggregate scalar helpers have a clean plain-value contract.
MaxMin
Slice repetition maps naturally onto array repetition.
Repeat
Pure slice replacement has a clean plain-value contract.
Replace
Reversal has a clean plain-value contract.
Reverse
Deterministic slice sorting is a strong portability target.
Sort
Explicit non-goals (19)
-
BinarySearchFuncComparator-callback variants add more runtime-shape complexity than value. -
ClipCapacity trimming does not matter in JS array semantics. -
CloneCloning alone adds little value for JS arrays. -
CompactFuncComparator-callback variants add more runtime-shape complexity than value. -
CompareFuncComparator-callback variants add more runtime-shape complexity than value. -
ContainsFuncPredicate-callback variants add more runtime-shape complexity than value. -
DeleteFuncPredicate-callback deletion adds more runtime-shape complexity than value. -
EqualFuncComparator-callback variants add more runtime-shape complexity than value. -
GrowCapacity growth does not matter in JS array semantics. -
IndexFuncPredicate-callback variants add more runtime-shape complexity than value. -
IsSortedFuncComparator-callback variants add more runtime-shape complexity than value. -
MaxFuncComparator-callback variants add more runtime-shape complexity than value. -
MinFuncComparator-callback variants add more runtime-shape complexity than value. -
SortedIterator-oriented collection helpers do not map cleanly to Locutus today. -
SortedFuncIterator-oriented collection helpers do not map cleanly to Locutus today. -
SortedStableFuncIterator-oriented collection helpers do not map cleanly to Locutus today. -
SortFuncComparator-callback variants add more runtime-shape complexity than value. -
SortStableFuncComparator-callback variants add more runtime-shape complexity than value. -
ValuesIterator-oriented collection helpers do not map cleanly to Locutus today.
unicode
Next
Character classification helpers have a clean scalar portability contract.
IsIsControlIsDigitIsGraphicIsLetterIsLowerIsMarkIsNumberIsOneOfIsPrintIsPunctIsSpaceIsSymbolIsTitleIsUpper
Codepoint folding has a clean scalar portability contract.
SimpleFold
Codepoint case conversion has a clean scalar portability contract.
ToLowerToTitleToUpper
utf8
Next
String-oriented rune decoding has a clean plain-value contract.
DecodeLastRuneInStringDecodeRuneInString
String-oriented UTF-8 validity checks have a clean plain-value contract.
FullRuneInStringValidString
String-oriented UTF-8 counting has a clean plain-value contract.
RuneCountInString
Rune-size helpers have a clean scalar portability contract.
RuneLen
Rune-validity checks have a clean scalar portability contract.
ValidRune
Explicit non-goals (8)
-
AppendRuneMany utf8 helpers operate on byte slices rather than plain JS values. -
DecodeLastRuneMany utf8 helpers operate on byte slices rather than plain JS values. -
DecodeRuneMany utf8 helpers operate on byte slices rather than plain JS values. -
EncodeRuneMany utf8 helpers operate on byte slices rather than plain JS values. -
FullRuneMany utf8 helpers operate on byte slices rather than plain JS values. -
RuneCountMany utf8 helpers operate on byte slices rather than plain JS values. -
RuneStartMany utf8 helpers operate on byte slices rather than plain JS values. -
ValidMany utf8 helpers operate on byte slices rather than plain JS values.
cmp
Next
Generic comparison helpers over plain values are strong portability targets.
CompareLessOr
maps
Next
Plain map cloning maps naturally onto JS object copying.
Clone
Plain map equality has a clean portability contract.
Equal
Explicit non-goals (8)
-
AllParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract. -
CollectParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract. -
CopyParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract. -
DeleteFuncParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract. -
EqualFuncParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract. -
InsertParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract. -
KeysParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract. -
ValuesParts of maps revolve around iterators or callback-driven equality rather than one stable plain-value contract.
hex
Next
Encoded-length helpers have a clean plain-value contract.
EncodedLen
Explicit non-goals (11)
-
AppendDecodeByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
AppendEncodeByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
DecodeByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
DecodedLenByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
DecodeStringByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
DumpByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
DumperByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
EncodeByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
EncodeToStringByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
NewDecoderByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default. -
NewEncoderByte-slice oriented hex helpers do not fit Locutus' current plain-value model by default.