lib/util.js
function getWidth(stringWidth, str) {
	if (!stringWidth || !stringWidth.toLowerCase)
		return str.length;
	switch (stringWidth.toLowerCase()) {
		case "wcwidth":
			return wcwidth(str);
		case "dbcs":
			return dbcswidth(str);
		case "length":
			return str.length;
		default:
			return str.length;
	}
}
function getWidth(stringWidth, str) {
	if (!stringWidth || !stringWidth.toLowerCase)
		return str.length;
	switch (stringWidth.toLowerCase()) {
		case "wcwidth":
			return wcwidth(str);
		case "dbcs":
			return dbcswidth(str);
		case "length":
			return str.length;
		default:
			return str.length;
	}
}
function getWidth ( stringWidth , str ) { if ( ! stringWidth || ! stringWidth . toLowerCase ) return str . length ; switch ( stringWidth . toLowerCase ( ) ) { case "wcwidth" : return wcwidth ( str ) ; case "dbcs" : return dbcswidth ( str ) ; case "length" : return str . length ; default : return str . length ; } }
calculate width of string.
@params {string} str - string to calculate
@params {boolean} stringWidth - calculate width by wcwidth or String.length
calculate width of string .