8 lines
178 B
TypeScript
8 lines
178 B
TypeScript
const CHARS_PER_TOKEN = 4
|
|
|
|
export function estimate(input: string) {
|
|
return Math.max(0, Math.round((input || "").length / CHARS_PER_TOKEN))
|
|
}
|
|
|
|
export * as Token from "./token"
|