jsmodern
Version:
An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.
15 lines • 529 B
JavaScript
import { utilDivFloor } from './div-floor.js';
export const divModFloor = {
label: 'divModFloor',
fn: function numberDivModFloor(divisor) {
const ctx = this;
const x = Number(divisor);
if (!x) {
throw new TypeError(`Invalid 'divisor'. The value must be a number that is greater than zero`);
}
const quotient = utilDivFloor(ctx, x);
const remainder = ctx - (x * quotient);
return [quotient, remainder];
},
};
//# sourceMappingURL=div-mod-floor.js.map