Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
postgres-array
Advanced tools
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.
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}'
pg-promise is a PostgreSQL interface for Node.js. It includes robust support for parameterized queries, named parameters, and automatic conversion of JavaScript objects to PostgreSQL hstore format. It provides more comprehensive database interaction functionalities compared to postgres-array, which focuses solely on array conversion.
Parse postgres array columns
$ npm install --save postgres-array
var postgresArray = require('postgres-array')
postgresArray.parse('{1,2,3}', parseInt);
//=> [1, 2, 3]
parse(input, [transform])
-> array
Required
Type: string
A Postgres array string.
Type: function
Default: identity
A function that transforms non-null values inserted into the array.
MIT © Ben Drucker
FAQs
Parse postgres array columns
The npm package postgres-array receives a total of 7,587,191 weekly downloads. As such, postgres-array popularity was classified as popular.
We found that postgres-array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.