9 lines
377 B
JavaScript
9 lines
377 B
JavaScript
|
import u from '@yanick/updeep-remeda';
|
||
|
import * as R from 'remeda';
|
||
|
export function buildInitial(localInitial, subduxes) {
|
||
|
if (Object.keys(subduxes).length > 0 && typeof localInitial !== 'object') {
|
||
|
throw new Error("can't have subduxes when the initial value is not an object");
|
||
|
}
|
||
|
return u(localInitial, R.mapValues(subduxes, R.pathOr(['initial'], {})));
|
||
|
}
|