everyutil
Version:
A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.
18 lines (17 loc) • 432 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isUniform = void 0;
/**
* Checks if all elements are equal.
* @author @dailker
* @template T
* @param {T[]} array
* @returns {boolean}
*/
function isUniform(array) {
if (array.length === 0)
return true;
const first = array[0];
return array.every(item => item === first);
}
exports.isUniform = isUniform;