UNPKG

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.

19 lines (18 loc) 460 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mirrored = void 0; /** * Checks if the array is symmetrical/mirrored. * @author @dailker * @template T * @param {T[]} array * @returns {boolean} */ function mirrored(array) { for (let i = 0, j = array.length - 1; i < j; i++, j--) { if (array[i] !== array[j]) return false; } return true; } exports.mirrored = mirrored;