MCPcopy Index your code
hub / github.com/plotly/dash / inputsToDict

Function inputsToDict

dash/dash-renderer/src/actions/callbacks.ts:827–854  ·  view source on GitHub ↗
(inputs_list: any)

Source from the content-addressed store, hash-verified

825}
826
827function inputsToDict(inputs_list: any) {
828 // Ported directly from _utils.py, inputs_to_dict
829 // takes an array of inputs (some inputs may be an array)
830 // returns an Object (map):
831 // keys of the form `id.property` or `{"id": 0}.property`
832 // values contain the property value
833 if (!inputs_list) {
834 return {};
835 }
836 const inputs: any = {};
837 for (let i = 0; i < inputs_list.length; i++) {
838 if (Array.isArray(inputs_list[i])) {
839 const inputsi = inputs_list[i];
840 for (let ii = 0; ii < inputsi.length; ii++) {
841 const id_str = `${stringifyId(inputsi[ii].id)}.${
842 inputsi[ii].property
843 }`;
844 inputs[id_str] = inputsi[ii].value ?? null;
845 }
846 } else {
847 const id_str = `${stringifyId(inputs_list[i].id)}.${
848 inputs_list[i].property
849 }`;
850 inputs[id_str] = inputs_list[i].value ?? null;
851 }
852 }
853 return inputs;
854}
855
856function getTriggeredId(triggered: string[]): string | object | undefined {
857 // for regular callbacks, takes the first triggered prop_id, e.g. "btn.n_clicks" and returns "btn"

Callers 1

handleClientsideFunction · 0.85

Calls 1

stringifyIdFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…