UNPKG

@raona/sp

Version:

Raona utilities to work with Sharepoint using pnp/sp

24 lines (23 loc) 910 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // adapted from https://stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript function compareArray(array1, array2, nested) { if (!array1 || !array2) return false; if (array1.length != array2.length) return false; for (var i = 0, l = array1.length; i < l; i++) { // Check if we have nested arrays if (nested && Array.isArray(array1[i]) && Array.isArray(array2[i])) { // recurse into the nested arrays if (compareArray(array1[i], array2[i], nested)) return false; } else if (array1[i] != array2[i]) { // Warning - two different object instances will never be equal: {x:20} != {x:20} return false; } } return true; } exports.compareArray = compareArray;