binary-parser
binary-parser copied to clipboard
Array of strings?
Looks like this is the only way, which is really messy.
.array('strings', {
type: new Parser()
.string('text', {
length: 64,
stripNull: true
}),
length: 'stringCount'
})
That would result in something like this:
"strings": [
{ "text": "hello" },
...
]
Something more ideal would just be an actual array of strings:
"strings": [ "Hello", ... ]
.array('strings', {
type: new Parser()
.string('text', {
length: 64,
stripNull: true
}),
length: 'stringCount',
formatter: arr => arr.map(item => item.text)
})
The only way I see tbh (but it works!)
Just made this "workaround" for the array of strings, but an options to actually make a proper array of strings would be very welcome!