mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
lib: use safe methods from primordials
This changes the primordials to expose built-in prototypes with their methods already uncurried. The uncurryThis function is therefore moved to the primordials. All uses of uncurryThis on built-ins are changed to import the relevant prototypes from primordials. All uses of Function.call.bind are also changed to use primordials. PR-URL: https://github.com/nodejs/node/pull/27096 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
1 parent
969bd1eb7b
commit
112cc7c275
20 files changed
+206
-189
No files matched your search
@@ -1,10 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const { Math } = primordials;
|
||||
const { Math, ObjectPrototype } = primordials;
|
||||
|
||||
const { Buffer } = require('buffer');
|
||||
const { removeColors } = require('internal/util');
|
||||
const HasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
|
||||
|
||||
// The use of Unicode characters below is the only non-comment use of non-ASCII
|
||||
// Unicode characters in Node.js built-in modules. If they are ever removed or
|
||||
@@ -61,7 +60,8 @@ const table = (head, columns) => {
|
||||
for (var j = 0; j < longestColumn; j++) {
|
||||
if (rows[j] === undefined)
|
||||
rows[j] = [];
|
||||
const value = rows[j][i] = HasOwnProperty(column, j) ? column[j] : '';
|
||||
const value = rows[j][i] =
|
||||
ObjectPrototype.hasOwnProperty(column, j) ? column[j] : '';
|
||||
const width = columnWidths[i] || 0;
|
||||
const counted = countSymbols(value);
|
||||
columnWidths[i] = Math.max(width, counted);
|
||||
|
||||
Reference in new issue
Block a user