aboutsummaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-08-21 21:34:03 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-21 21:34:03 -0700
commit3a45f2c71bb17fbad0168fa76b32ae0c8ee67935 (patch)
tree2b02a163ff489349108ad99c211e65ed77209554 /docs/api
parent9eeb7bdbff72997709a9a4c6afb2910830d29842 (diff)
downloadbun-3a45f2c71bb17fbad0168fa76b32ae0c8ee67935.tar.gz
bun-3a45f2c71bb17fbad0168fa76b32ae0c8ee67935.tar.zst
bun-3a45f2c71bb17fbad0168fa76b32ae0c8ee67935.zip
Docs and types for v0.8.0 (#4199)
* Improve test documentation * Update nodejs compat docs with tty * Add debugger guide * Document Bun.inspect.custom, improve bun test nav * Address reviews * Update Bun.file types * Add Nuxt guide * Add tty types
Diffstat (limited to 'docs/api')
-rw-r--r--docs/api/utils.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/api/utils.md b/docs/api/utils.md
index 2723edf7c..8b166e3e8 100644
--- a/docs/api/utils.md
+++ b/docs/api/utils.md
@@ -428,6 +428,21 @@ const str = Bun.inspect(arr);
// => "Uint8Array(3) [ 1, 2, 3 ]"
```
+## `Bun.inspect.custom`
+
+This is the symbol that Bun uses to implement `Bun.inspect`. You can override this to customize how your objects are printed. It is identical to `util.inspect.custom` in Node.js.
+
+```ts
+class Foo {
+ [Bun.inspect.custom]() {
+ return "foo";
+ }
+}
+
+const foo = new Foo();
+console.log(foo); // => "foo"
+```
+
## `Bun.nanoseconds()`
Returns the number of nanoseconds since the current `bun` process started, as a `number`. Useful for high-precision timing and benchmarking.