if passed a function, invoke it and pass a clone of the default (for safe mutations)
if passed an array, use as is
otherwise, just return a clone of the default
@param val {*}
@param defaultVal {Array}
@returns {Array}
549133
function getTemplate(val, defaultVal) {
  if(isFunction(val)) {
    return val(cloneDeep(defaultVal));
  }
  else if(isArray(val)) {
    return val;
  }
  else {
    return cloneDeep(defaultVal);
  }
}
70168
function(val) {
      var seed;
      if (_.isArray(val)) {
        seed = [];
      } else if (_.isObject(val)) {
        seed = {};
      } else {
        return val;
      }
      return $.extend(true, seed, val);
    }
145435
function(value) {
      var args = [].slice.call(arguments, 1);
      if (typeof value === 'function') {
        value = value.apply(null, args);
      }
      return value;
    }
271891
function (value) {
        if (value === null || value === undefined || value === defaultEqualityComparer) {
            return defaultEqualityComparer;
        }

        else if (value instanceof EqualityComparer) {
            return value;
        }

        else if (isFunction(value.hash) && isFunction(value.equals)) {
            return new EqualityComparer(value.hash, value.equals);
        }

        return defaultEqualityComparer;
    }
182126
def evaluate_default_value(val)
      if val.respond_to?(:call)
        val.call
      elsif val.duplicable?
        val.dup
      else
        val
      end
    end
352333
private Node defaultValueHook(Node getprop, Node defaultValue) {
    Node undefined = astFactory.createName("undefined", JSTypeNative.VOID_TYPE);
    undefined.makeNonIndexable();
    Node getpropClone = getprop.cloneTree().setJSType(getprop.getJSType());
    return astFactory.createHook(
        astFactory.createSheq(getprop, undefined), defaultValue, getpropClone);
  }
881411
function (val) {
    // Keep track of aliases used
    var aliasesUsed = [],
        aliasesNotFound = [],
        that = this;

    // Map the value through the middlewares
    var middlewares = this.middlewares;
    middlewares.forEach(function mapMiddlewareValue (fn) {
      // Process the value through middleware
      var valObj = fn.call(that, val);

      // Save the results
      val = valObj.value;
      aliasesUsed.push.apply(aliasesUsed, valObj.aliasesUsed);
      aliasesNotFound.push.apply(aliasesNotFound, valObj.aliasesNotFound);
    });

    // Return the value
    return {
      value: val,
      aliasesUsed: aliasesUsed,
      aliasesNotFound: aliasesNotFound
    };
  }
677424
function(value) {
		if (arguments.length > 1) {
			value = slice.call(arguments);
		}
		if (this instanceof regenerate) {
			this.data = [];
			return value ? this.add(value) : this;
		}
		return (new regenerate).add(value);
	}
1360932
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  if (_.isArray(objValue)) { // don't merge arrays
    return srcValue;
  } else if (_.isObject(objValue) && objValue._mergeStrategy == 'replace') {
    if (_.isObject(srcValue)) {
      Object.defineProperty(srcValue, '_mergeStrategy', {
        value: 'replace', configurable: true
      });
    }
    return srcValue;
  }
  else if (_.isObject(srcValue) && srcValue._mergeStrategy == 'replace') {
    return srcValue;
  }
  return undefined;
}
368518
function clone(value, deep) {
    if (Array.isArray(value)) {
      if (deep) {
        return value.map(function(value) {
          return clone(value, deep);
        });
      } else {
        return value.slice();
      }
    } else if (value && typeof value === 'object') {
      if (value.valueOf() !== value) {
        return new value.constructor(value.valueOf());
      } else {
        var copy = {};
        for (var key in value) {
          var objValue = value[key];
          if (deep) {
            objValue = clone(objValue, deep);
          }
          copy[key] = objValue;
        }
        return copy;
      }
    } else {
      return value;
    }
  }
151177
public R visitArray(List<? extends AnnotationValue> vals, P p) {
        return defaultAction(vals, p);
    }
805251
function resolveValueOrNodeSkel(index, val, valDefault) {
    switch (typeof(val)) {
      case "string":
        return resolveNodeSkel(index, val);
      case "undefined":
        if (valDefault === undefined) {
          throw "Unable to get value'" + val + "'";
        }
        return () => valDefault;
      default:
        return () => val;
    }
  }
1108133
function() {

            var that = this;
            var propertiesParams = that.__getPropertiesParam();

            _.each(propertiesParams, function(params, property) {

                var value = that.__getPropertyValue(property);

                if (_.isUndefined(value) && 'default' in params) {

                    var defaultValue = params.default;

                    if (_.isFunction(defaultValue)) {
                        defaultValue = defaultValue.call(that);
                    }

                    if (defaultValue) {
                        if ((_.isSimpleObject(defaultValue)) || _.isArray(defaultValue)) {
                            defaultValue = _.clone(defaultValue)
                        }
                    }

                    that.__setPropertyValue(property, defaultValue, false);
                }
            });
        }
