Skip to content

Commit 14c663d

Browse files
committedSep 22, 2016
ES2015ify and require Node.js 4
1 parent 282cf3d commit 14c663d

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed
 

‎.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* text=auto
2+
*.js text eol=lf

‎.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ language: node_js
22
node_js:
33
- '6'
44
- '4'
5-
- '0.12'
6-
- '0.10'

‎index.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
'use strict';
2-
var stripAnsi = require('strip-ansi');
3-
var codePointAt = require('code-point-at');
4-
var isFullwidthCodePoint = require('is-fullwidth-code-point');
2+
const stripAnsi = require('strip-ansi');
3+
const isFullwidthCodePoint = require('is-fullwidth-code-point');
54

6-
// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345
7-
module.exports = function (str) {
5+
module.exports = str => {
86
if (typeof str !== 'string' || str.length === 0) {
97
return 0;
108
}
119

12-
var width = 0;
10+
let width = 0;
1311

1412
str = stripAnsi(str);
1513

16-
for (var i = 0; i < str.length; i++) {
17-
var code = codePointAt(str, i);
14+
for (let i = 0; i < str.length; i++) {
15+
const code = str.codePointAt(i);
1816

1917
// ignore control characters
2018
if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {

‎package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "sindresorhus.com"
1111
},
1212
"engines": {
13-
"node": ">=0.10.0"
13+
"node": ">=4"
1414
},
1515
"scripts": {
1616
"test": "xo && ava"
@@ -45,12 +45,14 @@
4545
"fixed-width"
4646
],
4747
"dependencies": {
48-
"code-point-at": "^1.0.0",
49-
"is-fullwidth-code-point": "^1.0.0",
48+
"is-fullwidth-code-point": "^2.0.0",
5049
"strip-ansi": "^3.0.0"
5150
},
5251
"devDependencies": {
5352
"ava": "*",
5453
"xo": "*"
54+
},
55+
"xo": {
56+
"esnext": true
5557
}
5658
}

0 commit comments

Comments
 (0)
Please sign in to comment.