We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently the add function looks like this: fun add(key: String, value: Json): JsObject = JsObject(hashMapOf(key to value))
fun add(key: String, value: Json): JsObject = JsObject(hashMapOf(key to value))
It's a bit confusing. Is it intentional? Maybe as an of it would be clearer.
of
The text was updated successfully, but these errors were encountered:
I agree, it's not intentional but we've not added any sugar constructors or not many.
We should add:
data class JsObject(...): Json() { companion object { operator fun invoke(vararg: Pair<String, Json>): JsObject = ... } }
Which would allow following syntax: JsObject(key to value)
JsObject(key to value)
Sorry, something went wrong.
IMO expected behavior for add method would be to add new object field to called instance:
add
fun add(key: String, value: Json): JsObject = JsObject(this.value + hashMapOf(key to value))
Yes, that's definitely the expected behavior of add.
Successfully merging a pull request may close this issue.
Currently the add function looks like this:
fun add(key: String, value: Json): JsObject = JsObject(hashMapOf(key to value))
It's a bit confusing. Is it intentional? Maybe as an
of
it would be clearer.The text was updated successfully, but these errors were encountered: