widest-line
Advanced tools
Comparing version
'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; | ||
}; |
{ | ||
"name": "widest-line", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Get the visual width of the widest line in a string - the number of columns required to display it", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3159
1.22%7
133.33%