Some Safari versions will error with a syntax error if a function has the same name as
one of its parameter.
Found the bug in safari included with iOS 9.3.5.
Fixed for me with this patch.
Make the default (long output format, UTC time) for the bunyan CLI a
fast path that doesn't use moment.js. Admittedly I haven't measured
percentage impact of `moment(rec.time).utc().format(...)` for
many bunyan records.
Also make moment dep *optional*. The bunyan CLI will error out without
the moment dep *only if local time is requested.*
Should fix usage with bundles including bunyan and using strict mode.
Had to fix a surprise effect that 'window === this' is no longer
true in strict mode:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
"""That means, among other things, that in browsers it's no longer
possible to reference the window object through this inside a strict
mode function."""
Fixes#236, #231, and #223.
If an object has a defined property, that is enumerable, and this
property throws an error, it will make JSON stringify throw an
error, and potentially bring down the program.
The solution so far is to try-catch with the usual json stringifyer,
that guards against circular references. If this throws an error
we will attempt to guard against defined properties; and return
[Throws] if a property throws an error when accesed.
The following examples illustrate the problem:
```js
var obj = {};
obj.__defineGetter__('foo', function() { throw new Error('ouch!'); });
JSON.stringify(obj.foo); // error thrown
```
And using `Object.defineProperty`:
```js
var obj = {};
Object.defineProperty(obj, 'foo', {
get: function() { throw new Error('ouch!'); }
enumerable: true // enumerable is false by default
});
JSON.stringify(obj.foo); // error thrown
```
The cases we have seen in production is third party modules that
has enumerable getters that try to access properties on undefined
objects.
Fixes#182.