PowerShell modules in TypeScript

TypeScript implementations of 18 PowerShell standard library functions across 1 module. Each function is individually importable and tree-shakeable.

string

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.

12% catalog shipped
Shipped Next Explicit non-goals
string 78% math 0% convert 0% char 0% timespan 0% uri 0% datetime 0% guid 0% version 0% array 0%
Tracked namespaces 10
Shipped 18/152
Next to port 100
Explicit non-goals 34

System.String instance methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.string

82% shipped
18/22 shipped 4 next 1 explicit non-goals
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.

  • CompareTo
  • Equals
  • ToLowerInvariant
  • ToUpperInvariant
Explicit non-goals (1)
  • Clone Skip Clone adds little value for immutable JS strings.

System.Math static methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.math

0% shipped
0/26 shipped 26 next

Next

Scalar math helpers are strong plain-value portability targets for PowerShell.

  • Abs
  • Acos
  • Asin
  • Atan
  • Atan2
  • Ceiling
  • Clamp
  • CopySign
  • Cos
  • Cosh
  • Exp
  • Floor
  • Log
  • Log10
  • Log2
  • Max
  • Min
  • Pow
  • Round
  • Sign
  • Sin
  • Sinh
  • Sqrt
  • Tan
  • Tanh
  • Truncate

System.Convert static methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.convert

0% shipped
0/20 shipped 20 next 2 explicit non-goals

Next

Scalar conversion helpers are strong PowerShell portability targets.

  • FromBase64CharArray
  • FromBase64String
  • FromHexString
  • ToBase64CharArray
  • ToBase64String
  • ToBoolean
  • ToByte
  • ToChar
  • ToDecimal
  • ToDouble
  • ToHexString
  • ToInt16
  • ToInt32
  • ToInt64
  • ToSByte
  • ToSingle
  • ToString
  • ToUInt16
  • ToUInt32
  • ToUInt64
Explicit non-goals (2)
  • ChangeType Skip Type-descriptor-driven conversion depends on host runtime type metadata.
  • GetTypeCode Skip Enum-style runtime type codes are not a stable plain-value portability target.

System.Char static methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.char

0% shipped
0/18 shipped 18 next 1 explicit non-goals

Next

Character classification and case helpers are strong plain-value portability targets.

  • ConvertFromUtf32
  • ConvertToUtf32
  • IsAscii
  • IsControl
  • IsDigit
  • IsLetter
  • IsLetterOrDigit
  • IsLower
  • IsNumber
  • IsPunctuation
  • IsSeparator
  • IsSymbol
  • IsUpper
  • IsWhiteSpace
  • Parse
  • ToLower
  • ToUpper

Numeric codepoint classification has a clean plain-value contract.

  • GetNumericValue
Explicit non-goals (1)
  • GetUnicodeCategory Skip .NET enum return values do not map cleanly onto one stable Locutus contract yet.

System.TimeSpan static and instance methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.timespan

0% shipped
0/8 shipped 8 next 1 explicit non-goals

Next

Duration comparison has a clean plain-value contract.

  • Compare

Duration construction from scalars has a clean plain-value contract.

  • FromDays
  • FromHours
  • FromMilliseconds
  • FromMinutes
  • FromSeconds

Duration parsing has a clean plain-value contract.

  • Parse

Exact duration parsing has a clean plain-value contract.

  • ParseExact
Explicit non-goals (1)
  • ToString Skip TimeSpan struct APIs mix duration values with richer struct semantics than one stable plain-value contract by default.

System.Uri static and instance methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.uri

0% shipped
0/6 shipped 6 next

Next

URI classification helpers have a clean plain-value contract.

  • CheckHostName

URL escaping is a strong plain-value portability target.

  • EscapeDataString
  • EscapeUriString

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

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.datetime

0% shipped
0/5 shipped 5 next 11 explicit non-goals

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)
  • Add Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • AddDays Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • AddHours Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • AddMilliseconds Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • AddMinutes Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • AddMonths Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • AddSeconds Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • AddYears Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • Subtract Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • ToLocalTime Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.
  • ToUniversalTime Skip Timezone-aware date objects do not fit Locutus' current plain-value model by default.

System.Guid static and instance methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.guid

0% shipped
0/5 shipped 5 next 2 explicit non-goals

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.

  • TryParse
  • TryParseExact
Explicit non-goals (2)
  • Empty Skip Struct constants are not plain-value portability targets.
  • NewGuid Skip Random GUID generation is lower-value than deterministic portability work.

System.Version static and instance methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.version

0% shipped
0/5 shipped 5 next

Next

Version parsing and comparison helpers are strong plain-value portability targets.

  • CompareTo
  • Parse
  • Revision
  • ToString
  • TryFormat

System.Array static methods

PowerShell 7.4 · Catalog source: manual inventory https://learn.microsoft.com/dotnet/api/system.array

0% shipped
0/3 shipped 3 next 16 explicit non-goals

Next

Search helpers over plain arrays have a clean plain-value contract.

  • BinarySearch
  • IndexOf
  • LastIndexOf
Explicit non-goals (16)
  • Clear Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • ConstrainedCopy Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • ConvertAll Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • Copy Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • Empty Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • Exists Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • Fill Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • Find Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • FindAll Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • FindIndex Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • FindLast Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • FindLastIndex Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • ForEach Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • Reverse Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • Sort Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.
  • TrueForAll Skip Array reflection and mutable runtime-array helpers do not map cleanly to Locutus' value-only model.