How to use the fast-json-parse function in fast-json-parse

To help you get started, we’ve selected a few fast-json-parse 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 ArkEcosystem / core / packages / core-utils / src / httpie.ts View on Github external
}

        // Do not retry unless explicitly stated.
        if (!opts.retry) {
            opts.retry = { retries: 0 };
        }

        if (!opts.timeout && process.env.NODE_ENV !== "test") {
            opts.timeout = 1500;
        }

        try {
            const { body, headers, statusCode } = await got[method](url, opts);

            return {
                body: parseJSON(body).value,
                headers,
                status: statusCode,
            };
        } catch (error) {
            throw new HttpieError(error);
        }
    }
}
github ArkEcosystem / core / packages / core-utils / src / httpie.ts View on Github external
Object.defineProperty(this, "message", {
            enumerable: false,
            value: error.message,
        });

        Object.defineProperty(this, "name", {
            enumerable: false,
            value: this.constructor.name,
        });

        if (error.response) {
            Object.defineProperty(this, "response", {
                enumerable: false,
                value: {
                    body: parseJSON(error.response.body).value,
                    headers: error.response.headers,
                    status: error.response.statusCode,
                },
            });
        }

        Error.captureStackTrace(this, this.constructor);
    }
}

fast-json-parse

Parse json safely and at max speed

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular fast-json-parse functions