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

@stamp/privatize

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stamp/privatize - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

31

__tests__/index.js

@@ -7,3 +7,3 @@ var compose = require('@stamp/compose');

var accessFoo, accessBar;
var orig = compose({
var Orig = compose({
properties: {foo: 1},

@@ -18,3 +18,3 @@ methods: {

});
var Stamp = orig.compose(Privatize).privatizeMethods('bar');
var Stamp = Orig.compose(Privatize).privatizeMethods('bar');
var instance = Stamp();

@@ -26,3 +26,3 @@

expect(accessFoo).toBe(1);
expect(accessBar).toBe(orig.compose.methods.bar);
expect(accessBar).toBe(Orig.compose.methods.bar);
});

@@ -54,3 +54,3 @@

var Stamp = compose(Privatize, {
properties: { bar: 'foo' },
properties: { bar: 'foo' }
});

@@ -60,3 +60,26 @@ var instance = Stamp();

expect(instance.bar).toBeUndefined();
});
it('can be used as a standalone function', function () {
var privatizeMethods = Privatize.privatizeMethods;
var accessFoo, accessBar;
var Orig = compose({
properties: {foo: 1},
methods: {
bar: function () {},
checkAccess: function () {
accessFoo = this.foo;
accessBar = this.bar;
}
}
});
var Stamp = privatizeMethods('bar').compose(Orig);
var instance = Stamp();
expect(instance.foo).toBeUndefined();
expect(instance.bar).toBeUndefined();
instance.checkAccess();
expect(accessFoo).toBe(1);
expect(accessBar).toBe(Orig.compose.methods.bar);
})
});

8

index.js

@@ -41,3 +41,3 @@ var compose = require('@stamp/compose');

module.exports = compose({
var Privatize = compose({
initializers: [initializer],

@@ -47,2 +47,3 @@ deepConfiguration: {Privatize: {methods: []}},

privatizeMethods: function () {
'use strict';
var methodNames = [];

@@ -55,3 +56,4 @@ for (var i = 0; i < arguments.length; i++) {

}
return this.compose({
var Stamp = this && this.compose ? this : Privatize;
return Stamp.compose({
deepConfiguration: {

@@ -72,1 +74,3 @@ Privatize: {

});
module.exports = Privatize;
{
"name": "@stamp/privatize",
"version": "1.0.0",
"version": "1.0.1",
"description": "Protect private properties",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,2 +22,8 @@ # @stamp/privatize

Or if you don't want to import the stamp you can import only the method:
```js
import {privatizeMethods} from '@stamp/privatize';
const AuthWithPrivatePropertiesAndMethod = Auth.compose(privatizeMethods('setPassword'));
```
## Warning!

@@ -24,0 +30,0 @@ Every property you assign in the initializers will be private.

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