-
Notifications
You must be signed in to change notification settings - Fork 32
request: schema support #48
Copy link
Copy link
Open
Description
By default, giving a schema,
If the incoming new data is the same key, append the new data to the values of the schema keys.
delete keys that are not compatible with the schema.
Example
const schema = {
isPro: false,
darkMode: false,
pages: {
home: false,
settings: false,
},
}
const result = defu(schema, { isPro: 'bbb', d: 'c', pages: { home: true } }, {schema: true})
console.log(result) // {isPro: 'bbb', darkMode: false, pages: { home: true, settings: false } }Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels