MCPcopy Index your code
hub / github.com/Effect-TS/effect / boolean

Function boolean

packages/effect/src/internal/config.ts:154–182  ·  view source on GitHub ↗
(name?: string)

Source from the content-addressed store, hash-verified

152
153/** @internal */
154export const boolean = (name?: string): Config.Config<boolean> => {
155 const config = primitive(
156 "a boolean property",
157 (text) => {
158 switch (text) {
159 case "true":
160 case "yes":
161 case "on":
162 case "1": {
163 return Either.right(true)
164 }
165 case "false":
166 case "no":
167 case "off":
168 case "0": {
169 return Either.right(false)
170 }
171 default: {
172 const error = configError.InvalidData(
173 [],
174 `Expected a boolean value but received ${formatUnknown(text)}`
175 )
176 return Either.left(error)
177 }
178 }
179 }
180 )
181 return name === undefined ? config : nested(config, name)
182}
183
184/** @internal */
185export const url = (name?: string): Config.Config<URL> => {

Callers 2

core-effect.tsFile · 0.70
stm.tsFile · 0.50

Calls 2

primitiveFunction · 0.85
formatUnknownFunction · 0.85

Tested by

no test coverage detected