Skip to content

Commit

Permalink
$mol_form_draft, rec
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Sep 28, 2023
1 parent 57ec861 commit 6481fb2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions form/draft/draft.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace $.$$ {

type Primitive = string | number | boolean

type Value = readonly Primitive[] | Primitive
type Value = readonly Primitive[] | Primitive | Record<string, boolean>
type Model = Record<string, (next?: Value | null) => Value>

function norm_string(val: unknown) {
Expand All @@ -27,13 +27,8 @@ namespace $.$$ {
}

@ $mol_mem_key
value_arr_num( field: string, next? : readonly number[] | null ) {
return this.value( field, next )?.map(norm_number) ?? []
}

@ $mol_mem_key
value_arr_bool( field: string, next? : readonly boolean[] | null ) {
return this.value( field, next )?.map(norm_bool) ?? []
value_rec_str( field: string, next? : Record<string, boolean> | null ) {
return this.value( field, next ) ?? {}
}

@ $mol_mem_key
Expand Down

0 comments on commit 6481fb2

Please sign in to comment.