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: extract `uncurryThis` function for reuse #23081

Closed
wants to merge 2 commits into from

Conversation

@ZYSzys
Copy link
Member

commented Sep 25, 2018

Extracts uncurryThis function which is done in identical ways in a few places in lib/internal/util dir.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Show resolved Hide resolved lib/internal/util/comparisons.js Outdated
@refack

refack approved these changes Sep 26, 2018

@lundibundi
Copy link
Member

left a comment

LGTM. Though I'm +1 for @Fishrock123 suggestion of moving this to util.js.

@ZYSzys

This comment has been minimized.

Copy link
Member Author

commented Sep 26, 2018

Now I'm torn between keeping it in lib/internal/util/functional.jsor moving to lib/internal/util.js.

Hey guys, which one should I choose ? 😬

@refack

This comment has been minimized.

Copy link
Member

commented Sep 27, 2018

I'm not sure internal/util.js is the best place, it will create something that looks like circular dependency, files in internal/util/ depending on a file in the parent directory. (e.g. internal/util/comparisons.js -> internal/util.js)

I'm very pro deduplicating code, so to me internal/util/types.js seems like the least worst place to put this in... But let's hear from others.

@jdalton

jdalton approved these changes Oct 5, 2018

@ZYSzys ZYSzys force-pushed the zys-contribs:extract-util branch from 56c2099 to 87567fd Oct 6, 2018

@thefourtheye

This comment has been minimized.

Copy link
Contributor

commented Oct 6, 2018

We already use functions from internal/util.js in internal/util/inspect.js. So one more small function wouldn't hurt, I guess.

@refack

This comment has been minimized.

Copy link
Member

commented Oct 6, 2018

We already use functions from internal/util.js in internal/util/inspect.js. So one more small function wouldn't hurt, I guess.

Sounds like a good compromise. Maybe add a TODO comment that we should re-evaluate this dependency in the future?

@lundibundi

This comment has been minimized.

Copy link
Member

commented Oct 8, 2018

It looks like we came to an agreement, @ZYSzys could you move the function to internal/util.js and rebase on master so this could proceed?
Also, a TODO comment proposed by @refack sounds like a good idea.

@ZYSzys ZYSzys force-pushed the zys-contribs:extract-util branch 2 times, most recently from 03a1c48 to f66230b Oct 9, 2018

@ZYSzys

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2018

It was changed now.
But I'm a little confused about the linter error.
screen shot 2018-10-09 at 10 16 38 am

How should I fixed it ?

@lundibundi

This comment has been minimized.

Copy link
Member

commented Oct 9, 2018

@ZYSzys don't worry, that's a known bug, it'll be fixed soon.

CI: https://ci.nodejs.org/job/node-test-pull-request/17701/

@ZYSzys

This comment has been minimized.

Copy link
Member Author

commented Oct 24, 2018

@ZYSzys ZYSzys force-pushed the zys-contribs:extract-util branch from f66230b to a754224 Dec 2, 2018

@ZYSzys

This comment has been minimized.

Copy link
Member Author

commented Dec 20, 2018

ping @Fishrock123

Sorry for bothering you. It has almost been three months, and I've moved the uncurryThis function into lib/internal/util.js for reusable, can you please take a look at this PR again ?

@lundibundi

This comment has been minimized.

@ZYSzys ZYSzys force-pushed the zys-contribs:extract-util branch from a754224 to 415e7f0 Feb 10, 2019

@ZYSzys ZYSzys changed the title lib: extract `uncurryThis` function util: extract `uncurryThis` function for reuse Feb 10, 2019

addressed

@ZYSzys ZYSzys force-pushed the zys-contribs:extract-util branch from 83897c1 to 754f1f3 Feb 11, 2019

@ZYSzys ZYSzys force-pushed the zys-contribs:extract-util branch from 754f1f3 to 7dcf9bd Mar 19, 2019

@ZYSzys

This comment has been minimized.

Copy link
Member Author

commented Mar 19, 2019

@ZYSzys ZYSzys added the author ready label Mar 20, 2019

@BridgeAR

This comment has been minimized.

Copy link
Member

commented Mar 21, 2019

Landed in 20fab5f, 5f032a7 🎉

BridgeAR added a commit to BridgeAR/node that referenced this pull request Mar 21, 2019

util: require `isNativeError` from internalBinding
PR-URL: nodejs#23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

BridgeAR added a commit to BridgeAR/node that referenced this pull request Mar 21, 2019

util: extract uncurryThis function for reuse
PR-URL: nodejs#23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

@BridgeAR BridgeAR closed this Mar 21, 2019

@ZYSzys ZYSzys deleted the zys-contribs:extract-util branch Mar 22, 2019

targos added a commit that referenced this pull request Mar 28, 2019

util: require `isNativeError` from internalBinding
PR-URL: #23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

targos added a commit that referenced this pull request Mar 28, 2019

util: extract uncurryThis function for reuse
PR-URL: #23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

targos added a commit that referenced this pull request Mar 30, 2019

util: require `isNativeError` from internalBinding
PR-URL: #23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

targos added a commit that referenced this pull request Mar 30, 2019

util: extract uncurryThis function for reuse
PR-URL: #23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

targos added a commit that referenced this pull request Mar 30, 2019

util: require `isNativeError` from internalBinding
PR-URL: #23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

targos added a commit that referenced this pull request Mar 30, 2019

util: extract uncurryThis function for reuse
PR-URL: #23081
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

@BethGriggs BethGriggs referenced this pull request Apr 9, 2019

Merged

v11.14.0 proposal #27163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.