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

js.private

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js.private - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

src/Private.js

17

dst/Private.js

@@ -22,6 +22,4 @@ "use strict";

this.props = props;
this.owners = [];
this.values = [];
this.key = Math.random().toString(36).replace(/^.{2}/, "_private_");
this.get = this.get.bind(this);
this.get.destroy = this.destroy.bind(this);
}

@@ -32,5 +30,3 @@

value: function get(context) {
var key = this.owners.indexOf(context);
if (key < 0) key = this.set(context);
return this.values[key];
return context[this.key] || this.set(context);
}

@@ -43,11 +39,4 @@ }, {

if (clone.hasOwnProperty(attr) && clone[attr] instanceof Function) clone[attr] = clone[attr].bind(context);
}this.owners.push(context);
return this.values.push(clone) - 1;
}return context[this.key] = clone;
}
}, {
key: "destroy",
value: function destroy(context) {
var key = this.owners.indexOf(context);
return delete this.owners[key] && delete this.values[key];
}
}]);

@@ -54,0 +43,0 @@

{
"name": "js.private",
"version": "0.0.3",
"version": "0.0.4",
"description": "Private properties for objects",

@@ -5,0 +5,0 @@ "main": "./dst/Private.js",

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