Skip to content

Commit fea6bdf

Browse files
committed
Improve toString behavior of DbObjects
1 parent 3ea0c64 commit fea6bdf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/dbObject.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ class BaseDbObject {
123123
throw TypeError("obj is not iterable");
124124
}
125125

126+
[Symbol.toPrimitive](hint) {
127+
switch (hint) {
128+
case 'number':
129+
return NaN;
130+
default:
131+
return '[' + this.fqn + '] ' + util.inspect(this._toPojo(), {});
132+
}
133+
}
134+
126135
toJSON() {
127136
return this._toPojo();
128137
}

0 commit comments

Comments
 (0)