Repository: plotly/dash
File: dash-renderer/src/actions/index.js (JavaScript)

Code before:
    Array.isArray(input) ? pluck('value', input) : input.value;

const zipIfArray = (a, b) => (Array.isArray(a) ? zip(a, b) : [[a, b]]);

function inputsToDict(inputs_list) {
    // Ported directly from _utils.py, inputs_to_dict
    // takes an array of inputs (some inputs may be an array)
    // returns an Object (map):
    //  keys of the form `id.property` or `{"id": 0}.property`
    //  values contain the property value
    if (!inputs_list) {
        return {};
    }
    const inputs = {};
    for (let i = 0; i < inputs_list.length; i++) {
        if (Array.isArray(inputs_list[i])) {
            const inputsi = inputs_list[i];
            for (let ii = 0; ii < inputsi.length; ii++) {
                const id_str = `${JSON.stringify(inputsi[ii].id)}.${
                    inputsi[ii].property
                }`;
                inputs[id_str] = inputsi[ii].value ? inputsi[ii].value : null;
            }
        } else {
            const id_str = `${inputs_list[i].id}.${inputs_list[i].property}`;
            inputs[id_str] = inputs_list[i].value ? inputs_list[i].value : null;
        }
    }
    return inputs;
}

function handleClientside(clientside_function, payload) {
    const dc = (window.dash_clientside = window.dash_clientside || {});
    if (!dc.no_update) {
        Object.defineProperty(dc, 'no_update', {
            value: {description: 'Return to prevent updating an Output.'},
            writable: false,
        });

        Object.defineProperty(dc, 'PreventUpdate', {
            value: {description: 'Throw to prevent updating all Outputs.'},
            writable: false,
        });
    }

    const {inputs, outputs, state} = payload;

    let returnValue;

    try {
        // setup callback context

Review comment (suggestion):
Some falsy values are real, it's just `undefined` we care about - perhaps we should use the [null-coalescing operator](https://github.com/plotly/dash-table/pull/729#discussion_r404411715)
```js
inputs[id_str] = inputs_list[i].value ?? null;
```
Also above.

Code after:
    Array.isArray(input) ? pluck('value', input) : input.value;

const zipIfArray = (a, b) => (Array.isArray(a) ? zip(a, b) : [[a, b]]);

function inputsToDict(inputs_list) {
    // Ported directly from _utils.py, inputs_to_dict
    // takes an array of inputs (some inputs may be an array)
    // returns an Object (map):
    //  keys of the form `id.property` or `{"id": 0}.property`
    //  values contain the property value
    if (!inputs_list) {
        return {};
    }
    const inputs = {};
    for (let i = 0; i < inputs_list.length; i++) {
        if (Array.isArray(inputs_list[i])) {
            const inputsi = inputs_list[i];
            for (let ii = 0; ii < inputsi.length; ii++) {
                const id_str = `${stringifyId(inputsi[ii].id)}.${
                    inputsi[ii].property
                }`;
                inputs[id_str] = inputsi[ii].value ?? null;
            }
        } else {
            const id_str = `${stringifyId(inputs_list[i].id)}.${
                inputs_list[i].property
            }`;
            inputs[id_str] = inputs_list[i].value ?? null;
        }
    }
    return inputs;
}

function handleClientside(clientside_function, payload) {
    const dc = (window.dash_clientside = window.dash_clientside || {});
    if (!dc.no_update) {
        Object.defineProperty(dc, 'no_update', {
            value: {description: 'Return to prevent updating an Output.'},
            writable: false,
        });

        Object.defineProperty(dc, 'PreventUpdate', {
            value: {description: 'Throw to prevent updating all Outputs.'},
            writable: false,
        });
    }

    const {inputs, outputs, state} = payload;

    let returnValue;