How to use the json-ptr.set function in json-ptr

To help you get started, we’ve selected a few json-ptr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sony / nmos-js / Development / src / components / makeConnection.js View on Github external
senderTransportParams.forEach(function(leg, index) {
                            const destination_host = get(
                                leg,
                                'destination_host'
                            );
                            setJSON.set(
                                patchData,
                                `/$staged/transport_params/${index}/source_host`,
                                destination_host,
                                true
                            );
                            const destination_port = get(
                                leg,
                                'destination_port'
                            );
                            setJSON.set(
                                patchData,
                                `/$staged/transport_params/${index}/source_port`,
                                destination_port,
                                true
                            );
                        });
                        break;
github sony / nmos-js / Development / src / components / makeConnection.js View on Github external
senderTransportParams.forEach(function(leg, index) {
                            const destination_host = get(
                                leg,
                                'destination_host'
                            );
                            setJSON.set(
                                patchData,
                                `/$staged/transport_params/${index}/source_host`,
                                destination_host,
                                true
                            );
                            const destination_port = get(
                                leg,
                                'destination_port'
                            );
                            setJSON.set(
                                patchData,
                                `/$staged/transport_params/${index}/source_port`,
                                destination_port,
                                true
                            );
                        });
github sony / nmos-js / Development / src / components / makeConnection.js View on Github external
senderToReceiver.forEach(function(param) {
            const lhs = get(leg, param);
            if (lhs !== undefined) {
                setJSON.set(
                    patchData,
                    `/$staged/transport_params/${index}/${param}`,
                    lhs,
                    true
                );
            }
        });
    });
github sony / nmos-js / Development / src / dataProvider.js View on Github external
rhs: Number(d.rhs),
                        });
                    } else {
                        differences.push(d);
                    }
                }
            }

            let patchData = { transport_params: [] };
            const legs = get(params, 'data.$staged.transport_params').length;
            for (let i = 0; i < legs; i++) {
                patchData.transport_params.push({});
            }

            for (const d of differences) {
                setJSON.set(patchData, `/${d.path.join('/')}`, d.rhs, true);
            }

            if (patchData.hasOwnProperty('transport_file')) {
                if (get(patchData, 'transport_file.data') === null) {
                    set(patchData, 'transport_file.type', null);
                } else {
                    set(patchData, 'transport_file.type', 'application/sdp');
                }
            }

            const options = {
                method: 'PATCH',
                body: JSON.stringify(patchData),
            };
            return {
                url: concatUrl(params.data.$connectionAPI, '/staged'),
github sony / nmos-js / Development / src / components / makeConnection.js View on Github external
senderTransportParams.forEach(function(leg, index) {
                            const destination_ip = get(leg, 'destination_ip');
                            if (isMulticast(destination_ip)) {
                                setJSON.set(
                                    patchData,
                                    `/$staged/transport_params/${index}/multicast_ip`,
                                    destination_ip,
                                    true
                                );
                            } else {
                                setJSON.set(
                                    patchData,
                                    `/$staged/transport_params/${index}/interface_ip`,
                                    destination_ip,
                                    true
                                );
                            }
                        });
                        break;

json-ptr

A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis