Created
May 2, 2018 12:37
-
-
Save akhilvijayan05/c98d94f40388a9ebe22ea97d68b06df6 to your computer and use it in GitHub Desktop.
uJson package object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object ujson{ | |
def transform[T](t: Transformable, v: Visitor[_, T]) = t.transform(v) | |
def read(s: Transformable): Js.Value = transform(s, Js) | |
def copy(t: Js.Value): Js.Value = transform(t, Js) | |
def write(t: Js.Value, indent: Int = -1): String = { | |
transform(t, StringRenderer(indent)).toString | |
} | |
def writeTo(t: Js.Value, out: java.io.Writer, indent: Int = -1): Unit = { | |
transform(t, Renderer(out, indent)) | |
} | |
def validate(s: Transformable): Unit = transform(s, NoOpVisitor) | |
def reformat(s: Transformable, indent: Int = -1): String = { | |
transform(s, StringRenderer(indent)).toString | |
} | |
def reformatTo(s: Transformable, out: java.io.Writer, indent: Int = -1): Unit = { | |
transform(s, Renderer(out, indent)).toString | |
} | |
// End ujson | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment