index.js
function mergeHooks( target, source ) {
	const propNames = Object.keys( source );

	for ( let i = 0, numNames = propNames.length; i < numNames; i++ ) {
		const name = propNames[i];
		let hook = source[name];

		if ( typeof hook === "function" ) {
			hook = [hook];
		}

		if ( !Array.isArray( hook ) ) {
			throw new TypeError( `invalid definition of hook named "${name}": must be a function or list of functions` );
		}

		for ( let hi = 0, numHooks = hook.length; hi < numHooks; hi++ ) {
			if ( typeof hook[hi] !== "function" ) {
				throw new TypeError( `invalid definition of hook named "${name}": not a function at index #${hi}` );
			}
		}

		target[name] = hook;
	}
}
function mergeHooks( target, source ) {
	const propNames = Object.keys( source );

	for ( let i = 0, numNames = propNames.length; i < numNames; i++ ) {
		const name = propNames[i];
		let hook = source[name];

		if ( typeof hook === "function" ) {
			hook = [hook];
		}

		if ( !Array.isArray( hook ) ) {
			throw new TypeError( `invalid definition of hook named "${name}": must be a function or list of functions` );
		}

		for ( let hi = 0, numHooks = hook.length; hi < numHooks; hi++ ) {
			if ( typeof hook[hi] !== "function" ) {
				throw new TypeError( `invalid definition of hook named "${name}": not a function at index #${hi}` );
			}
		}

		target[name] = hook;
	}
}
function mergeHooks ( target , source ) { const propNames = Object . keys ( source ) ; for ( let i = 0 , numNames = propNames . length ; i < numNames ; i ++ ) { const name = propNames [ i ] ; let hook = source [ name ] ; if ( typeof hook === "function" ) { hook = [ hook ] ; } if ( ! Array . isArray ( hook ) ) { throw new TypeError ( ` ${ name } ` ) ; } for ( let hi = 0 , numHooks = hook . length ; hi < numHooks ; hi ++ ) { if ( typeof hook [ hi ] !== "function" ) { throw new TypeError ( ` ${ name } ${ hi } ` ) ; } } target [ name ] = hook ; } }
Merges separately defined map of lifecycle hooks into single schema matching
expectations of hitchy-odem.

@param {object} target resulting schema for use with hitchy-odem
@param {object<string,(function|function[])>} source maps names of lifecycle hooks into the related callback or list of callbacks
@returns {void}
Merges separately defined map of lifecycle hooks into single schema matching expectations of hitchy - odem .