Comparing version 3.4.4 to 3.4.5
@@ -85,3 +85,3 @@ (function(self) { | ||
// If fn name is private or promise private is true, reject when called directly | ||
if (fn && (!caller || caller == '__user__') && ((typeof(fn) === 'function' && fn.name == 'private') || (fn.then && fn.private))) | ||
if (fn && (!caller || caller == '__user__') && ((typeof(fn) === 'function' && (fn.name == '$private' || fn.name == 'private')) || (fn.then && fn.private))) | ||
return clues.Promise.rejected({ref : ref, message: ref+' not defined', fullref:fullref,caller: caller, notDefined:true}); | ||
@@ -141,3 +141,3 @@ | ||
if (fn.name == 'private') | ||
if (fn.name == 'private' || fn.name == '$private') | ||
value.private = true; | ||
@@ -144,0 +144,0 @@ |
{ | ||
"name": "clues", | ||
"version": "3.4.4", | ||
"version": "3.4.5", | ||
"description": "Lightweight logic tree solver using promises.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -87,3 +87,3 @@ [![NPM Version][npm-image]][npm-url] | ||
* Any [array whose last element is a function](#using-special-arrays-to-define-functions) will be evaluated as a function... Angular style | ||
* Any function explicitly named [`private`](#making-anonymous-functions-private) (regardless of the property name) will not be accessible directly | ||
* Any function explicitly named [`$private`](#making-anonymous-functions-private) (regardless of the property name) will not be accessible directly | ||
@@ -506,7 +506,7 @@ That's pretty much it. | ||
#### making anonymous functions private | ||
An even easier way to declare functions as private is simply [naming](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name) them `private`. Any functions named `private` will not be accessible directly, only indirectly through a different function, as an input argument. Specifically the `caller` has to be a defined value and not equal to `__user__`). Here is a quick example: | ||
An even easier way to declare functions as private is simply [naming](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name) them `$private` (or `private`). Any functions named `$private` will not be accessible directly, only indirectly through a different function, as an input argument. Specifically the `caller` has to be a defined value and not equal to `__user__`). Here is a quick example: | ||
```js | ||
var facts = { | ||
a : function private() { return 2; }, | ||
a : function $private() { return 2; }, | ||
b : function(a) { return a+2; } | ||
@@ -513,0 +513,0 @@ }; |
@@ -10,3 +10,3 @@ var clues = require('../clues'), | ||
M1 : function() { return Promise.delay(100,10); }, | ||
M2 : function private() { return Promise.delay(20,300); }, | ||
M2 : function $private() { return Promise.delay(20,300); }, | ||
M3 : ['M1','M2',function private(M1,M2) { return M1+M2; }], | ||
@@ -13,0 +13,0 @@ M4 : function() { return Promise.delay(150,70); }, |
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
79626