$ cnpm install read-json-safe
Read JSON files without try catch.
Returns undefined on errors, for example if the file does not exist.
yarn add read-json-safe
npm install read-json-safe
import { readJSON, readJSONSync, JSONValue } from "read-json-safe";
function readJSON(path: string): Promise<JSONValue | undefined>;
function readJSONSync(path: string): JSONValue | undefined;
type JSONValue = string | number | boolean | JSONObject | JSONArray | null;
import { readJSONObject, readJSONObjectSync, JSONObject } from "read-json-safe";
function readJSONObject(path: string): Promise<JSONObject| undefined>;
function readJSONObjectSync(path: string): JSONObject| undefined;
type JSONObject = {
[key: string]: JSONValue;
}
import { readJSONArray, readJSONArraySync, JSONArray } from "read-json-safe";
function readJSONArray(path: string): Promise<JSONArray | undefined>;
function readJSONArraySync(path: string): JSONArray | undefined;
type JSONArray = Array<JSONValue>;
Copyright 2013 - present © cnpmjs.org | Home |