719254
protected void generateDefaultParameters(UseDefaultValues defValues){
      int count = defValues.optParamIndex().length;
      NativeType[] nt = defValues.nativeType();
      Variant.Type[] vt = defValues.variantType();
      String[] literal = defValues.literal();
      for (int i = 0; i < count; i++) {
        switch(nt[i]){
          case Bool:
          case VariantBool:
          case VariantBool_ByRef:
            defaultParameters[i] = Boolean.parseBoolean(literal[i]);
            break;
          case BSTR:
          case BSTR_ByRef:
          case CSTR:
          case Unicode:
            defaultParameters[i] = literal[i];
            break;
          case Double:
          case Double_ByRef:
            defaultParameters[i] = Double.parseDouble(literal[i]);
            break;
          case Float:
          case Float_ByRef:
            defaultParameters[i] = Float.parseFloat(literal[i]);
            break;
          case Int8:
          case Int8_ByRef:
            defaultParameters[i] = Byte.parseByte(literal[i]);
            break;
          case Int16:
          case Int16_ByRef:
            defaultParameters[i] = Short.parseShort(literal[i]);
            break;
          case Int32:
          case Int32_ByRef:
            defaultParameters[i] = Integer.parseInt(literal[i]);
            break;
          case Int64:
          case Int64_ByRef:
            defaultParameters[i] = Long.parseLong(literal[i]);
            break;
          case GUID:
            defaultParameters[i] = new GUID(literal[i]);
            break;
          case Currency:
          case Currency_ByRef:
            defaultParameters[i] = new BigDecimal(literal[i]);
            break;
          case VARIANT:
            Variant v = new Variant();
            switch(vt[i]){
              case VT_I1:
              case VT_UI1:
                v.set(Byte.parseByte(literal[i]));
                break;
              case VT_I2:
              case VT_UI2:
                v.set(Short.parseShort(literal[i]));
                break;
              case VT_I4:
              case VT_UI4:
              case VT_INT:
              case VT_UINT:
                v.set(Integer.parseInt(literal[i]));
                break;
              case VT_I8:
                v.set(Long.parseLong(literal[i]));
                break;
              case VT_R4:
                v.set(Float.parseFloat(literal[i]));
                break;
              case VT_R8:
                v.set(Double.parseDouble(literal[i]));
                break;
              case VT_BOOL:
                v.set(Boolean.parseBoolean(literal[i]));
                break;
              case VT_BSTR:
                v.set(literal[i]);
                break;
              case VT_EMPTY:
                v= new Variant();
                break;
              case VT_ERROR:
                v.makeError((int)Long.parseLong(literal[i], 16));
                break;
//              case VT_CY: ...
              default:
                throw new UnsupportedOperationException("Don't know how to parse literal " + literal[i] + " to an Java Object corresponding to Variant.Type." + vt[i].name());
            }
            v.setType(vt[i]);
            defaultParameters[i] = v;
            break;
          default:
            throw new UnsupportedOperationException("Don't know how to parse literal " + literal[i] + " to an Java Object corresponding to NativeType." + nt[i].name());
        }
      }
    }
946812
function clone(vValue) {
			return vValue === undefined || vValue === Infinity || vValue === -Infinity
				|| /*NaN?*/vValue !== vValue // eslint-disable-line no-self-compare
				? vValue
				: JSON.parse(JSON.stringify(vValue));
		}
1230620
function toArray(val){
        var ret = [],
            kind = kindOf(val),
            n;

        if (val != null) {
            if ( val.length == null || kind === 'String' || kind === 'Function' || kind === 'RegExp' || val === _win ) {
                //string, regexp, function have .length but user probably just want
                //to wrap value into an array..
                ret[ret.length] = val;
            } else {
                //window returns true on isObject in IE7 and may have length
                //property. `typeof NodeList` returns `function` on Safari so
                //we can't use it (#58)
                n = val.length;
                while (n--) {
                    ret[n] = val[n];
                }
            }
        }
        return ret;
    }
1300306
function (key, defaultValue) {
            var input = self.session.get('_old_input', []);

            // Input that is flashed to the session can be easily retrieved by the
            // developer, making repopulating old forms and the like much more
            // convenient, since the request's previous input is available.
            if (key) {
                return isset(input[key]) ? input[key] : defaultValue;
            } else {
                return input;
            }
        }