diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-04-05 11:11:26 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-04-08 11:23:09 +0200 |
commit | 112cc7c27551254aa2b17098fb774867f05ed0d9 (patch) | |
tree | 0f48ef3ac9e8949f0bf49af38fb6dc7c6e2f64af /lib/internal/cli_table.js | |
parent | 969bd1eb7b56fda3573ad3d41745a491f2b06dde (diff) | |
download | android-node-v8-112cc7c27551254aa2b17098fb774867f05ed0d9.tar.gz android-node-v8-112cc7c27551254aa2b17098fb774867f05ed0d9.tar.bz2 android-node-v8-112cc7c27551254aa2b17098fb774867f05ed0d9.zip |
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>
Diffstat (limited to 'lib/internal/cli_table.js')
-rw-r--r-- | lib/internal/cli_table.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/internal/cli_table.js b/lib/internal/cli_table.js index b2d2779e5f..6e9a6bdbc9 100644 --- a/lib/internal/cli_table.js +++ b/lib/internal/cli_table.js @@ -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); |