all files / src/ hooks.js

100% Statements 16/16
83.33% Branches 5/6
100% Functions 4/4
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37    11× 11× 11× 11×   11×   11×   11×       223×             611×             62× 78×      
'use strict';
 
exports.__esModule = true;
exports.optionsHook = optionsHook;
exports.hook = hook;
exports.deepHook = deepHook;
 
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
var _options = require('./options');
 
var _options2 = _interopRequireDefault(_options);
 
/** Invoke a hook on the `options` export. */
 
function optionsHook(name, a) {
	return hook(_options2['default'], name, a);
}
 
/** Invoke a "hook" method with arguments if it exists.
 *	@private
 */
 
function hook(obj, name, a, b, c) {
	if (obj[name]) return obj[name](a, b, c);
}
 
/** Invoke hook() on a component and child components (recursively)
 *	@private
 */
 
function deepHook(obj, type) {
	do {
		hook(obj, type);
	} while (obj = obj._component);
}