Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: add null prototype support for date #25144

Closed
wants to merge 1 commit into from

Conversation

@antsmartian
Copy link
Contributor

commented Dec 20, 2018

Adds the support of null prototype in Date object.

cc @BridgeAR

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
@BridgeAR
Copy link
Member

left a comment

Since invalid dates will now be handled properly with keys as well, please also add a test for that (as well as subclassing if implemented).

lib/internal/util/inspect.js Outdated Show resolved Hide resolved
test/parallel/test-util-inspect.js Outdated Show resolved Hide resolved
lib/internal/util/inspect.js Outdated Show resolved Hide resolved

@antsmartian antsmartian force-pushed the antsmartian:date_util branch 2 times, most recently from 43c8edf to 435415f Dec 21, 2018

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2018

@mscdex @BridgeAR PTAL...

@antsmartian

This comment has been minimized.

@antsmartian antsmartian force-pushed the antsmartian:date_util branch 2 times, most recently from 2a9c063 to 5f8d3a9 Dec 21, 2018

@BridgeAR
Copy link
Member

left a comment

This is LG to me if the keys.length === 0 check is removed (the original conditional was a mistake in the first place and with the current implementation it produces a weird output).

lib/internal/util/inspect.js Outdated Show resolved Hide resolved

@antsmartian antsmartian force-pushed the antsmartian:date_util branch from 5f8d3a9 to 556713e Dec 21, 2018

@antsmartian antsmartian force-pushed the antsmartian:date_util branch 2 times, most recently from 840315d to 58b2aba Dec 21, 2018

@BridgeAR
Copy link
Member

left a comment

LGTM

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2018

Thanks for guiding me here @BridgeAR. I love utils, may be few more PR's on the way!

I guess we are now left with RE and Errors null proto handling. Will try out working on RE and send out a PR in a few days.

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2018

@jdalton

This comment has been minimized.

Copy link
Member

commented Dec 21, 2018

I've had this bite me for other non-date values. Might be a good time to review other places this can happen.

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Dec 22, 2018

@jdalton Yes. We have already support for other types apart from Error and RE.

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Dec 22, 2018

@Trott Trott added the author ready label Dec 22, 2018

@BridgeAR

This comment has been minimized.

Copy link
Member

commented Dec 27, 2018

@nodejs/util this could use another LG.

@antsmartian this needs a rebase.

@addaleax addaleax removed the author ready label Dec 31, 2018

@antsmartian antsmartian force-pushed the antsmartian:date_util branch from 58b2aba to b0ecc9c Jan 7, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Jan 7, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Jan 8, 2019

@jasnell
jasnell approved these changes Jan 8, 2019

@antsmartian antsmartian force-pushed the antsmartian:date_util branch from b0ecc9c to 7ffa189 Jan 9, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Jan 9, 2019

Fresh CI (after rebase due to conflict): https://ci.nodejs.org/job/node-test-pull-request/20009/

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Jan 9, 2019

@BridgeAR @jasnell Rebased the codebase, do you want to have a look once before I land this? I'm planning to land it soon.

@antsmartian antsmartian force-pushed the antsmartian:date_util branch from 7ffa189 to a5ea84a Jan 9, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Jan 9, 2019

@BridgeAR

This comment has been minimized.

Copy link
Member

commented Jan 10, 2019

Landed in 81b25ea 🎉

@BridgeAR BridgeAR closed this Jan 10, 2019

BridgeAR added a commit to BridgeAR/node that referenced this pull request Jan 10, 2019
util: add null prototype support for date
PR-URL: nodejs#25144
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>

@antsmartian antsmartian deleted the antsmartian:date_util branch Jan 10, 2019

addaleax added a commit that referenced this pull request Jan 14, 2019
util: add null prototype support for date
PR-URL: #25144
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@BridgeAR BridgeAR referenced this pull request Jan 16, 2019
BridgeAR added a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
util: add null prototype support for date
PR-URL: nodejs#25144
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins referenced this pull request Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.