Skip to content

Releases: numfin/kirka

v2.9.0 Expose union _tag and _value for debugging

02 May 20:04
Compare
Choose a tag to compare
Schema.union({}).parse(...) // { ...unionmethods, _tag: ..., _value: ... }

v2.7.0 Create schema equal to value

02 May 19:46
Compare
Choose a tag to compare
Schema.str("value") // Schema<"value">
Schema.num(0) // Schema<0>
Schema.bool(true) // Schema<true>

v2.5.0 Much easier to debug and use type system for schemas

02 May 12:40
Compare
Choose a tag to compare

Now every Schema.dict()/.union()/.arr()...etc will have a lot more simpler typings:
Instead of:

FromSchema<Record<string, FromSchema...>> ...

We now have:

SchemaDict<{
    s: string;
    n: number;
    b: boolean;
}, ...>

Enjoy :)

v2.4.0 Refactoring for Schema.arr() and Schema.dict()

01 May 23:23
Compare
Choose a tag to compare

Generics now much simpler, and easier to understand. Just a quality of life change

v2.3.0 Result.match()

29 Apr 21:35
Compare
Choose a tag to compare

Minor tweaks, Schema.union() tests and Result.match()

v2.2.0 Schema validations like in zod

29 Apr 20:32
Compare
Choose a tag to compare

Implemented and tested Schema module for validating external data

Example

const s = Schema.num();
const v: Result<number> = s.parse(...);

// Parse unknown value to union
const innerUnion = Schema.union({
  v3v1: Schema.arr(Schema.num()),
  v3v2: Schema.str()
});
const tUnion = Schema.union({
  v1: Schema.num(),
  v2: Schema.str(),
  v3: innerUnion
});
const parsedValue: UnionInstance<...> = tUnion.parse(...);
// Or create union instance yourself
const v1 = tUnion.v1(10);
const v2 = tUnion.v2("hi");
const v3v1 = tUnion.v3(innerUnion.v3v1([42]));
const v3v2 = tUnion.v3(innerUnion.v3v2("qwerty"));

const v = v1.match({
  v1: (v) => 1, // all returns must have same type
  v2: (v) => 2,
  v3: (v) => 3,
}); // 1
const v = v2.matchSome({
  v2: (v) => 2
}); // Some(2)

const isV3 = v3.is("v3") // true

v1.0.3 moduleResolution: nodeNext

07 Apr 20:37
Compare
Choose a tag to compare

v1.0.0 - Initial release

10 Mar 21:32
Compare
Choose a tag to compare

Iter<T> - lazy iterators
Option<T> - optional values
Result<T, E> - error workflows workarounds