智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/09/098477cf12e01bfa7c538be97b0...

21 lines
413 B

var stripAnsi = require('./stripAnsi');
var isFullWidth = require('./isFullWidth');
exports = function(str) {
str = stripAnsi(str);
var width = 0;
for (var i = 0, len = str.length; i < len; i++) {
var c = str.codePointAt(i);
if (c <= 31 || c === 127) {
continue;
}
width += isFullWidth(c) ? 2 : 1;
}
return width;
};
module.exports = exports;