Socket
Socket
Sign inDemoInstall

pg-types

Package Overview
Dependencies
6
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.13.0 to 2.0.0

22

lib/textParsers.js

@@ -90,2 +90,15 @@ var array = require('postgres-array')

var parseIntervalArray = function(value) {
if (!value) { return null; }
var p = arrayParser.create(value, function(entry) {
if (entry !== null) {
entry = parseInterval(entry);
}
return entry;
});
return p.parse();
};
var parseByteAArray = function(value) {

@@ -108,9 +121,5 @@ if (!value) { return null; }

var parseJsonArray = function(value) {
var arr = parseStringArray(value);
if (!value) { return null; }
if (!arr) {
return arr;
}
return arr.map(function(el) { return JSON.parse(el); });
return array.parse(value, allowNull(JSON.parse));
};

@@ -193,2 +202,3 @@

register(1186, parseInterval);
register(1187, parseIntervalArray);
register(17, parseByteA);

@@ -195,0 +205,0 @@ register(114, JSON.parse.bind(JSON)); // json

{
"name": "pg-types",
"version": "1.13.0",
"version": "2.0.0",
"description": "Query result type converters for node-postgres",

@@ -31,7 +31,10 @@ "main": "index.js",

"pg-int8": "1.0.1",
"postgres-array": "~1.0.0",
"postgres-array": "~2.0.0",
"postgres-bytea": "~1.0.0",
"postgres-date": "~1.0.0",
"postgres-interval": "^1.1.0"
},
"engines": {
"node": ">=4"
}
}

@@ -335,2 +335,25 @@ 'use strict'

exports['array/json'] = {
format: 'text',
id: 199,
tests: [
[
'{{1,2},{[3],"[4,5]"},{null,NULL}}',
function (t, value) {
t.deepEqual(value, [
[1, 2],
[[3], [4, 5]],
[null, null],
])
}
]
]
}
exports['array/jsonb'] = {
format: 'text',
id: 3807,
tests: exports['array/json'].tests
}
exports['array/point'] = {

@@ -395,2 +418,15 @@ format: 'text',

exports['array/interval'] = {
format: 'text',
id: 1187,
tests: [
['{01:02:03,1 day -00:00:03}', function (t, value) {
var expecteds = [{hours: 1, minutes: 2, seconds: 3},
{days: 1, seconds: -3}]
t.equal(value.length, 2)
t.deepEqual(value, expecteds);
}]
]
}
exports['array/inet'] = {

@@ -397,0 +433,0 @@ format: 'text',

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc