Socket
Socket
Sign inDemoInstall

neo4j-driver-core

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neo4j-driver-core - npm Package Compare versions

Comparing version 4.4.7 to 4.4.8

lib/internal/object-util.js

46

lib/integer.js

@@ -705,6 +705,9 @@ "use strict";

* @param {number=} radix The radix in which the text is written (2-36), defaults to 10
* @param {Object} [opts={}] Configuration options
* @param {boolean} [opts.strictStringValidation=false] Enable strict validation generated Integer.
* @returns {!Integer} The corresponding Integer value
* @expose
*/
Integer.fromString = function (str, radix) {
Integer.fromString = function (str, radix, _a) {
var _b = _a === void 0 ? {} : _a, strictStringValidation = _b.strictStringValidation;
if (str.length === 0) {

@@ -736,3 +739,7 @@ throw (0, error_1.newError)('number format error: empty string');

var size = Math.min(8, str.length - i);
var value = parseInt(str.substring(i, i + size), radix);
var valueString = str.substring(i, i + size);
var value = parseInt(valueString, radix);
if (strictStringValidation === true && !_isValidNumberFromString(valueString, value, radix)) {
throw (0, error_1.newError)("number format error: \"" + valueString + "\" is NaN in radix " + radix + ": " + str);
}
if (size < 8) {

@@ -753,6 +760,9 @@ var power = Integer.fromNumber(Math.pow(radix, size));

* @param {!Integer|number|string|bigint|!{low: number, high: number}} val Value
* @param {Object} [opts={}] Configuration options
* @param {boolean} [opts.strictStringValidation=false] Enable strict validation generated Integer.
* @returns {!Integer}
* @expose
*/
Integer.fromValue = function (val) {
Integer.fromValue = function (val, opts) {
if (opts === void 0) { opts = {}; }
if (val /* is compatible */ instanceof Integer) {

@@ -765,3 +775,3 @@ return val;

if (typeof val === 'string') {
return Integer.fromString(val);
return Integer.fromString(val, undefined, opts);
}

@@ -865,2 +875,28 @@ if (typeof val === 'bigint') {

}());
/**
* @private
* @param num
* @param radix
* @param minSize
* @returns {string}
*/
function _convertNumberToString(num, radix, minSize) {
var theNumberString = num.toString(radix);
var paddingLength = Math.max(minSize - theNumberString.length, 0);
var padding = '0'.repeat(paddingLength);
return "" + padding + theNumberString;
}
/**
*
* @private
* @param theString
* @param theNumber
* @param radix
* @return {boolean} True if valid
*/
function _isValidNumberFromString(theString, theNumber, radix) {
return !Number.isNaN(theString) &&
!Number.isNaN(theNumber) &&
_convertNumberToString(theNumber, radix, theString.length) === theString.toLowerCase();
}
Object.defineProperty(Integer.prototype, '__isInteger__', {

@@ -917,2 +953,4 @@ value: true,

* @param {Mixed} value - The value to use.
* @param {Object} [opts={}] Configuration options
* @param {boolean} [opts.strictStringValidation=false] Enable strict validation generated Integer.
* @return {Integer} - An object of type Integer.

@@ -919,0 +957,0 @@ */

4

lib/internal/index.js

@@ -40,3 +40,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.retryStrategy = exports.resolver = exports.serverAddress = exports.urlUtil = exports.logger = exports.connectivityVerifier = exports.transactionExecutor = exports.txConfig = exports.connectionHolder = exports.constants = exports.bookmark = exports.observer = exports.temporalUtil = exports.util = void 0;
exports.objectUtil = exports.retryStrategy = exports.resolver = exports.serverAddress = exports.urlUtil = exports.logger = exports.connectivityVerifier = exports.transactionExecutor = exports.txConfig = exports.connectionHolder = exports.constants = exports.bookmark = exports.observer = exports.temporalUtil = exports.util = void 0;
var util = __importStar(require("./util"));

@@ -70,1 +70,3 @@ exports.util = util;

exports.retryStrategy = retryStrategy;
var objectUtil = __importStar(require("./object-util"));
exports.objectUtil = objectUtil;

@@ -21,3 +21,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createBrokenObject = exports.ENCRYPTION_OFF = exports.ENCRYPTION_ON = exports.validateQueryAndParameters = exports.assertValidDate = exports.assertNumberOrInteger = exports.assertNumber = exports.assertString = exports.assertObject = exports.isString = exports.isObject = exports.isEmptyObjectOrNull = void 0;
exports.ENCRYPTION_OFF = exports.ENCRYPTION_ON = exports.validateQueryAndParameters = exports.assertValidDate = exports.assertNumberOrInteger = exports.assertNumber = exports.assertString = exports.assertObject = exports.isString = exports.isObject = exports.isEmptyObjectOrNull = void 0;
var integer_1 = require("../integer");

@@ -200,30 +200,1 @@ var json_1 = require("../json");

exports.isString = isString;
/**
* Creates a object which all method call will throw the given error
*
* @param {Error} error The error
* @param {any} object The object. Default: {}
* @returns {any} A broken object
*/
function createBrokenObject(error, object) {
if (object === void 0) { object = {}; }
var fail = function () {
throw error;
};
return new Proxy(object, {
get: fail,
set: fail,
apply: fail,
construct: fail,
defineProperty: fail,
deleteProperty: fail,
getOwnPropertyDescriptor: fail,
getPrototypeOf: fail,
has: fail,
isExtensible: fail,
ownKeys: fail,
preventExtensions: fail,
setPrototypeOf: fail,
});
}
exports.createBrokenObject = createBrokenObject;

@@ -22,2 +22,3 @@ "use strict";

exports.stringify = void 0;
var object_util_1 = require("./internal/object-util");
/**

@@ -31,5 +32,14 @@ * Custom version on JSON.stringify that can handle values that normally don't support serialization, such as BigInt.

return JSON.stringify(val, function (_, value) {
return typeof value === 'bigint' ? value + "n" : value;
if ((0, object_util_1.isBrokenObject)(value)) {
return {
__isBrokenObject__: true,
__reason__: (0, object_util_1.getBrokenObjectReason)(value)
};
}
if (typeof value === 'bigint') {
return value + "n";
}
return value;
});
}
exports.stringify = stringify;
{
"name": "neo4j-driver-core",
"version": "4.4.7",
"version": "4.4.8",
"description": "Internals of neo4j-driver",

@@ -42,3 +42,3 @@ "main": "lib/index.js",

},
"gitHead": "9669489561fe7cb792526df2a35df56a88ac9b72"
"gitHead": "289c1ba147c03d3354aee413e1078ccad95d6dbb"
}

@@ -340,6 +340,10 @@ /**

* @param {number=} radix The radix in which the text is written (2-36), defaults to 10
* @param {Object} [opts={}] Configuration options
* @param {boolean} [opts.strictStringValidation=false] Enable strict validation generated Integer.
* @returns {!Integer} The corresponding Integer value
* @expose
*/
static fromString(str: string, radix?: number): Integer;
static fromString(str: string, radix?: number, { strictStringValidation }?: {
strictStringValidation?: boolean;
}): Integer;
/**

@@ -349,6 +353,10 @@ * Converts the specified value to a Integer.

* @param {!Integer|number|string|bigint|!{low: number, high: number}} val Value
* @param {Object} [opts={}] Configuration options
* @param {boolean} [opts.strictStringValidation=false] Enable strict validation generated Integer.
* @returns {!Integer}
* @expose
*/
static fromValue(val: Integerable): Integer;
static fromValue(val: Integerable, opts?: {
strictStringValidation?: boolean;
}): Integer;
/**

@@ -389,2 +397,4 @@ * Converts the specified value to a number.

* @param {Mixed} value - The value to use.
* @param {Object} [opts={}] Configuration options
* @param {boolean} [opts.strictStringValidation=false] Enable strict validation generated Integer.
* @return {Integer} - An object of type Integer.

@@ -391,0 +401,0 @@ */

@@ -33,2 +33,3 @@ /**

import * as retryStrategy from './retry-strategy';
export { util, temporalUtil, observer, bookmark, constants, connectionHolder, txConfig, transactionExecutor, connectivityVerifier, logger, urlUtil, serverAddress, resolver, retryStrategy };
import * as objectUtil from './object-util';
export { util, temporalUtil, observer, bookmark, constants, connectionHolder, txConfig, transactionExecutor, connectivityVerifier, logger, urlUtil, serverAddress, resolver, retryStrategy, objectUtil };

@@ -98,10 +98,2 @@ /**

declare function isString(str: any): str is string;
/**
* Creates a object which all method call will throw the given error
*
* @param {Error} error The error
* @param {any} object The object. Default: {}
* @returns {any} A broken object
*/
declare function createBrokenObject<T extends object>(error: Error, object?: any): T;
export { isEmptyObjectOrNull, isObject, isString, assertObject, assertString, assertNumber, assertNumberOrInteger, assertValidDate, validateQueryAndParameters, ENCRYPTION_ON, ENCRYPTION_OFF, createBrokenObject };
export { isEmptyObjectOrNull, isObject, isString, assertObject, assertString, assertNumber, assertNumberOrInteger, assertValidDate, validateQueryAndParameters, ENCRYPTION_ON, ENCRYPTION_OFF };
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc