function ndarrayfcn( fcn, x, ydtype, yorder ) {
	var shape;
	var buf;
	var y;

	// Check if we were provided a zero-dimensional array...
	shape = copy( x.shape ); // Note: we need to copy the shape to avoid a shared shape object between `x` and `y` which could lead to unintended mutations (e.g., if either `x` or `y` is reshaped)
	if ( shape.length === 0 ) {
		buf = buffer( ydtype, 1 );
		y = ndarray( ydtype, buf, [], [ 0 ], 0, yorder );
	} else {
		buf = buffer( ydtype, x.length || numel( shape ) ); // WARNING: `x.length` is a property found on ndarray instances, but not strictly necessary to describe an ndarray; accordingly, used here to avoid unnecessary computation, but a potential source of bugs if provided an ndarray-like object having a `length` property which is not equal to the product of the dimensions.
		y = ndarray( ydtype, buf, shape, shape2strides( shape, yorder ), 0, yorder ); // eslint-disable-line max-len
	}
	fcn( x, y );
	return y;
}
Applies a function to an ndarray.

@private
@param {Function} fcn - function to apply
@param {ndarray} x - input array
@param {string} ydtype - output array data type
@param {string} yorder - output array order
@returns {ndarray} output array