Orden
Parse a markdown table into an array of objects (with optional types). Perfect for mocking data:
; const data = ; console;// [// { name: "Francisco", age: 25, active: true },// { name: "Maria", age: 20, active: false },// ]
Types
:s
,:string
: the default String type.:n
,:number
: parse as a Javascript number:b
,:boolean
: parse as true/false. MUST betrue
to parse as true.:o
,:object
: parse a JSON string to an object. Make sure the data is a valid JSON Object. Does not work with arrays or other JSON types.
; const data = ; console;// [{ id: 123, name: "Francisco", location: { city: 'London', country: 'UK' } }]
Define types
To define types use the second parameter:
; const date = str; const all = ;
If you want to define global types, you can do so with the key types
(these are global, use with caution and only in user-code):
;types str;typesd = typesd;