Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the time difference in millisecs between each call while preserving the file and line numbers of the caller.
Should be a start to fixing #17 and #22
The tests won't pass since they test for static values and the profiling adds dynamic time differences. It seems PhantomJS also doesn't have string interpolation in the console.log and we need that to pass Date and coerce to string.
How it works is that Date.prototype.toString() is called when the Date instance coerced into a string. This allows us to return a different scalar value each time console.log interpolates %s for our Date instance by overriding toString() locally on the instance.
Overriding
instance.__proto__
works in Node and the browser. It is supported by all major browsers and IE11+ but not a spec. It will be supported for legacy ES5 in ES6 specs. See: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/protoCurrently can't think of a way to avoid using proto.