Instantiate a primitive.
@param val - The object that represents the primitive.
@returns {*}
187305
function instantiatePrimitive(val) {
  var type = val.type;

  // Support for default values in the JSON Schema.
  if (val.hasOwnProperty('default')) {
    return val.default;
  }

  return typesInstantiator[type];
}
1349609
protected
  Object convertArg(String val, Class type) {
    if(val == null)
      return null;

    String v = val.trim();
    if (String.class.isAssignableFrom(type)) {
      return val;
    } else if (Integer.TYPE.isAssignableFrom(type)) {
      return new Integer(v);
    } else if (Long.TYPE.isAssignableFrom(type)) {
      return new Long(v);
    } else if (Boolean.TYPE.isAssignableFrom(type)) {
      if ("true".equalsIgnoreCase(v)) {
        return Boolean.TRUE;
      } else if ("false".equalsIgnoreCase(v)) {
        return Boolean.FALSE;
      }
    } else if (Priority.class.isAssignableFrom(type)) {
      return OptionConverter.toLevel(v, (Level) Level.DEBUG);
    } else if (ErrorHandler.class.isAssignableFrom(type)) {
      return OptionConverter.instantiateByClassName(v,
	  ErrorHandler.class, null);
    }
    return null;
  }
213728
public <V extends Val> V returning(V val) {
    if (val instanceof ValFrame)
      _ses.addRefCnt(val.getFrame(), 1);
    return val;
  }
782768
function(val) {
        var t = ((val - this._in.min) / this._interval);
        return this.mapFunction.interpolate(0,  this.mapRange, t) + this._out.min;
    }
1220039
function (val) {
		var parseDate = this.options.parseDate,
			ret,
			key,
			format,
			match;

		if (parseDate) {
			ret = parseDate(val);
		}
			
		if (typeof val === 'string') {
			for (key in this.dateFormats) {
				format = this.dateFormats[key];
				match = val.match(format.regex);
				if (match) {
					ret = format.parser(match);
				}
			}
		}
		return ret;
	}
996222
public void addNextValue(Object val) {
    String newVal = val.toString();
    if (this.minVal == null || this.minVal.compareTo(newVal) > 0) {
      this.minVal = newVal;
    }
  }
234397
function(val) {
      return val === undefined ? (this.length ? this[0].innerHTML : null) : this.each(function(index, el) {
        el.innerHTML = val;
      });
    }
562637
function(type, val){
    var res = {type: type, line: this.lineno, col: this.colno};

    if (val !== undefined) res.val = val;

    return res;
  }
1006599
function (val) {
/*Line 387 - 'Atom.js' */        if (!val)
/*Line 388 - 'Atom.js' */            return "";
/*Line 389 - 'Atom.js' */        if (val.constructor == String) {
/*Line 390 - 'Atom.js' */            if (/^\/date\(/gi.test(val)) {
/*Line 391 - 'Atom.js' */                val = val.substr(6);
/*Line 392 - 'Atom.js' */                val = new Date(parseInt(val,10));
/*Line 393 - 'Atom.js' */            } else {
/*Line 394 - 'Atom.js' */                throw new Error("Invalid date format " + val);
/*Line 395 - 'Atom.js' */            }
/*Line 396 - 'Atom.js' */        }
/*Line 397 - 'Atom.js' */        //var dt = new Date();
        
/*Line 399 - 'Atom.js' */        return this.m_names[val.getMonth()] + " " + val.getDate() + ", " + val.getFullYear();
/*Line 400 - 'Atom.js' */    }
641063
function _copy(val) {
    const type = $type(val);

    if (type == 'object') {
        val = _extend({}, val, true);
    } else if (type == 'array') {
        val = val.slice(0);
    }

    return val;
}
911291
static Selector parseFloatingLiteral(String val) {
    // Determine if this is a float constant by checking the suffix
    Number value; // was NumericValue
    char tag = val.charAt(val.length()-1);
    if (tag == 'f' || tag == 'F')
      value = new Float(val);
    else
      value = new Double(val);
    return new LiteralImpl(value);
  }
835716
public static String prepareValue(Object val) {
        StringBuilder result = new StringBuilder();
        
        boolean numberOrBooleanOrNull;
        if (val != null && !(val instanceof Number) && !(val instanceof Boolean)) {
            numberOrBooleanOrNull = false;
            result.append("'");
        } else {
            numberOrBooleanOrNull = true;
        }
        if (val instanceof Boolean) {
            Boolean boolVal = (Boolean) val;
            if (boolVal.equals(Boolean.TRUE)) {
                result.append(1);
            } else {
                result.append(0);
            }
        } else {
            result.append(val);
        }
        if (!numberOrBooleanOrNull) {
            result.append("'");
        }
        return result.toString();
    }
1323113
public static Object toPrimitiveArray(Object val) {
        if (val instanceof Boolean[]) {
            int len = Array.getLength(val);
            boolean[] arr = new boolean[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Boolean)Array.get(val, i);
            }
            return arr;
        } else if (val instanceof Byte[]) {
            int len = Array.getLength(val);
            byte[] arr = new byte[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Byte)Array.get(val, i);
            }
            return arr;
        } else if (val instanceof Character[]) {
            int len = Array.getLength(val);
            char[] arr = new char[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Character)Array.get(val, i);
            }
            return arr;
        } else if (val instanceof Short[]) {
            int len = Array.getLength(val);
            short[] arr = new short[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Short)Array.get(val, i);
            }
            return arr;
        } else if (val instanceof Integer[]) {
            int len = Array.getLength(val);
            int[] arr = new int[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Integer)Array.get(val, i);
            }
            return arr;
        } else if (val instanceof Long[]) {
            int len = Array.getLength(val);
            long[] arr = new long[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Long)Array.get(val, i);
            }
            return arr;
        } else if (val instanceof Float[]) {
            int len = Array.getLength(val);
            float[] arr = new float[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Float)Array.get(val, i);
            }
            return arr;
        } else if (val instanceof Double[]) {
            int len = Array.getLength(val);
            double[] arr = new double[len];
            for (int i = 0; i < len; i++) {
                arr[i] = (Double)Array.get(val, i);
            }
            return arr;
        } else {
            return null;
        }
    }
