@@ -116,6 +116,7 @@ import {
116116} from '../common/cell.ts' ;
117117import {
118118 ifNotUndefined ,
119+ isArray ,
119120 isFunction ,
120121 isTypeStringOrBoolean ,
121122 isUndefined ,
@@ -245,6 +246,8 @@ export const createStore: typeof createStoreDecl = (): Store => {
245246 return true ;
246247 } ;
247248
249+ const validateContent = isArray ;
250+
248251 const validateTables = ( tables : Tables ) : boolean =>
249252 objValidate ( tables , validateTable , cellInvalid ) ;
250253
@@ -411,6 +414,11 @@ export const createStore: typeof createStoreDecl = (): Store => {
411414 const setOrDelTables = ( tables : Tables ) =>
412415 objIsEmpty ( tables ) ? delTables ( ) : setTables ( tables ) ;
413416
417+ const setValidContent = ( [ tables , values ] : Content ) : void => {
418+ ( objIsEmpty ( tables ) ? delTables : setTables ) ( tables ) ;
419+ ( objIsEmpty ( values ) ? delValues : setValues ) ( values ) ;
420+ } ;
421+
414422 const setValidTables = ( tables : Tables ) : TablesMap =>
415423 mapMatch (
416424 tablesMap ,
@@ -1069,11 +1077,10 @@ export const createStore: typeof createStoreDecl = (): Store => {
10691077 const getSchemaJson = ( ) : Json =>
10701078 jsonStringWithMap ( [ tablesSchemaMap , valuesSchemaMap ] ) ;
10711079
1072- const setContent = ( [ tables , values ] : Content ) : Store =>
1073- fluentTransaction ( ( ) => {
1074- ( objIsEmpty ( tables ) ? delTables : setTables ) ( tables ) ;
1075- ( objIsEmpty ( values ) ? delValues : setValues ) ( values ) ;
1076- } ) ;
1080+ const setContent = ( content : Content ) : Store =>
1081+ fluentTransaction ( ( ) =>
1082+ validateContent ( content ) ? setValidContent ( content ) : 0 ,
1083+ ) ;
10771084
10781085 const setTables = ( tables : Tables ) : Store =>
10791086 fluentTransaction ( ( ) =>
0 commit comments