@stamp/privatize
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -48,2 +48,11 @@ var compose = require('@stamp/compose'); | ||
}); | ||
it('should work without any methods defined', function () { | ||
var Stamp = compose(Privatize, { | ||
properties: { bar: 'foo' }, | ||
}); | ||
var instance = Stamp(); | ||
expect(instance.bar).toBeUndefined(); | ||
}) | ||
}); |
10
index.js
@@ -22,5 +22,12 @@ var compose = require('@stamp/compose'); | ||
var privateMethodNames = descriptor.deepConfiguration.Privatize.methods; | ||
var newObject = {}; | ||
privates.set(newObject, this); | ||
var methods = descriptor.methods; | ||
if (!methods) { | ||
return newObject; | ||
} | ||
var methodNames = Object.keys(methods); | ||
var newObject = {}; | ||
for (var i = 0; i < methodNames.length; i++) { | ||
@@ -32,3 +39,2 @@ var name = methodNames[i]; | ||
} | ||
privates.set(newObject, this); | ||
return newObject; | ||
@@ -35,0 +41,0 @@ } |
{ | ||
"name": "@stamp/privatize", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Protect private properties", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6694
107