Parse and serialize PostgreSQL composite values
npm install postgres-composite> Parse and serialize postgres composite values
``
npm install --save postgres-composite
yarn add postgres-composite
`
`js
const { parse, serialize } = require('postgres-composite')
[...parse('(1,2,3)')]
// => ['1', '2', '3']
[...parse('(1,," 3")')]
// => ['1', null, ' 3']
[...parse('()')]
// => [null]
serialize(['1', '2', '3'])
// => '(1,2,3)'
serialize(['1', null, ' 3'])
// => '(1,," 3")'
`
#### parse(value: string): Iterable
The value must match format produced by the Postgres' composite output routine. The behavior with other formats is undefined.
#### serialize(attributes: Iterable
Throws RangeError` on empty input.
MIT © Peter B (@boromisp)