MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / compareArrays

Function compareArrays

tests/test_code/js/moment/moment.js:3188–3202  ·  view source on GitHub ↗
(array1, array2, dontConvert)

Source from the content-addressed store, hash-verified

3186
3187 // compare two arrays, return the number of differences
3188 function compareArrays(array1, array2, dontConvert) {
3189 var len = Math.min(array1.length, array2.length),
3190 lengthDiff = Math.abs(array1.length - array2.length),
3191 diffs = 0,
3192 i;
3193 for (i = 0; i < len; i++) {
3194 if (
3195 (dontConvert && array1[i] !== array2[i]) ||
3196 (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
3197 ) {
3198 diffs++;
3199 }
3200 }
3201 return diffs + lengthDiff;
3202 }
3203
3204 // FORMATTING
3205

Callers 1

Calls 1

toIntFunction · 0.85

Tested by

no test coverage detected