forked from sirthias/parboiled2
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
JsNumber should be of BigDecimal when scala-js would support it.
case class JsNumber(value: BigDecimal) extends JsValue
object JsNumber {
def apply(n: Int) = new JsNumber(BigDecimal(n))
def apply(n: Long) = new JsNumber(BigDecimal(n))
def apply(n: Double) = n match {
case n if n.isNaN => JsNull
case n if n.isInfinity => JsNull
case _ => new JsNumber(BigDecimal(n))
}
def apply(n: BigInt) = new JsNumber(BigDecimal(n))
def apply(n: String) = new JsNumber(BigDecimal(n))
def apply(n: Array[Char]) = new JsNumber(BigDecimal(n))
}