Uname: Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 18.118.212.165
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : isIndexSpecEqual.js
'use strict';

/**
 * Compares two index specifications to determine if they are equal.
 *
 * #### Example:
 *     isIndexSpecEqual({ a: 1, b: 1 }, { a: 1, b: 1 }); // true
 *     isIndexSpecEqual({ a: 1, b: 1 }, { b: 1, a: 1 }); // false
 *     isIndexSpecEqual({ a: 1, b: -1 }, { a: 1, b: 1 }); // false
 *
 * @param {Object} spec1 The first index specification to compare.
 * @param {Object} spec2 The second index specification to compare.
 * @returns {Boolean} Returns true if the index specifications are equal, otherwise returns false.
 */

module.exports = function isIndexSpecEqual(spec1, spec2) {
  const spec1Keys = Object.keys(spec1);
  const spec2Keys = Object.keys(spec2);

  if (spec1Keys.length !== spec2Keys.length) {
    return false;
  }

  for (let i = 0; i < spec1Keys.length; i++) {
    const key = spec1Keys[i];
    if (key !== spec2Keys[i] || spec1[key] !== spec2[key]) {
      return false;
    }
  }

  return true;
};
© 2025 GrazzMean-Shell