UNPKG

@quantlab/handsontable

Version:

Spreadsheet-like data grid editor that provides copy/paste functionality compatible with Excel/Google Docs

20 lines (14 loc) 455 B
import {toNumber} from './../../helper/number'; import {ERROR_DIV_ZERO, ERROR_VALUE} from './../../error'; export const SYMBOL = '/'; export default function func(first, ...rest) { const result = rest.reduce((acc, value) => acc / toNumber(value), toNumber(first)); if (result === Infinity) { throw Error(ERROR_DIV_ZERO); } if (isNaN(result)) { throw Error(ERROR_VALUE); } return result; } func.SYMBOL = SYMBOL;