Example #1
0
        /// <summary>
        /// https://tc39.es/ecma262/#sec-tonumeric
        /// </summary>
        public static JsValue ToNumeric(JsValue value)
        {
            if (value.IsNumber() || value.IsBigInt())
            {
                return(value);
            }

            var primValue = ToPrimitive(value, Types.Number);

            if (primValue.IsBigInt())
            {
                return(primValue);
            }

            return(ToNumber(primValue));
        }