Skip to content

Commit

Permalink
JSON. Replacer
Browse files Browse the repository at this point in the history
  • Loading branch information
turansky committed Jan 20, 2025
1 parent 48d9193 commit f47e00a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions kotlin-js/src/jsMain/kotlin/js/json/Replacer.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package js.json

/**
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter)
*/
typealias Replacer = (
key: String,
value: Any?,
) -> Any?
4 changes: 2 additions & 2 deletions kotlin-js/src/jsMain/kotlin/js/json/stringify.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import js.array.ReadonlyArray
*/
external fun stringify(
value: Any?,
replacer: (key: String, value: Any?) -> Any? = definedExternally,
replacer: Replacer = definedExternally,
space: String = definedExternally,
): String

external fun stringify(
value: Any?,
replacer: (key: String, value: Any?) -> Any? = definedExternally,
replacer: Replacer = definedExternally,
space: Int = definedExternally,
): String

Expand Down

0 comments on commit f47e00a

Please sign in to comment.