Comparing version 3.0.1 to 3.0.2
21
index.js
@@ -1,3 +0,3 @@ | ||
// Copied from https://github.com/chalk/chalk | ||
const styleMap = { | ||
// Style map codes copied from https://github.com/chalk/chalk | ||
const styleMap = /** @type {const} */ ({ | ||
// style | ||
@@ -48,10 +48,19 @@ reset: [0, 0], | ||
bgWhiteBright: [107, 49] | ||
} | ||
}) | ||
const chalk = Object.keys(styleMap).reduce((index, styleName) => { | ||
index[styleName] = function (content) { | ||
/** | ||
* @callback StyleFunction | ||
* @param {string} content - Text to style | ||
* @returns {string} - Styled text | ||
* | ||
* @typedef {keyof typeof styleMap} StyleName | ||
* @typedef {Record<StyleName, StyleFunction>} Chalk | ||
*/ | ||
const chalk = /** @type {Chalk} */ (Object.keys(styleMap).reduce((index, styleName) => { | ||
index[styleName] = /** @type {StyleFunction} */ function (content) { | ||
return `\u001B[${styleMap[styleName][0]}m${content}\u001B[${styleMap[styleName][1]}m` | ||
} | ||
return index | ||
}, {}) | ||
}, {})) | ||
@@ -58,0 +67,0 @@ export default chalk |
{ | ||
"name": "tiny-chalk", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"type": "module", | ||
"description": "A super tiny version of chalk", | ||
"main": "./index.js", | ||
"scripts": { | ||
"test": "node ./test.js" | ||
}, | ||
"files": [ | ||
@@ -28,6 +31,3 @@ "index.js" | ||
}, | ||
"homepage": "https://github.com/maxlath/tiny-chalk#readme", | ||
"scripts": { | ||
"test": "node ./test.js" | ||
} | ||
} | ||
"homepage": "https://github.com/maxlath/tiny-chalk#readme" | ||
} |
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
4733
103