Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

private-proxy

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

private-proxy - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "private-proxy",
"version": "0.0.1",
"version": "0.0.2",
"private": false,

@@ -5,0 +5,0 @@ "description": "Convert any object into one that supports private properties, using the familiar Object API for getting and setting keys.",

@@ -5,3 +5,2 @@ ## Features

- Leverages the Proxy object.
- Objects retain original prototype.
- Objects are inspectable, and non-private properties are mutable/inspectable.

@@ -28,3 +27,3 @@

#### Works with any objects, included classes
#### Works with any objects, including classes

@@ -31,0 +30,0 @@ ```

@@ -1,2 +0,2 @@

const p = require('./index.js');
const pp = require('./index.js');
const assert = require('assert');

@@ -8,3 +8,3 @@

myObj.name = 'Robert';
const privateObj = p(myObj);
const privateObj = pp(myObj);

@@ -19,3 +19,3 @@ assert(privateObj.name === 'Robert', 'Public property is accessible directly');

it('locks an object upon conversion, so that all keys defined thereafter are considered private', () => {
const privateObj = p({});
const privateObj = pp({});
privateObj.name = 'Rob';

@@ -34,3 +34,3 @@ privateObj.name = 'Joey';

}
const privateAnimal = p(new Animal('Fido'));
const privateAnimal = pp(new Animal('Fido'));

@@ -54,21 +54,6 @@ assert(privateAnimal instanceof Animal, 'Class instance is unchanged');

};
const privateObj = p(myObj);
const privateObj = pp(myObj);
privateObj.age = 25;
assert(Object.keys(privateObj).length === 1 && Object.keys(privateObj)[0] === 'name', 'Only public properties are enumerable');
});
})
// console.log(myObj);
// let myObj2 = {};
// console.log(myObj2);
// myObj.name = 'Rob';
// console.log(myObj);
// myObj2.name = 'Rob';
// console.log(myObj2);
// myObj2 = privateProps(myObj2);
// console.log(myObj2, myObj2.name);
// myObj.name = 'Joey';
// console.log(myObj, myObj.name);
// myObj2.name = 'Joey';
// console.log(myObj2.name);
// console.log(myObj.name);
});
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