3.13.2-ts.3 • Published 5 months ago
@rbxts-js/pretty-format v3.13.2-ts.3
pretty-format
Upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/pretty-format
Stringify any Luau value
- Supports Luau builtins and Roblox Instances.
- Can be extended with user defined plugins.
:pencil2: Notes
- :warning: Our
prettyFormat
doesn't distinguish betweenTables
,Arrays
,Objects
, etc. and prints out all Lua table-like types asTable
.- For example, an empty array is printed as
Table {}
and an array with values is printed asTable {1, 2, 3,}
. printComplexValue
is reduced to just arrays and tables.
- For example, an empty array is printed as
- :x: Color formatting isn't supported so all related methods are omitted.
- :hammer: Built-in plugins for
prettyFormat
are not implemented yet. prettyFormat
formats RobloxDateTime
objects as a replacement for JSDate
.- Formats using the Lua native string representations of primitives like
nil
,nan
andinf
over the JSnull
,NaN
andInfinity
. The tests are modified accordingly. - Formatting for any Javascript specific types in are omitted,
Symbol
, namedFunction
,Error
,Date
,BigInt
, etc. getConfig
is rewritten to avoid ternary operators. loop is rewritten with afor
loop instead of aniterator.next()
.Collections.lua
deviates from upstream substantially since Lua only has tables. We only have two functions:printTableEntries
for formatting key, value pairs andprintListItems
for formatting arrays.