MCPcopy
hub / github.com/lingodotdev/lingo.dev / countTranslatableChars

Function countTranslatableChars

packages/cli/src/cli/cmd/run/estimate.ts:15–22  ·  view source on GitHub ↗
(
  processableData: Record<string, any>,
)

Source from the content-addressed store, hash-verified

13 * Matches how the server-side estimate counts characters.
14 */
15export function countTranslatableChars(
16 processableData: Record<string, any>,
17): number {
18 return Object.values(processableData).reduce(
19 (sum, value) => (typeof value === "string" ? sum + value.length : sum),
20 0,
21 );
22}
23
24const formatUsd = (value: number) =>
25 value < 0.01 && value > 0 ? "<$0.01" : `$${value.toFixed(2)}`;

Callers 2

estimate.spec.tsFile · 0.90
estimateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected