Boolean
/// <summary> /// Makes a mapping of value from the script type to a host type /// </summary> /// <param name="value">The source value</param> /// <returns>The mapped value</returns> private object MapToHostType(IeJsValue value) { JsValueType valueType = value.ValueType; IeJsValue processedValue; object result; switch (valueType) { case JsValueType.Null: result = null; break; case JsValueType.Undefined: result = Undefined.Value; break; case JsValueType.Boolean: processedValue = value.ConvertToBoolean(); result = processedValue.ToBoolean(); break; case JsValueType.Number: processedValue = value.ConvertToNumber(); result = NumericHelpers.CastDoubleValueToCorrectType(processedValue.ToDouble()); break; case JsValueType.String: processedValue = value.ConvertToString(); result = processedValue.ToString(); break; case JsValueType.Object: case JsValueType.Function: case JsValueType.Error: case JsValueType.Array: #if NETSTANDARD1_3 result = ToObject(value); #else processedValue = value.ConvertToObject(); object obj = processedValue.ToObject(); if (!TypeConverter.IsPrimitiveType(obj.GetType())) { var hostObj = obj as HostObject; result = hostObj != null ? hostObj.Target : obj; } else { result = obj; } #endif break; default: throw new ArgumentOutOfRangeException(); } return(result); }