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: refactor util module #13803

Closed
wants to merge 1 commit into from
Closed

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jun 19, 2017

Refactor util module

  • Use module.exports pattern (but preserve exports = also so monkeypatching still works)
  • Early capture of prototype methods
  • More consistent use of template strings and ...args
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

util

@nodejs-github-bot nodejs-github-bot added the util Issues and PRs related to the built-in util module. label Jun 19, 2017
@jasnell jasnell changed the title Refactor util util: refactor util module Jun 19, 2017
lib/util.js Outdated
const errors = require('internal/errors');

const isError = internalUtil.isError;
const { errname } = process.binding('uv');
const { isBuffer } = require('buffer').Buffer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the .Buffer be removed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, isBuffer is a property of Buffer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow yea. Disregard.

@@ -564,12 +586,12 @@ function formatValue(ctx, value, recurseTimes) {
braces[0] = `${constructor.name} ${braces[0]}`;

if (empty === true) {
return braces[0] + base + braces[1];
return `${braces[0]}${base}${braces[1]}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it improves readability in this specific case, but LGTM either way.

@aqrln
Copy link
Contributor

aqrln commented Jun 21, 2017

* refactor util exports
* early capture of prototype methods
* use template strings and args consistently
@jasnell
Copy link
Member Author

jasnell commented Jul 18, 2017

Rebased... updated.

@jasnell
Copy link
Member Author

jasnell commented Jul 24, 2017

jasnell added a commit that referenced this pull request Jul 24, 2017
* refactor util exports
* early capture of prototype methods
* use template strings and args consistently

PR-URL: #13803
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@jasnell
Copy link
Member Author

jasnell commented Jul 24, 2017

Landed in b1355ba

@jasnell jasnell closed this Jul 24, 2017
@addaleax
Copy link
Member

This doesn’t land cleanly on 8.x; if you can, please follow the guide and raise a backport PR.

@jasnell
Copy link
Member Author

jasnell commented Jul 24, 2017

Unless it ends up causing backport pains for other PRs, this likely isn't a priority to backport.

@addaleax
Copy link
Member

Okay, I’ve switched to dont-land. I’m still a bit worried with Node 8 ending LTS in almost 2 years, and we already have a lot of backporting pain…

@jasnell
Copy link
Member Author

jasnell commented Aug 1, 2017

Actually.. I'm going to do a backport for this, it does interfere with backporting another one. Sigh.

jasnell added a commit to jasnell/node that referenced this pull request Aug 1, 2017
* refactor util exports
* early capture of prototype methods
* use template strings and args consistently

PR-URL: nodejs#13803
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
addaleax pushed a commit that referenced this pull request Aug 2, 2017
* refactor util exports
* early capture of prototype methods
* use template strings and args consistently

Backport-PR-URL: #14585
Backport-Reviewed-By: Anna Henningsen <anna@addaleax.net>

PR-URL: #13803
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@addaleax addaleax mentioned this pull request Aug 2, 2017
@MylesBorins
Copy link
Contributor

@jasnell LTS?

@jasnell
Copy link
Member Author

jasnell commented Aug 16, 2017

Not unless it's blocking anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants