Fix chain option search

If you're reading this commit history, please avert your eyes. 3
commits to fix this admittedly simple problem is more than my pride can handle.
The `gun.Back()` function was only searching for `opt`, not
`opt.file`. It would stop at the first mention of `opt` even if it
didn't have settings for `file`. Now it won't.
This commit is contained in:
Jesse Gibson 2016-11-15 16:20:18 -07:00
parent e7162aa098
commit f999e5f2ea

View File

@ -12,12 +12,12 @@ function isUsingFileJS (context) {
var methodOptions = context.opt || {};
// Options set on the gun chain.
var chainOptions = context.gun.Back('opt') || {};
var chainOption = context.gun.Back('opt.file');
// Favor method options over chain options.
var file = methodOptions.hasOwnProperty('file')
? methodOptions.file
: chainOptions.file;
: chainOption;
// Return whether the module is disabled.
return file !== false;