ansi-align
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="2.0.0"></a> | ||
# [2.0.0](https://github.com/nexdrew/ansi-align/compare/v1.1.0...v2.0.0) (2017-05-01) | ||
### Features | ||
* ES2015ify, dropping support for Node <4 ([#30](https://github.com/nexdrew/ansi-align/issues/30)) ([7b43f48](https://github.com/nexdrew/ansi-align/commit/7b43f48)) | ||
### BREAKING CHANGES | ||
* Node 0.10 or 0.12 no longer supported, please update to Node 4+ or use ansi-align@1.1.0 | ||
<a name="1.1.0"></a> | ||
@@ -7,0 +22,0 @@ # [1.1.0](https://github.com/nexdrew/ansi-align/compare/v1.0.0...v1.1.0) (2016-06-06) |
20
index.js
'use strict' | ||
var stringWidth = require('string-width') | ||
const stringWidth = require('string-width') | ||
@@ -9,3 +9,3 @@ function ansiAlign (text, opts) { | ||
opts = opts || {} | ||
var align = opts.align || 'center' | ||
const align = opts.align || 'center' | ||
@@ -15,7 +15,7 @@ // short-circuit `align: 'left'` as no-op | ||
var split = opts.split || '\n' | ||
var pad = opts.pad || ' ' | ||
var widthDiffFn = align !== 'right' ? halfDiff : fullDiff | ||
const split = opts.split || '\n' | ||
const pad = opts.pad || ' ' | ||
const widthDiffFn = align !== 'right' ? halfDiff : fullDiff | ||
var returnString = false | ||
let returnString = false | ||
if (!Array.isArray(text)) { | ||
@@ -26,4 +26,4 @@ returnString = true | ||
var width | ||
var maxWidth = 0 | ||
let width | ||
let maxWidth = 0 | ||
text = text.map(function (str) { | ||
@@ -34,4 +34,4 @@ str = String(str) | ||
return { | ||
str: str, | ||
width: width | ||
str, | ||
width | ||
} | ||
@@ -38,0 +38,0 @@ }).map(function (obj) { |
{ | ||
"name": "ansi-align", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "align-text with ANSI support for CLIs", | ||
@@ -33,12 +33,12 @@ "main": "index.js", | ||
"dependencies": { | ||
"string-width": "^1.0.1" | ||
"string-width": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.15.2", | ||
"ava": "^0.19.1", | ||
"chalk": "^1.1.3", | ||
"coveralls": "^2.11.9", | ||
"nyc": "^6.4.4", | ||
"standard": "^7.1.2", | ||
"standard-version": "^2.3.0" | ||
"coveralls": "^2.13.1", | ||
"nyc": "^10.3.0", | ||
"standard": "^10.0.2", | ||
"standard-version": "^4.0.0" | ||
} | ||
} |
6853
+ Addedansi-regex@3.0.1(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedstring-width@2.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstrip-ansi@3.0.1(transitive)
Updatedstring-width@^2.0.0