Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/widest-line/index.js')
-rw-r--r--node_modules/widest-line/index.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/node_modules/widest-line/index.js b/node_modules/widest-line/index.js
index 173cec4f2..a9865d00a 100644
--- a/node_modules/widest-line/index.js
+++ b/node_modules/widest-line/index.js
@@ -1,5 +1,8 @@
'use strict';
const stringWidth = require('string-width');
-module.exports = input => Math.max.apply(null, input.split('\n').map(x => stringWidth(x)));
-
+module.exports = input => {
+ let max = 0;
+ for (const s of input.split('\n')) max = Math.max(max, stringWidth(s));
+ return max;
+};