FromInt32() public static method

Creates a Number value from a int value
Requires an active script context.
public static FromInt32 ( int value ) : EdgeJsValue
value int The value to be converted
return EdgeJsValue
        /// <summary>
        /// Makes a mapping of value from the host type to a script type
        /// </summary>
        /// <param name="value">The source value</param>
        /// <returns>The mapped value</returns>
        private EdgeJsValue MapToScriptType(object value)
        {
            if (value == null)
            {
                return(EdgeJsValue.Null);
            }

            if (value is Undefined)
            {
                return(EdgeJsValue.Undefined);
            }

            var typeCode = value.GetType().GetTypeCode();

            switch (typeCode)
            {
            case TypeCode.Boolean:
                return((bool)value ? EdgeJsValue.True : EdgeJsValue.False);

            case TypeCode.SByte:
            case TypeCode.Byte:
            case TypeCode.Int16:
            case TypeCode.UInt16:
            case TypeCode.Int32:
            case TypeCode.UInt32:
            case TypeCode.Int64:
            case TypeCode.UInt64:
                return(EdgeJsValue.FromInt32(Convert.ToInt32(value)));

            case TypeCode.Single:
            case TypeCode.Double:
            case TypeCode.Decimal:
                return(EdgeJsValue.FromDouble(Convert.ToDouble(value)));

            case TypeCode.Char:
            case TypeCode.String:
                return(EdgeJsValue.FromString((string)value));

            default:
#if NETSTANDARD1_3
                return(FromObject(value));
#else
                object processedValue = !TypeConverter.IsPrimitiveType(typeCode) ?
                                        new HostObject(value, _engineMode) : value;
                return(EdgeJsValue.FromObject(processedValue));
#endif
            }
        }