Skip to content

Commit 98ff675

Browse files
committed
Drop stringToBoolean
1 parent 3009fa8 commit 98ff675

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

packages/docs/content/codecs.mdx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -561,23 +561,3 @@ const uriComponent = z.codec(z.string(), z.string(), {
561561
uriComponent.decode("Hello%20World%21"); // => "Hello World!"
562562
uriComponent.encode("Hello World!"); // => "Hello%20World!"
563563
```
564-
565-
### `stringToBoolean()`
566-
567-
Converts string representations to boolean values. This is an alias for `z.stringbool()`.
568-
569-
```ts
570-
const stringToBoolean = (options?: { truthy?: string[]; falsy?: string[] }) =>
571-
z.stringbool(options);
572-
573-
const codec = stringToBoolean();
574-
codec.decode("true"); // => true
575-
codec.decode("false"); // => false
576-
codec.encode(true); // => "true"
577-
codec.encode(false); // => "false"
578-
579-
// With custom options
580-
const customCodec = stringToBoolean({ truthy: ["yes", "y"], falsy: ["no", "n"] });
581-
customCodec.decode("yes"); // => true
582-
customCodec.encode(true); // => "yes"
583-
```

0 commit comments

Comments
 (0)