ndarray-awise-prototype
Version:
Perform axis-wise operations on an ndarary
20 lines (13 loc) • 409 B
JavaScript
module.exports = selectAxes
function selectAxes(dimension, axis, axes) {
if( axes !== undefined && axis !== undefined ) {
throw new Error('ndarray-awise-prototype(): error: only one of axis and axes may be provided as options.')
}
if( axis === undefined && axes === undefined ) {
return [dimension-1]
} else if ( axes === undefined ) {
axes = [axis]
}
return axes
}