Comparing version 2.0.14 to 2.0.15
30
index.js
@@ -21,26 +21,26 @@ import * as tty from "tty" | ||
const replaceClose = ( | ||
s, | ||
index, | ||
string, | ||
close, | ||
replace, | ||
index, | ||
head = s.substring(0, index) + replace, | ||
tail = s.substring(index + close.length), | ||
head = string.substring(0, index) + replace, | ||
tail = string.substring(index + close.length), | ||
next = tail.indexOf(close) | ||
) => head + (next >= 0 ? replaceClose(tail, close, replace, next) : tail) | ||
) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace)) | ||
const clearBleed = (s, open, close, replace, index) => | ||
index >= 0 | ||
? open + replaceClose(s, close, replace, index) + close | ||
: open + s + close | ||
const clearBleed = (index, string, open, close, replace) => | ||
index < 0 | ||
? open + string + close | ||
: open + replaceClose(index, string, close, replace) + close | ||
const filterEmpty = | ||
(open, close, replace = open) => | ||
(s) => | ||
s || !(s === "" || s === undefined) | ||
(open, close, replace = open, at = open.length + 1) => | ||
(string) => | ||
string || !(string === "" || string === undefined) | ||
? clearBleed( | ||
s, | ||
("" + string).indexOf(close, at), | ||
string, | ||
open, | ||
close, | ||
replace, | ||
("" + s).indexOf(close, open.length + 1) | ||
replace | ||
) | ||
@@ -47,0 +47,0 @@ : "" |
{ | ||
"name": "colorette", | ||
"version": "2.0.14", | ||
"version": "2.0.15", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "index.cjs", |
@@ -43,3 +43,3 @@ # Colorette | ||
Need to override automatic color detection? You can do that too. | ||
Need to override terminal color detection? You can do that too. | ||
@@ -62,3 +62,3 @@ ```js | ||
### `blue(text)` | ||
### `blue()`, ... | ||
@@ -68,2 +68,4 @@ > See all [supported colors](#supported-colors). | ||
```js | ||
import { blue } from "colorette" | ||
blue("I'm blue") //=> \x1b[34mI'm blue\x1b[39m | ||
@@ -122,3 +124,3 @@ ``` | ||
Preliminary work for Colorette started in 2015 by [**@jorgebucaran**](https://github.com/jorgebucaran) as a lightweight alternative to Chalk and was introduced originally as [Clor](https://github.com/jorgebucaran/colorette/commit/b01b5b9961ceb7df878583a3002e836fae9e37ce). Our terminal color detection logic borrows heavily from [**@sindresorhus**](https://github.com/sindresorhus) and [**@Qix-**](https://github.com/Qix-) work on Chalk. A heartfelt thank you to [**@alexeyraspopov**](https://github.com/alexeyraspopov) for the idea of slicing strings rather than using global regexes to clear bleeding sequences. <3 | ||
Colorette started out in 2015 by [@jorgebucaran](https://github.com/jorgebucaran) as a lightweight alternative to [Chalk](https://github.com/chalk/chalk) and was introduced originally as [Clor](https://github.com/jorgebucaran/colorette/commit/b01b5b9961ceb7df878583a3002e836fae9e37ce). Our terminal color detection logic borrows heavily from [@sindresorhus](https://github.com/sindresorhus) and [@Qix-](https://github.com/Qix-) work on Chalk. The idea of slicing strings to clear bleeding sequences was adapted from a similar technique used by [@alexeyraspopov](https://github.com/alexeyraspopov) in [picocolors](https://github.com/alexeyraspopov/picocolors). Thank you to all our contributors! <3 | ||
@@ -125,0 +127,0 @@ ## License |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16649
126