packages/target-decisioning-engine/src/utils.js
/**
 * firstMatch looks through a list of objects (in order) and returns a value from the first object that has a matching key
 * @param key
 * @param {Array<Object>} searchObjects
 * @param defaultValue
 */
firstMatch looks through a list of objects (in order) and returns a value from the first object that has a matching key
@param key
@param {Array} searchObjects
@param defaultValue
firstMatch looks through a list of objects ( in order ) and returns a value from the first object that has a matching key @param key @param { Array } searchObjects @param defaultValue
function firstMatch(key, searchObjects = [], defaultValue = undefined) {
  for (let i = 0; i < searchObjects.length; i += 1) {
    const haystack = searchObjects[i];
    if (isObject(haystack) && isDefined(haystack[key])) {
      return haystack[key];
    }
  }
  return defaultValue;
}
function firstMatch ( key , searchObjects = [ ] , defaultValue = undefined ) { for ( let i = 0 ; i < searchObjects . length ; i += 1 ) { const haystack = searchObjects [ i ] ; if ( isObject ( haystack ) && isDefined ( haystack [ key ] ) ) { return haystack [ key ] ; } } return defaultValue ; }
firstMatch looks through a list of objects (in order) and returns a value from the first object that has a matching key
 @param key
 @param {Array<Object>} searchObjects
 @param defaultValue
firstMatch looks through a list of objects ( in order ) and returns a value from the first object that has a matching key @param key @param { Array<Object > } searchObjects @param defaultValue