72165
function castBuffer (val) {
  if (Buffer.isBuffer(val)) {
    return val
  }

  val = toJSON(val)
  var args = assertArgs([val], {
    val: ['string', 'array', 'object', 'number', 'boolean']
  })
  val = args.val

  var str

  if (Array.isArray(val)) {
    val = val.map(toJSON)
    str = JSON.stringify(val)
  } else if (isObject(val)) {
    val = toJSON(val)
    str = JSON.stringify(val)
  } else { // val is a string, number, or boolean
    str = val + ''
  }

  return new Buffer(str)
}
196773
private static Object[] toObjectArray(Object val){
        if (val instanceof Object[])
            return (Object[])val;
        int arrayLength = java.lang.reflect.Array.getLength(val);
        Object[] outputArray = new Object[arrayLength];
        for(int i = 0; i < arrayLength; ++i){
            outputArray[i] = java.lang.reflect.Array.get(val, i);
        }
        return outputArray;
    }
978825
public double toDouble(Object val) {
    if (val == null) {
      return 0;
    }
    else if (val instanceof Double) {
      return ((Double) val).doubleValue();
    }
    else if (val instanceof Number) {
      // The below construct is used rather than ((Number)val).doubleValue() to ensure
      // equality between comparing new Double( 6.4 / 3 ) and the stencil expression of 6.4 / 3
      return Double.parseDouble(String.valueOf(val));
    }
    else if (val instanceof Boolean) {
      return ((Boolean) val).booleanValue() ? 1. : 0.;
    }
    else if (val instanceof String) {
      String string = ((String) val).trim();
      if ("".equals(string)) {
        return Double.NaN;
      }
      else {
        // the spec seems to be iffy about this. Going to give it a wack anyway
        return Double.parseDouble(string);
      }
    }
    else if (val instanceof Character) {
      int i = ((Character) val).charValue();
      return i;
    }

    throw new ArithmeticException("Double coercion: " + val.getClass().getName() + ":(" + val + ")");
  }
893978
public static function create($val)
    {
        if (self::$_prefer) {
            switch (self::$_prefer) {
                case 'gmp':
                    $ret = new BigIntegerGmp();
                    break;
                case 'bcmath':
                    $ret = new BigIntegerBcmath();
                    break;
                default:
                    throw new \UnexpectedValueException('Unknown number implementation: ' . self::$_prefer);
            }
        }
        else {
            // autodetect
            if (extension_loaded('gmp')) {
                $ret = new BigIntegerGmp();
            }
            elseif (extension_loaded('bcmath')) {
                $ret = new BigIntegerBcmath();
            }
            else {
                // TODO: potentially offer pure php implementation?
                throw new \RuntimeException('Requires GMP or bcmath extension.');
            }
        }

        if (is_int($val)) {
            $ret->_fromInteger($val);
        }
        else {
            // convert to string, if not already one
            $val = (string)$val;

            // validate string
            if (!preg_match('/^-?[0-9]+$/', $val)) {
                throw new \InvalidArgumentException('Expects a string representation of an integer.');
            }
            $ret->_fromString($val);
        }

        return $ret;
    }