widest-line
Advanced tools
Comparing version
'use strict'; | ||
var stringWidth = require('string-width'); | ||
const stringWidth = require('string-width'); | ||
module.exports = function (str) { | ||
return Math.max.apply(null, str.split('\n').map(function (x) { | ||
return stringWidth(x); | ||
})); | ||
}; | ||
module.exports = input => Math.max.apply(null, input.split('\n').map(x => stringWidth(x))); | ||
{ | ||
"name": "widest-line", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Get the visual width of the widest line in a string - the number of columns required to display it", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4" | ||
}, | ||
@@ -49,3 +49,3 @@ "scripts": { | ||
"dependencies": { | ||
"string-width": "^1.0.1" | ||
"string-width": "^2.1.1" | ||
}, | ||
@@ -52,0 +52,0 @@ "devDependencies": { |
@@ -13,3 +13,3 @@ # widest-line [](https://travis-ci.org/sindresorhus/widest-line) | ||
``` | ||
$ npm install --save widest-line | ||
$ npm install widest-line | ||
``` | ||
@@ -23,3 +23,3 @@ | ||
widestLine('古\n\u001b[1m@\u001b[22m'); | ||
widestLine('古\n\u001B[1m@\u001B[22m'); | ||
//=> 2 | ||
@@ -36,2 +36,2 @@ ``` | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
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
3121
-1.86%3
-57.14%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated