MCPcopy Index your code
hub / github.com/bombshell-dev/clack / getPaddingForLine

Function getPaddingForLine

packages/prompts/src/box.ts:80–97  ·  view source on GitHub ↗
(
	lineLength: number,
	innerWidth: number,
	padding: number,
	contentAlign: BoxAlignment | undefined
)

Source from the content-addressed store, hash-verified

78}
79
80function getPaddingForLine(
81 lineLength: number,
82 innerWidth: number,
83 padding: number,
84 contentAlign: BoxAlignment | undefined
85): [number, number] {
86 let leftPadding = padding;
87 let rightPadding = padding;
88 if (contentAlign === 'center') {
89 leftPadding = Math.floor((innerWidth - lineLength) / 2);
90 } else if (contentAlign === 'right') {
91 leftPadding = innerWidth - lineLength - padding;
92 }
93
94 rightPadding = innerWidth - leftPadding - lineLength;
95
96 return [leftPadding, rightPadding];
97}
98
99const defaultFormatBorder = (text: string) => text;
100

Callers 1

boxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected