spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / agents-md / hooks / switches / is-switched-on.ts
14 lines · 581 BRaw
1/**
2 * The spellings an environment switch is on with, as the engine reads its own.
3 */
4const ON_SPELLINGS: ReadonlySet<string> = new Set(['1', 'true', 'yes', 'on'])
5
6/**
7 * Whether an environment variable's value turns a switch on, read the way the
8 * engine reads its own switches: `1`, `true`, `yes` or `on`, any case, trimmed.
9 *
10 * @param value the variable's value, or undefined when it is unset
11 * @returns whether the switch is on
12 */
13export const isSwitchedOn = (value: string | undefined): boolean =>
14 value !== undefined && ON_SPELLINGS.has(value.trim().toLowerCase())