You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

postgres-array

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postgres-array

Parse postgres array columns

3.0.1
Source
npm
Version published
Weekly downloads
14M
-1.67%
Maintainers
1
Weekly downloads
 
Created

What is postgres-array?

The postgres-array package is a utility for parsing and serializing arrays in the format used by PostgreSQL. It allows Node.js applications to easily convert between JavaScript arrays and the string format used by PostgreSQL for array columns.

What are postgres-array's main functionalities?

Parsing PostgreSQL array strings to JavaScript arrays

This feature allows you to convert a PostgreSQL array string into a JavaScript array. It is useful when you fetch data from a PostgreSQL database and want to work with it in JavaScript.

const parse = require('postgres-array').parse;
let postgresArray = '{1,2,3,4}';
let jsArray = parse(postgresArray);
// jsArray is now [1, 2, 3, 4]

Serializing JavaScript arrays to PostgreSQL array strings

This feature allows you to convert a JavaScript array into a PostgreSQL array string. It is useful when you need to insert or update data in a PostgreSQL database that requires the array format.

const stringify = require('postgres-array').stringify;
let jsArray = [1, 2, 3, 4];
let postgresArray = stringify(jsArray);
// postgresArray is now '{1,2,3,4}'

Other packages similar to postgres-array

Keywords

postgres

FAQs

Package last updated on 29 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts