mrrama/node-bunyan-prettystream — pull request #12 by dbmikus (2014-12-15 22:45:09+00:00)
Title: Do not log object properties that are functions

Do not log object properties that are functions and try `JSON.stringify` before checking for undefined.

Standard Bunyan pretty-printing (with the CLI tool) does not include properties that are functions in its output. Also, `JSON.stringify` will return undefined if it cannot figure out what to do with its argument, so calling stringify before checking if a value is undefined ensures that we always handle undefined values properly.

As an example (although this is handled by explicitly checking for `typeof function`):

``` javascript
var fn = function () { return 'foo'; };
var value = JSON.stringify(fn, null, 2);
value.indexOf(value); // this throws an exception because value is undefined
```

This reordering of if statements guarantees we don't call `indexOf` on something undefined.