dist/jquery.fancytree-all-deps.js
function(
				optionName,
				node,
				nodeObject,
				treeOptions,
				defaultValue
			) {
				var ctx,
					res,
					tree = node.tree,
					treeOpt = treeOptions[optionName],
					nodeOpt = nodeObject[optionName];

				if ($.isFunction(treeOpt)) {
					ctx = {
						node: node,
						tree: tree,
						widget: tree.widget,
						options: tree.widget.options,
						typeInfo: tree.types[node.type] || {},
					};
					res = treeOpt.call(tree, { type: optionName }, ctx);
					if (res == null) {
						res = nodeOpt;
					}
				} else {
					res = nodeOpt != null ? nodeOpt : treeOpt;
				}
				if (res == null) {
					res = defaultValue; // no option set at all: return default
				}
				return res;
			}
function(
				optionName,
				node,
				nodeObject,
				treeOptions,
				defaultValue
			) {
				var ctx,
					res,
					tree = node.tree,
					treeOpt = treeOptions[optionName],
					nodeOpt = nodeObject[optionName];

				if ($.isFunction(treeOpt)) {
					ctx = {
						node: node,
						tree: tree,
						widget: tree.widget,
						options: tree.widget.options,
						typeInfo: tree.types[node.type] || {},
					};
					res = treeOpt.call(tree, { type: optionName }, ctx);
					if (res == null) {
						res = nodeOpt;
					}
				} else {
					res = nodeOpt != null ? nodeOpt : treeOpt;
				}
				if (res == null) {
					res = defaultValue; // no option set at all: return default
				}
				return res;
			}
function ( optionName , node , nodeObject , treeOptions , defaultValue ) { var ctx , res , tree = node . tree , treeOpt = treeOptions [ optionName ] , nodeOpt = nodeObject [ optionName ] ; if ( $ . isFunction ( treeOpt ) ) { ctx = { node : node , tree : tree , widget : tree . widget , options : tree . widget . options , typeInfo : tree . types [ node . type ] || { } , } ; res = treeOpt . call ( tree , { type : optionName } , ctx ) ; if ( res == null ) { res = nodeOpt ; } } else { res = nodeOpt != null ? nodeOpt : treeOpt ; } if ( res == null ) { res = defaultValue ; // no option set at all: return default } return res ; }
Return an option value that has a default, but may be overridden by a
callback or a node instance attribute.

Evaluation sequence:<br>

If tree.options.<optionName> is a callback that returns something, use that.<br>
Else if node.<optionName> is defined, use that.<br>
Else if tree.options.<optionName> is a value, use that.<br>
Else use `defaultValue`.

@param {string} optionName name of the option property (on node and tree)
@param {FancytreeNode} node passed to the callback
@param {object} nodeObject where to look for the local option property, e.g. `node` or `node.data`
@param {object} treeOption where to look for the tree option, e.g. `tree.options` or `tree.options.dnd5`
@param {any} [defaultValue]
@returns {any}

@example
// Check for node.foo, tree,options.foo(), and tree.options.foo:
$.ui.fancytree.evalOption("foo", node, node, tree.options);
// Check for node.data.bar, tree,options.qux.bar(), and tree.options.qux.bar:
$.ui.fancytree.evalOption("bar", node, node.data, tree.options.qux);

@since 2.22
Return an option value that has a default but may be overridden by a callback or a node instance attribute .