@ms-cloudpack/task-reporter
Advanced tools
Comparing version 0.11.2 to 0.11.3
export type BulletList = (string | undefined | BulletList)[]; | ||
/** | ||
* Writes a bulleted list of lines. | ||
* Newlines within items will be indented to a matching level. | ||
*/ | ||
export declare function bulletedList(lines: BulletList, indent?: number): string; | ||
export declare function bulletedList(lines: BulletList, level?: number): string; | ||
//# sourceMappingURL=bulletedList.d.ts.map |
@@ -13,2 +13,3 @@ export { black, blue, bold, clearLine, cyan, darkGrey, gradient, green, grey, lightBlack, lightBlue, lightCyan, lightGreen, lightGrey, lightMagenta, lightRed, lightWhite, lightYellow, magenta, moveDownLines, moveUpLines, red, white, yellow, } from './ansiHelpers.js'; | ||
export { table } from './table.js'; | ||
export { indent } from './indent.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,3 +5,4 @@ /** | ||
* @param count - The number of items | ||
* @param item - The singular item name | ||
* @param item - The singular item name. Include `$s` to put the 's' in a different spot | ||
* (if `pluralItem` is not provided). | ||
* @param pluralItem - The plural item name (defaults to `${item}s`) | ||
@@ -8,0 +9,0 @@ */ |
export type BulletList = (string | undefined | BulletList)[]; | ||
/** | ||
* Writes a bulleted list of lines. | ||
* Newlines within items will be indented to a matching level. | ||
*/ | ||
export declare function bulletedList(lines: BulletList, indent?: number): string; | ||
export declare function bulletedList(lines: BulletList, level?: number): string; | ||
//# sourceMappingURL=bulletedList.d.ts.map |
@@ -1,11 +0,14 @@ | ||
import { white } from './index.js'; | ||
import { indent } from './indent.js'; | ||
const bulletCharacters = ['•', '▪', '◦', '▫', '-']; | ||
/** | ||
* Writes a bulleted list of lines. | ||
* Newlines within items will be indented to a matching level. | ||
*/ | ||
export function bulletedList(lines, indent = 1) { | ||
export function bulletedList(lines, level = 1) { | ||
if (level < 1) { | ||
throw new RangeError('Level must be 1 or greater'); | ||
} | ||
// The bullet used is relative to the indent level. Indent level 1 should use the first | ||
// bullet character, indent level 2 should use the second, etc. | ||
const bulletCharacter = bulletCharacters[(indent - 1) % bulletCharacters.length]; | ||
const indentString = ' '.repeat(indent * 2); | ||
const bullet = bulletCharacters[(level - 1) % bulletCharacters.length]; | ||
return lines | ||
@@ -15,6 +18,6 @@ .reduce((prev, next) => { | ||
if (Array.isArray(next)) { | ||
prev.push(...bulletedList(next, indent + 1).split('\n')); | ||
prev.push(bulletedList(next, level + 1)); | ||
} | ||
else { | ||
prev.push(`${indentString}${white(bulletCharacter)} ${next}`); | ||
prev.push(indent(`${bullet} ${next}`, level + 1, -1)); | ||
} | ||
@@ -21,0 +24,0 @@ } |
@@ -13,2 +13,3 @@ export { black, blue, bold, clearLine, cyan, darkGrey, gradient, green, grey, lightBlack, lightBlue, lightCyan, lightGreen, lightGrey, lightMagenta, lightRed, lightWhite, lightYellow, magenta, moveDownLines, moveUpLines, red, white, yellow, } from './ansiHelpers.js'; | ||
export { table } from './table.js'; | ||
export { indent } from './indent.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,2 +12,3 @@ export { black, blue, bold, clearLine, cyan, darkGrey, gradient, green, grey, lightBlack, lightBlue, lightCyan, lightGreen, lightGrey, lightMagenta, lightRed, lightWhite, lightYellow, magenta, moveDownLines, moveUpLines, red, white, yellow, } from './ansiHelpers.js'; | ||
export { table } from './table.js'; | ||
export { indent } from './indent.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,4 @@ /** | ||
* @param count - The number of items | ||
* @param item - The singular item name | ||
* @param item - The singular item name. Include `$s` to put the 's' in a different spot | ||
* (if `pluralItem` is not provided). | ||
* @param pluralItem - The plural item name (defaults to `${item}s`) | ||
@@ -8,0 +9,0 @@ */ |
@@ -5,8 +5,15 @@ /** | ||
* @param count - The number of items | ||
* @param item - The singular item name | ||
* @param item - The singular item name. Include `$s` to put the 's' in a different spot | ||
* (if `pluralItem` is not provided). | ||
* @param pluralItem - The plural item name (defaults to `${item}s`) | ||
*/ | ||
export function plural(count, item, pluralItem) { | ||
return count === 1 ? `${count} ${item}` : `${count} ${pluralItem || item + 's'}`; | ||
if (count === 1) { | ||
return `${count} ${item.replace('$s', '')}`; | ||
} | ||
if (!pluralItem) { | ||
pluralItem = item.includes('$s') ? item.replace('$s', 's') : item + 's'; | ||
} | ||
return `${count} ${pluralItem}`; | ||
} | ||
//# sourceMappingURL=plural.js.map |
import { Writer } from './Writer.js'; | ||
import { darkGrey, green, lightRed, red, yellow, white, bold, blue, cyan, magenta, setAnsiDisabled, gradient, } from './ansiHelpers.js'; | ||
import { TaskReporterTask } from './TaskReporterTask.js'; | ||
import {} from './types/TaskReporterTaskStatus.js'; | ||
import { makeValuesUniformLength } from './makeValuesUniformLength.js'; | ||
@@ -6,0 +5,0 @@ import { formatTime } from './formatTime.js'; |
{ | ||
"name": "@ms-cloudpack/task-reporter", | ||
"version": "0.11.2", | ||
"version": "0.11.3", | ||
"description": "Helpers for logging tasks to the console.", | ||
@@ -18,4 +18,4 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@ms-cloudpack/eslint-plugin-internal": "*", | ||
"@ms-cloudpack/scripts": "*" | ||
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1", | ||
"@ms-cloudpack/scripts": "^0.0.1" | ||
}, | ||
@@ -22,0 +22,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
280654
179
2612