This function will be used to make sure an array value exists for the given property
332465
function _ensureArray (model, property) {
  const propertyKey = property.getKey();
  let array = model.data[propertyKey];
  if (!array) {
    model.data[propertyKey] = array = [];
    ArrayType.flagAsArrayType(array);
  }

  return array;
}
1111523
function offsetExists($name)
    {
        $v = $this->getValue();
        return is_array($v) && (isset($v[$name]) || array_key_exists($name, $v));
    }
407173
function(list, property) {
      if (_.isArray(list)) {
        return _.some(list, function(item) { return _.has(item, property); });
      } else {
        return _.has(list, property);
      }
    }
812320
function(items, propertyName) {
        if(!items) return false;

        var hasProperty = true;
        for(var i = 0; i < items.length; i++) {
            if(isNaN(items[i][propertyName]))
                hasProperty = false;
        }
        return hasProperty;
    }
1117279
function arrayHasValue(arr, value) {
        var idx = arr.indexOf(value);
        if (idx !== -1) {
            return true;
        }
        return false;
    }
278277
function _hasOwnProperty(obj) {
    var key;
    for (key in obj) {
        if (obj.hasOwnProperty(key)) {
            return true;
        }
    }

    return false;
}
635117
function arrayContainsItem(array, value, options) {
  if (array && _.indexOf(array, value) >= 0) {
    return options.fn(this);
  }

  return options.inverse(this);
}
547548
function(value) {
            this.$input.prop('checked', false);
            if($.isArray(value) && value.length) {
               this.$input.each(function(i, el) {
                   var $el = $(el);
                   // cannot use $.inArray as it performs strict comparison
                   $.each(value, function(j, val){
                       /*jslint eqeq: true*/
                       if($el.val() == val) {
                       /*jslint eqeq: false*/                           
                           $el.prop('checked', true);
                       }
                   });
               }); 
            }  
        }
160005
function does (value) {
  var arrayIndexOf = (Array.indexOf ? function (arr, obj, from) {
    return arr.indexOf(obj, from)
  } : function (arr, obj, from) {
    var l = arr.length
    var i = from ? parseInt((1 * from) + (from < 0 ? l : 0), 10) : 0
    i = i < 0 ? 0 : i
    for (; i < l; i++) if (i in arr && arr[i] === obj) return i
    return -1
  })

  return {
    startWith: function (string) {
      if (is(value).a(String)) return value.slice(0, string.length) === string
      if (is(value).a(Array)) return value[0] === string
      return false
    },

    endWith: function (string) {
      if (is(value).a(String)) return value.slice(-string.length) === string
      if (is(value).a(Array)) return value[value.length - 1] === string
      return false
    },

    contain: function (field) {
      if (is(value).a(String)) return value.indexOf(field) > -1
      if (is(value).a(Object)) return Object.prototype.hasOwnProperty.call(value, field)
      if (is(value).a(Array)) return !!~arrayIndexOf(value, field)
      return false
    }
  }
}
492221
function (value, array) {
            if (util.isFn(array.indexOf)) {
                return array.indexOf(value);
            } else {
                return $.inArray(value, array);
            }
        }
1207815
function(recentEntryArray, value) {
			var indexOfElement = -1;
			
			recentEntryArray.some(function(entry, index){
				if (entry.value === value) {
					indexOfElement = index;
					return true;
				}
				return false;
			});
			
			return indexOfElement;
		}
343926
function isSafeIntegerArray( value ) {
	var len, i;
	if ( !isArray( value ) ) {
		return false;
	}
	len = value.length;
	if ( !len ) {
		return false;
	}
	for ( i = 0; i < len; i++ ) {
		if ( !isSafeInteger( value[i] ) ) {
			return false;
		}
	}
	return true;
}
817403
function getValue(property, attrVal) {
    if ((attrVal === '' || ((property.attrName || property.name) === attrVal)) && property.accepts(Boolean)) {
        return true;
    }
    if (!property.accepts(String)) {
        try {
            return JSON.parse(attrVal);
        } catch (ex) {
            //
        }
    }
    return attrVal;
}
1114828
private function existenceValidation(Property $property)
    {
        $key = $property->key;

        return [
            $key,
            'exist',
            'targetClass' => $this->getRelatedClass($property),
            'targetAttribute' => 'id',
            'allowArray' => $property->allow_multiple_values,
            'skipOnEmpty' => true,
        ];

    }
730439
private function existenceValidation(Property $property)
    {
        $key = $property->key;

        return [
            $key,
            'exist',
            'targetClass' => StaticValue::className(),
            'targetAttribute' => 'id',
            'allowArray' => $property->allow_multiple_values,
            'filter' => ['property_id' => $property->id],
            'skipOnEmpty' => true,
        ];

    }
1077885
function isArrayArray( value ) {
	var len;
	if ( !isArray( value ) ) {
		return false;
	}
	len = value.length;
	if ( !len ) {
		return false;
	}
	for ( var i = 0; i < len; i++ ) {
		if ( !isArray( value[i] ) ) {
			return false;
		}
	}
	return true;
}
1013092
function unique(array, property) {
  
  if (!isArray(array)) {
    return array;
  }

  //store all unique identifiers
  var uniqueItems = [],
    get = $parse(property);

  return (isUndefined(property)) ?
    //if it's kind of primitive array
    array.filter(function (elm, pos, self) {
      return self.indexOf(elm) === pos;
    }) :
    //else compare with equals
    array.filter(function (elm) {
      var prop = get(elm);
      if(some(uniqueItems, prop)) {
        return false;
      }
      uniqueItems.push(prop);
      return true;
    });

  //checked if the unique identifier is already exist
  function some(array, member) {
    if(isUndefined(member)) {
      return false;
    }
    return array.some(function(el) {
      return equals(el, member);
    });
  }

}