spec/SpecHelpers.js
function arrySignaturesMatch(array1, array2){
    // setup variables
    var ref, test;

    // we want to use the shorter array if one is longer
    if (array1.length >= array2.length) {
      ref = array2;
      test = array1;
    } else {
      ref = array1;
      test = array2;
    }

    // loop over the shorter array and make sure the corresponding key in the longer array matches
    for(var key in ref) {
      if(typeof ref[key] === typeof test[key]) {

       // if the keys represent an object make sure that it matches
        if(typeof ref[key] === "object" && typeof test[key] === "object") {
          if(!objectSignaturesMatch(ref[key], test[key])){
            return false;
          }
        }

        // if the keys represent an array make sure that it matches
        if(typeof ref[key] === "array" && typeof test[key] === "array") {
          if(!arrySignaturesMatch(ref[key],test[key])){
            return false;
          }
        }

      }
    }
    return true;
  }
function arrySignaturesMatch(array1, array2){
    // setup variables
    var ref, test;

    // we want to use the shorter array if one is longer
    if (array1.length >= array2.length) {
      ref = array2;
      test = array1;
    } else {
      ref = array1;
      test = array2;
    }

    // loop over the shorter array and make sure the corresponding key in the longer array matches
    for(var key in ref) {
      if(typeof ref[key] === typeof test[key]) {

       // if the keys represent an object make sure that it matches
        if(typeof ref[key] === "object" && typeof test[key] === "object") {
          if(!objectSignaturesMatch(ref[key], test[key])){
            return false;
          }
        }

        // if the keys represent an array make sure that it matches
        if(typeof ref[key] === "array" && typeof test[key] === "array") {
          if(!arrySignaturesMatch(ref[key],test[key])){
            return false;
          }
        }

      }
    }
    return true;
  }
function arrySignaturesMatch ( array1 , array2 ) { // setup variables var ref , test ; // we want to use the shorter array if one is longer if ( array1 . length >= array2 . length ) { ref = array2 ; test = array1 ; } else { ref = array1 ; test = array2 ; } // loop over the shorter array and make sure the corresponding key in the longer array matches for ( var key in ref ) { if ( typeof ref [ key ] === typeof test [ key ] ) { // if the keys represent an object make sure that it matches if ( typeof ref [ key ] === "object" && typeof test [ key ] === "object" ) { if ( ! objectSignaturesMatch ( ref [ key ] , test [ key ] ) ) { return false ; } } // if the keys represent an array make sure that it matches if ( typeof ref [ key ] === "array" && typeof test [ key ] === "array" ) { if ( ! arrySignaturesMatch ( ref [ key ] , test [ key ] ) ) { return false ; } } } } return true ; }
do the types of arguments in each array match?
do the types of arguments in each array match?