PowerShell modules in TypeScript
TypeScript implementations of 18 PowerShell standard library functions across 1 module. Each function is individually importable and tree-shakeable.
string- contains
- endswith
- indexof
- insert
- lastindexof
- length
- padleft
- padright
- remove
- replace
- split
- startswith
- substring
- tolower
- toupper
- trim
- trimend
- trimstart
We have 18 PowerShell functions so far - help us add more
Got a rainy Sunday afternoon and a taste for a porting puzzle?
- Get inspiration from PowerShell docs.
- 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 18/152 shipped · 100 next 12%
Locutus tracks 10 upstream namespaces for PowerShell 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 a broader slice of official .NET core surfaces that are idiomatic in PowerShell, using docs-backed catalogs and excluding the wider .NET ecosystem.
Shipped (18)
-
Contains -
EndsWith -
IndexOf -
Insert -
LastIndexOf -
Length -
PadLeft -
PadRight -
Remove -
Replace -
Split -
StartsWith -
Substring -
ToLower -
ToUpper -
Trim -
TrimEnd -
TrimStart
Next
Most System.String methods are strong plain-value portability targets.
CompareToEqualsToLowerInvariantToUpperInvariant
Explicit non-goals (1)
-
CloneClone adds little value for immutable JS strings.
System.Math static methods
Next
Scalar math helpers are strong plain-value portability targets for PowerShell.
AbsAcosAsinAtanAtan2CeilingClampCopySignCosCoshExpFloorLogLog10Log2MaxMinPowRoundSignSinSinhSqrtTanTanhTruncate
System.Convert static methods
Next
Scalar conversion helpers are strong PowerShell portability targets.
FromBase64CharArrayFromBase64StringFromHexStringToBase64CharArrayToBase64StringToBooleanToByteToCharToDecimalToDoubleToHexStringToInt16ToInt32ToInt64ToSByteToSingleToStringToUInt16ToUInt32ToUInt64
Explicit non-goals (2)
-
ChangeTypeType-descriptor-driven conversion depends on host runtime type metadata. -
GetTypeCodeEnum-style runtime type codes are not a stable plain-value portability target.
System.Char static methods
Next
Character classification and case helpers are strong plain-value portability targets.
ConvertFromUtf32ConvertToUtf32IsAsciiIsControlIsDigitIsLetterIsLetterOrDigitIsLowerIsNumberIsPunctuationIsSeparatorIsSymbolIsUpperIsWhiteSpaceParseToLowerToUpper
Numeric codepoint classification has a clean plain-value contract.
GetNumericValue
Explicit non-goals (1)
-
GetUnicodeCategory.NET enum return values do not map cleanly onto one stable Locutus contract yet.
System.TimeSpan static and instance methods
Next
Duration comparison has a clean plain-value contract.
Compare
Duration construction from scalars has a clean plain-value contract.
FromDaysFromHoursFromMillisecondsFromMinutesFromSeconds
Duration parsing has a clean plain-value contract.
Parse
Exact duration parsing has a clean plain-value contract.
ParseExact
Explicit non-goals (1)
-
ToStringTimeSpan struct APIs mix duration values with richer struct semantics than one stable plain-value contract by default.
System.Uri static and instance methods
Next
URI classification helpers have a clean plain-value contract.
CheckHostName
URL escaping is a strong plain-value portability target.
EscapeDataStringEscapeUriString
URI character predicates have a clean plain-value contract.
IsHexDigit
URI encoding predicates have a clean plain-value contract.
IsHexEncoding
URL unescaping is a strong plain-value portability target.
UnescapeDataString
System.DateTime static and instance methods
Next
Date ordering has a clean plain-value contract.
Compare
Calendar math has a clean plain-value contract.
DaysInMonth
Leap-year checks have a clean plain-value contract.
IsLeapYear
String-to-date parsing is a useful portability target.
Parse
Exact string-to-date parsing is a useful portability target.
ParseExact
Explicit non-goals (11)
-
AddTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
AddDaysTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
AddHoursTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
AddMillisecondsTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
AddMinutesTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
AddMonthsTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
AddSecondsTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
AddYearsTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
SubtractTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
ToLocalTimeTimezone-aware date objects do not fit Locutus' current plain-value model by default. -
ToUniversalTimeTimezone-aware date objects do not fit Locutus' current plain-value model by default.
System.Guid static and instance methods
Next
GUID parsing from strings has a clean plain-value contract.
Parse
Exact GUID parsing has a clean plain-value contract.
ParseExact
GUID formatting has a clean plain-string contract.
ToString
Guarded GUID parsing has a clean plain-value contract.
TryParseTryParseExact
Explicit non-goals (2)
-
EmptyStruct constants are not plain-value portability targets. -
NewGuidRandom GUID generation is lower-value than deterministic portability work.
System.Version static and instance methods
Next
Version parsing and comparison helpers are strong plain-value portability targets.
CompareToParseRevisionToStringTryFormat
System.Array static methods
Next
Search helpers over plain arrays have a clean plain-value contract.
BinarySearchIndexOfLastIndexOf
Explicit non-goals (16)
-
ClearArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
ConstrainedCopyArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
ConvertAllArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
CopyArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
EmptyArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
ExistsArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
FillArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
FindArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
FindAllArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
FindIndexArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
FindLastArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
FindLastIndexArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
ForEachArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
ReverseArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
SortArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model. -
TrueForAllArray reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.