File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,27 @@ export const params = {
228228 } ,
229229}
230230
231+ const stripUndef = o =>
232+ Object . fromEntries ( Object . entries ( o ) . filter ( ( [ , v ] ) => v !== undefined ) )
233+
234+ /**
235+ * @type {Readable<(params: Object.<string, any>) => void> }
236+ */
237+ export const setParams = derived (
238+ goto ,
239+ $goto => params => $goto ( '$leaf' , stripUndef ( params ) ) ,
240+ )
241+
242+ /**
243+ * @type {Readable<(callback: (params: Object.<string, any>) => Object.<string, any>) => void> }
244+ */
245+ export const updateParams = derived (
246+ [ setParams , params ] ,
247+ ( [ $setParams , $params ] ) =>
248+ callback =>
249+ $setParams ( callback ( { ...$params } ) ) ,
250+ )
251+
231252/**
232253 * @callback IsActive
233254 * @param {String|RNodeRuntime= } pathOrNode
You can’t perform that action at this time.
0 commit comments