widest-line
Advanced tools
Comparing version
11
index.js
'use strict'; | ||
const stringWidth = require('string-width'); | ||
module.exports = input => { | ||
const widestLine = input => { | ||
let max = 0; | ||
for (const s of input.split('\n')) max = Math.max(max, stringWidth(s)); | ||
for (const line of input.split('\n')) { | ||
max = Math.max(max, stringWidth(line)); | ||
} | ||
return max; | ||
}; | ||
module.exports = widestLine; | ||
module.exports.default = widestLine; |
104
package.json
{ | ||
"name": "widest-line", | ||
"version": "2.0.1", | ||
"description": "Get the visual width of the widest line in a string - the number of columns required to display it", | ||
"license": "MIT", | ||
"repository": "sindresorhus/widest-line", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"string", | ||
"str", | ||
"character", | ||
"char", | ||
"unicode", | ||
"width", | ||
"visual", | ||
"column", | ||
"columns", | ||
"fullwidth", | ||
"full-width", | ||
"full", | ||
"ansi", | ||
"escape", | ||
"codes", | ||
"cli", | ||
"command-line", | ||
"terminal", | ||
"console", | ||
"cjk", | ||
"chinese", | ||
"japanese", | ||
"korean", | ||
"fixed-width" | ||
], | ||
"dependencies": { | ||
"string-width": "^2.1.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
"name": "widest-line", | ||
"version": "3.0.0", | ||
"description": "Get the visual width of the widest line in a string - the number of columns required to display it", | ||
"license": "MIT", | ||
"repository": "sindresorhus/widest-line", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"string", | ||
"character", | ||
"unicode", | ||
"width", | ||
"visual", | ||
"column", | ||
"columns", | ||
"fullwidth", | ||
"full-width", | ||
"full", | ||
"ansi", | ||
"escape", | ||
"codes", | ||
"cli", | ||
"command-line", | ||
"terminal", | ||
"console", | ||
"cjk", | ||
"chinese", | ||
"japanese", | ||
"korean", | ||
"fixed-width" | ||
], | ||
"dependencies": { | ||
"string-width": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"tsd-check": "^0.5.0", | ||
"xo": "^0.24.0" | ||
} | ||
} |
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
3475
10%5
25%21
200%0
-100%3
50%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated