Skip to content

Commit 83aaccf

Browse files
committed
feat: replace console.log with better support for nested / circular objects
1 parent e40d3bd commit 83aaccf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"dependencies": {
4545
"he": "^1.1.1",
4646
"lint-staged": "^4.3.0",
47+
"util-inspect": "^0.1.8",
4748
"vue": "^2.5.8"
4849
},
4950
"peerDependencies": {

platform/nativescript/framework.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
import inspect from 'util-inspect'
2+
3+
console.log = (function(log, inspect) {
4+
return function() {
5+
return log.apply(
6+
this,
7+
Array.prototype.map.call(arguments, function(arg) {
8+
return inspect(arg, { depth: 1, colors: true })
9+
})
10+
)
11+
}
12+
})(console.log, inspect)
13+
114
console.keys = function(object) {
2-
console.dir(Object.keys(object))
15+
console.log(Object.keys(object))
316
}
417

518
// This is required because some of the third party plugins rely on this

0 commit comments

Comments
 (0)