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

object-lib

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-lib - npm Package Compare versions

Comparing version

to
5.2.2

10

lib/core/safe-proxy.js

@@ -15,3 +15,3 @@ const BYPASS_PROPS = [

// Proxy that errors when accessing non-existent properties
const SafeProxy = (tgt, ctx, path = '') => {
const SafeProxy = (tgt, ctx, key = '') => {
// eslint-disable-next-line @blackflux/rules/prevent-typeof-object

@@ -29,7 +29,7 @@ if (tgt === null || typeof tgt !== 'object') {

const propStr = typeof prop === 'symbol' ? prop.toString() : String(prop);
const currentPath = path ? `${path}.${propStr}` : propStr;
const currentKey = key ? `${key}.${propStr}` : propStr;
const found = prop in target;
if (!found && ctx?.throw !== false) {
throw new Error(`Property '${currentPath}' does not exist`);
throw new Error(`Property '${currentKey}' does not exist`);
}

@@ -40,3 +40,3 @@

if (typeof ctx?.cb === 'function') {
value = ctx.cb(currentPath, value, found);
value = ctx.cb(currentKey, value, found);
}

@@ -46,3 +46,3 @@

if (value !== null && typeof value === 'object') {
return SafeProxy(value, ctx, currentPath);
return SafeProxy(value, ctx, currentKey);
}

@@ -49,0 +49,0 @@

{
"name": "object-lib",
"type": "module",
"version": "5.2.1",
"version": "5.2.2",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "repository": {