Comparing version 3.6.0-rc3 to 3.6.0-rc4
28
clues.js
@@ -10,18 +10,18 @@ (function(self) { | ||
function checkCircular(d,value) { | ||
var checked = [],circular; | ||
function checkDependency(a,b) { | ||
var checked = []; | ||
function check(c) { | ||
if (!c || circular || checked.indexOf(c) !== -1) return; | ||
if (c === d) return circular = true; | ||
if (!c || checked.indexOf(c) !== -1) | ||
return; | ||
checked.push(c); | ||
check(c._promise0); | ||
check(c._receiver0); | ||
check(c._promise); | ||
Object.keys(c).forEach(function(key) { | ||
if (!isNaN(key)) check(c[key]); | ||
}); | ||
if (c === b) | ||
return true; | ||
return check(c._cancellationParent) || | ||
( c._onCancelField && | ||
c._onCancelField._values && | ||
c._onCancelField._values.some(check) | ||
) || | ||
(c._followee && check(c._followee())); | ||
} | ||
check(value); | ||
return circular; | ||
return check(a); | ||
} | ||
@@ -111,3 +111,3 @@ | ||
if (typeof fn !== 'function' || (ref && ref[0] === '$')) { | ||
if (fn && clues.checkCircular && fn.isPending && fn.isPending() && checkCircular(fn,last)) | ||
if (fn && fn._cancellationParent && !clues.ignoreCircular && fn.isPending && fn.isPending() && checkDependency(fn,last)) | ||
return clues.Promise.rejected({ref: ref, message: 'circular', fullref:fullref, caller: caller}); | ||
@@ -114,0 +114,0 @@ |
{ | ||
"name": "clues", | ||
"version": "3.6.0-rc3", | ||
"version": "3.6.0-rc4", | ||
"description": "Lightweight logic tree solver using promises.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
var clues = require('../clues'), | ||
assert = require('assert'); | ||
clues.checkCircular = true; | ||
clues.Promise.config({cancellation:true}); | ||
@@ -6,0 +6,0 @@ var logic = { |
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
93459
1869