1
0
mirror of https://github.com/thangisme/notes.git synced 2025-09-24 19:14:39 -04:00

Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

35
node_modules/string-width/index.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
'use strict';
const stripAnsi = require('strip-ansi');
const isFullwidthCodePoint = require('is-fullwidth-code-point');
module.exports = str => {
if (typeof str !== 'string' || str.length === 0) {
return 0;
}
let width = 0;
str = stripAnsi(str);
for (let i = 0; i < str.length; i++) {
const code = str.codePointAt(i);
// ignore control characters
if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {
continue;
}
// surrogates
if (code >= 0x10000) {
i++;
}
if (isFullwidthCodePoint(code)) {
width += 2;
} else {
width++;
}
}
return width;
};