function wrap( arr, view, idx, ldims, lidx, cdims, clbk, thisArg ) {
	var cidx = zeros( cdims.length ); // workspace for storing core iteration indices
	put( idx, ldims, lidx, MODE );
	return wrapper;

	/**
	* Invokes a callback function.
	*
	* @private
	* @param {*} v - value
	* @param {NonNegativeInteger} aidx - current array element index
	* @returns {*} result
	*/
	function wrapper( v, aidx ) {
		ind2sub( view.shape, view.strides, view.offset, view.order, aidx, MODE, cidx ); // eslint-disable-line max-len
		put( idx, cdims, cidx, MODE );
		return clbk.call( thisArg, v, idx.slice(), arr );
	}
}
Wraps a provided callback function.

@private
@param {ndarray} arr - input ndarray
@param {ndarray} view - reduced view of the input ndarray
@param {NonNegativeIntegerArray} idx - workspace for storing iteration indices
@param {NonNegativeIntegerArray} ldims - loop dimensions
@param {NonNegativeIntegerArray} lidx - current loop iteration indices
@param {NonNegativeIntegerArray} cdims - core dimensions
@param {Function} clbk - callback function
@param {thisArg} thisArg - callback execution context
@returns {Function} callback wrapper