_substituteBindings(params, { bindings, parameterSegments }) {
        return Object.entries(params).reduce((result, [key, value]) => {
            // If the value isn't an object, or if the key isn't a named route parameter,
            // there's nothing to substitute so we return it as-is
            if (
                !value ||
                typeof value !== 'object' ||
                Array.isArray(value) ||
                !parameterSegments.some(({ name }) => name === key)
            ) {
                return { ...result, [key]: value };
            }

            if (!value.hasOwnProperty(bindings[key])) {
                if (value.hasOwnProperty('id')) {
                    // As a fallback, we still accept an 'id' key not explicitly registered as a binding
                    bindings[key] = 'id';
                } else {
                    throw new Error(
                        `Ziggy error: object passed as '${key}' parameter is missing route model binding key '${bindings[key]}'.`,
                    );
                }
            }

            return { ...result, [key]: value[bindings[key]] };
        }, {});
    }
Substitute Laravel route model bindings in the given parameters.

@example
_substituteBindings({ post: { id: 4, slug: 'hello-world', title: 'Hello, world!' } }, { bindings: { post: 'slug' } }); // { post: 'hello-world' }

@param {Object} params - Route parameters.
@param {Object} route - Route definition.
@return {Object} Normalized route parameters.