mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
object_to_string.js output to readme
This commit is contained in:
18
README.adoc
18
README.adoc
@@ -19720,6 +19720,24 @@ Examples:
|
||||
** link:rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js[] Question: https://stackoverflow.com/questions/30441025/read-all-text-from-stdin-to-a-string
|
||||
* `class`
|
||||
** link:rootfs_overlay/lkmc/nodejs/object_to_string.js[]: `util.inspect.custom` and `toString` override experiment: https://stackoverflow.com/questions/24902061/is-there-an-repr-equivalent-for-javascript/26698403#26698403
|
||||
+
|
||||
Output:
|
||||
+
|
||||
....
|
||||
util.inspect
|
||||
my type is MyClassUtilInspectCustom and a is 1 and b is 2
|
||||
console.log
|
||||
my type is MyClassUtilInspectCustom and a is 1 and b is 2
|
||||
toString
|
||||
[object Object]
|
||||
|
||||
util.inspect
|
||||
MyClassToString { a: 1, b: 2 }
|
||||
console.log
|
||||
MyClassToString { a: 1, b: 2 }
|
||||
toString
|
||||
my type is MyClassToString and a is 1 and b is 2
|
||||
....
|
||||
|
||||
===== NPM
|
||||
|
||||
|
||||
Reference in New Issue
Block a user