src/function/relational/compareNatural.js
function compareArrays (x, y) {
    // compare each value
    for (let i = 0, ii = Math.min(x.length, y.length); i < ii; i++) {
      const v = compareNatural(x[i], y[i])
      if (v !== 0) {
        return v
      }
    }

    // compare the size of the arrays
    if (x.length > y.length) { return 1 }
    if (x.length < y.length) { return -1 }

    // both Arrays have equal size and content
    return 0
  }
function compareArrays (x, y) {
    // compare each value
    for (let i = 0, ii = Math.min(x.length, y.length); i < ii; i++) {
      const v = compareNatural(x[i], y[i])
      if (v !== 0) {
        return v
      }
    }

    // compare the size of the arrays
    if (x.length > y.length) { return 1 }
    if (x.length < y.length) { return -1 }

    // both Arrays have equal size and content
    return 0
  }
function compareArrays ( x , y ) { // compare each value for ( let i = 0 , ii = Math . min ( x . length , y . length ) ; i < ii ; i ++ ) { const v = compareNatural ( x [ i ] , y [ i ] ) if ( v !== 0 ) { return v } } // compare the size of the arrays if ( x . length > y . length ) { return 1 } if ( x . length < y . length ) { return - 1 } // both Arrays have equal size and content return 0 }
Compare two Arrays

- First, compares value by value
- Next, if all corresponding values are equal,
look at the length: longest array will be considered largest

@param {Array} x
@param {Array} y
@returns {number} Returns the comparison result: -1, 0, or 1
Compare two Arrays