Parse PostgreSQL array column strings into JavaScript arrays. Current stable version is 3.0.4 (Node >=12). Released infrequently; latest version focused on ESM modernization. Key differentiator: minimal dependency, lightweight parser with optional transform function for type coercion. Alternative to manual parsing or using full pg driver within specific contexts.
npm install postgres-arrayNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parse a PostgreSQL array string with a transform function to convert string values to numbers.
Change `const postgresArray = require('postgres-array')` to `const { parse } = require('postgres-array')`.To handle nulls differently, check the value inside the transform and return your desired default.
Ensure the input string starts with '{' and ends with '}'. For nested arrays, see the parser's limitations.Use `const { parse } = require('postgres-array')`Either use ESM (`import`) or upgrade to Node >=12 and use `import`.
No dependency data recorded yet.