MCPcopy Create free account
hub / github.com/anomalyco/console / countLeadingSpaces

Function countLeadingSpaces

packages/core/src/util/string.ts:1–13  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

1export function countLeadingSpaces(str: string) {
2 let count = 0;
3 for (let char of str) {
4 if (char === " ") {
5 count++;
6 } else if (char === "\t") {
7 count += 2;
8 } else {
9 break;
10 }
11 }
12 return count;
13}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected