approximate-now icon indicating copy to clipboard operation
approximate-now copied to clipboard

API access differs from that of Date

Open RA80533 opened this issue 4 years ago • 3 comments

Is it intentional for the package's API access to differ from that of Date? I initially expected the package to work as a drop-in replacement of Date.now() by exporting a function by the name of now() rather than an object with a property by the name of now.

Is this something you'd allow a PR to change? I have a branch with performance increases adding up to a little over 100%. I'd like to create a PR for it but it's based on an API refactor that would close this issue.

RA80533 avatar Feb 22 '21 09:02 RA80533

Yes, it is intentional to avoid an unnecessary function call.

gajus avatar Feb 22 '21 19:02 gajus

Could you elaborate on what you mean by unnecessary? Accessing approximateTime.now right now calls the function bound to its get attribute. There's already a function call.

RA80533 avatar Feb 23 '21 04:02 RA80533

You are not wrong... Yeah, I would accept a PR.

gajus avatar Feb 24 '21 03:02 gajus