@peopleplus/effect-form
Advanced tools
Comparing version
import { Schema } from '@effect/schema'; | ||
export declare const Date: Schema.refine<Date, Schema.Schema<Date, string, never>>; | ||
export type BooleanLiteral = typeof Boolean.Encoded; | ||
export declare const booleanFromLiteral: (value: BooleanLiteral) => value is "true" | "on"; | ||
interface Boolean extends Schema.Schema<boolean, 'true' | 'false' | 'on' | 'off'> { | ||
@@ -4,0 +6,0 @@ } |
import { Schema } from '@effect/schema'; | ||
export const Date = Schema.Date.annotations({ jsonSchema: { format: 'date' } }); | ||
export const booleanFromLiteral = (value) => value === 'true' || value === 'on'; | ||
export const Boolean = Schema.transform(Schema.Literal('true', 'false', 'on', 'off'), Schema.Boolean, { | ||
encode: (value) => (value ? 'true' : 'false'), | ||
decode: (value) => value === 'true' || value === 'on', | ||
decode: booleanFromLiteral, | ||
}).annotations({ identifier: 'Boolean' }); |
{ | ||
"name": "@peopleplus/effect-form", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"types": "./dist/index.d.ts", | ||
@@ -18,7 +18,7 @@ "exports": "./dist/index.js", | ||
"prettier": "^3.3.3", | ||
"publint": "^0.2.10", | ||
"publint": "^0.2.11", | ||
"typescript": "^5.6.2" | ||
}, | ||
"dependencies": { | ||
"@effect/schema": "^0.72.3", | ||
"@effect/schema": "^0.73.0", | ||
"effect": "^3.6.6" | ||
@@ -25,0 +25,0 @@ }, |
16970
1.19%302
1%+ Added
- Removed
Updated