data-fns
Version:
This library provides utility functions for working with array data that are useful in many contexts, including creative coding. It offers generic functions that perform common operations such as offsetting an array, generating an array based on a callbac
25 lines (24 loc) • 664 B
TypeScript
/**
* Returns the remainder of dividing the dividend by the divisor, with support for negative dividends.
* @param dividend The dividend to divide.
* @param divisor The divisor to divide by.
* @returns The remainder of dividing the dividend by the divisor.
* @example
* // Basic usage
* modulo(5, 3)
* // Returns 2
*
* // Support for negative dividends
* modulo(-5, -3)
* // Returns 2
*
* // Support for negative divisors
* modulo(-5, 3)
* // Returns -2
*
* // Support for negative dividends and divisors
* modulo(5, -3)
* // Returns -2
*
*/
export declare const modulo: (dividend: number, divisor: number) => number;