mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-18 00:03:38 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
80
node_modules/slice-ansi/index.js
generated
vendored
Executable file
80
node_modules/slice-ansi/index.js
generated
vendored
Executable file
@@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
var ESCAPES = [
|
||||
'\u001b',
|
||||
'\u009b'
|
||||
];
|
||||
|
||||
var END_CODE = 39;
|
||||
|
||||
var ESCAPE_CODES = {
|
||||
0: 0,
|
||||
1: 22,
|
||||
2: 22,
|
||||
3: 23,
|
||||
4: 24,
|
||||
7: 27,
|
||||
8: 28,
|
||||
9: 29,
|
||||
30: 39,
|
||||
31: 39,
|
||||
32: 39,
|
||||
33: 39,
|
||||
34: 39,
|
||||
35: 39,
|
||||
36: 39,
|
||||
37: 39,
|
||||
90: 39,
|
||||
40: 49,
|
||||
41: 49,
|
||||
42: 49,
|
||||
43: 49,
|
||||
44: 49,
|
||||
45: 49,
|
||||
46: 49,
|
||||
47: 49
|
||||
};
|
||||
|
||||
function wrapAnsi(code) {
|
||||
return ESCAPES[0] + '[' + code + 'm';
|
||||
}
|
||||
|
||||
module.exports = function (str, begin, end) {
|
||||
end = end || str.length;
|
||||
var insideEscape = false;
|
||||
var escapeCode;
|
||||
var visible = 0;
|
||||
var output = '';
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var leftEscape = false;
|
||||
var x = str[i];
|
||||
|
||||
if (ESCAPES.indexOf(x) !== -1) {
|
||||
insideEscape = true;
|
||||
var code = /[0-9][^m]*/.exec(str.slice(i, i + 4));
|
||||
escapeCode = code === END_CODE ? null : code;
|
||||
} else if (insideEscape && x === 'm') {
|
||||
insideEscape = false;
|
||||
leftEscape = true;
|
||||
}
|
||||
|
||||
if (!insideEscape && !leftEscape) {
|
||||
++visible;
|
||||
}
|
||||
|
||||
if (visible > begin && visible <= end) {
|
||||
output += x;
|
||||
} else if (visible === begin && escapeCode !== undefined && escapeCode !== END_CODE) {
|
||||
output += wrapAnsi(escapeCode);
|
||||
} else if (visible >= end) {
|
||||
if (escapeCode !== undefined) {
|
||||
output += wrapAnsi(ESCAPE_CODES[escapeCode] || END_CODE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
22
node_modules/slice-ansi/license
generated
vendored
Executable file
22
node_modules/slice-ansi/license
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 DC <threedeecee@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
56
node_modules/slice-ansi/package.json
generated
vendored
Normal file
56
node_modules/slice-ansi/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "slice-ansi",
|
||||
"version": "0.0.4",
|
||||
"description": "Slice a string with ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/slice-ansi",
|
||||
"author": {
|
||||
"name": "David Caccavella",
|
||||
"email": "threedeecee@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
"David Caccavella <threedeecee@gmail.com> (github.com/dthree)",
|
||||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
|
||||
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)",
|
||||
"JD Ballard <i.am.qix@gmail.com> (github.com/qix-)"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js && xo"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"slice",
|
||||
"string",
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"ava": "^0.2.0",
|
||||
"chalk": "^1.1.1",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
56
node_modules/slice-ansi/readme.md
generated
vendored
Executable file
56
node_modules/slice-ansi/readme.md
generated
vendored
Executable file
@@ -0,0 +1,56 @@
|
||||
# slice-ansi
|
||||
|
||||
[](https://travis-ci.org/vorpaljs/slice-ansi)
|
||||
[](https://github.com/sindresorhus/xo)
|
||||
|
||||
> Slice a string with [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save slice-ansi
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var sliceAnsi = require('slice-ansi');
|
||||
|
||||
var input = 'The quick brown ' + chalk.red('fox jumped over ') +
|
||||
'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
|
||||
|
||||
console.log(sliceAnsi(input, 20, 30));
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### sliceAnsi(input, beginSlice[, endSlice])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string`
|
||||
|
||||
String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk).
|
||||
|
||||
#### beginSlice
|
||||
|
||||
Type: `number`
|
||||
|
||||
The zero-based index at which to begin the slice.
|
||||
|
||||
#### endSlice
|
||||
|
||||
Type: `number`
|
||||
|
||||
Optional. The zero-based index at which to end the slice.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [David Caccavella](https://githbu.com/dthree)
|
||||
Reference in New Issue
Block a user