@expo/json-file
- Version 8.3.3
- Published
- 27.1 kB
- 3 dependencies
- MIT license
Install
npm i @expo/json-file
yarn add @expo/json-file
pnpm add @expo/json-file
Overview
A module for reading, writing, and manipulating JSON files
Index
Functions
Classes
Interfaces
Type Aliases
Functions
function deleteKeyAsync
deleteKeyAsync: <TJSONObject extends JSONObject>( file: string, key: string, options?: Options<TJSONObject>) => Promise<TJSONObject>;
function deleteKeysAsync
deleteKeysAsync: <TJSONObject extends JSONObject>( file: string, keys: string[], options?: Options<TJSONObject>) => Promise<TJSONObject>;
function getAsync
getAsync: < TJSONObject extends JSONObject, K extends keyof TJSONObject, DefaultValue>( file: string, key: K, defaultValue: DefaultValue, options?: Options<TJSONObject>) => Promise<any>;
function mergeAsync
mergeAsync: <TJSONObject extends JSONObject>( file: string, sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>) => Promise<TJSONObject>;
function parseJsonString
parseJsonString: <TJSONObject extends JSONObject>( json: string, options?: Options<TJSONObject>, fileName?: string) => TJSONObject;
function read
read: <TJSONObject extends JSONObject>( file: string, options?: Options<TJSONObject>) => TJSONObject;
function readAsync
readAsync: <TJSONObject extends JSONObject>( file: string, options?: Options<TJSONObject>) => Promise<TJSONObject>;
function rewriteAsync
rewriteAsync: <TJSONObject extends JSONObject>( file: string, options?: Options<TJSONObject>) => Promise<TJSONObject>;
function setAsync
setAsync: <TJSONObject extends JSONObject>( file: string, key: string, value: unknown, options?: Options<TJSONObject>) => Promise<TJSONObject>;
function writeAsync
writeAsync: <TJSONObject extends JSONObject>( file: string, object: TJSONObject, options?: Options<TJSONObject>) => Promise<TJSONObject>;
Classes
class JsonFile
class JsonFile<TJSONObject extends JSONObject> {}
The JsonFile class represents the contents of json file.
It's polymorphic on "JSONObject", which is a simple type representing and object with string keys and either objects or primitive types as values. {[type]}
constructor
constructor(file: string, options?: Options<TJSONObject>);
property deleteKeyAsync
static deleteKeyAsync: <TJSONObject extends JSONObject>( file: string, key: string, options?: Options<TJSONObject>) => Promise<TJSONObject>;
property deleteKeysAsync
static deleteKeysAsync: <TJSONObject extends JSONObject>( file: string, keys: string[], options?: Options<TJSONObject>) => Promise<TJSONObject>;
property file
file: string;
property getAsync
static getAsync: < TJSONObject extends JSONObject, K extends keyof TJSONObject, DefaultValue>( file: string, key: K, defaultValue: DefaultValue, options?: Options<TJSONObject>) => Promise<any>;
property mergeAsync
static mergeAsync: <TJSONObject extends JSONObject>( file: string, sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>) => Promise<TJSONObject>;
property options
options: Options<TJSONObject>;
property parseJsonString
static parseJsonString: <TJSONObject extends JSONObject>( json: string, options?: Options<TJSONObject>, fileName?: string) => TJSONObject;
property read
static read: <TJSONObject extends JSONObject>( file: string, options?: Options<TJSONObject>) => TJSONObject;
property readAsync
static readAsync: <TJSONObject extends JSONObject>( file: string, options?: Options<TJSONObject>) => Promise<TJSONObject>;
property rewriteAsync
static rewriteAsync: <TJSONObject extends JSONObject>( file: string, options?: Options<TJSONObject>) => Promise<TJSONObject>;
property setAsync
static setAsync: <TJSONObject extends JSONObject>( file: string, key: string, value: unknown, options?: Options<TJSONObject>) => Promise<TJSONObject>;
property writeAsync
static writeAsync: <TJSONObject extends JSONObject>( file: string, object: TJSONObject, options?: Options<TJSONObject>) => Promise<TJSONObject>;
method deleteKeyAsync
deleteKeyAsync: ( key: string, options?: Options<TJSONObject>) => Promise<TJSONObject>;
method deleteKeysAsync
deleteKeysAsync: ( keys: string[], options?: Options<TJSONObject>) => Promise<TJSONObject>;
method getAsync
getAsync: <K extends keyof TJSONObject, TDefault extends TJSONObject[K]>( key: K, defaultValue: TDefault, options?: Options<TJSONObject>) => Promise<Defined<TJSONObject[K]> | TDefault>;
method mergeAsync
mergeAsync: ( sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>) => Promise<TJSONObject>;
method parseJsonString
parseJsonString: (json: string, options?: Options<TJSONObject>) => TJSONObject;
method read
read: (options?: Options<TJSONObject>) => TJSONObject;
method readAsync
readAsync: (options?: Options<TJSONObject>) => Promise<TJSONObject>;
method rewriteAsync
rewriteAsync: (options?: Options<TJSONObject>) => Promise<TJSONObject>;
method setAsync
setAsync: ( key: string, value: unknown, options?: Options<TJSONObject>) => Promise<TJSONObject>;
method writeAsync
writeAsync: ( object: TJSONObject, options?: Options<TJSONObject>) => Promise<TJSONObject>;
Interfaces
interface JSONArray
interface JSONArray extends Array<JSONValue> {}
interface JSONObject
interface JSONObject {}
index signature
[key: string]: JSONValue | undefined;
Type Aliases
type JSONValue
type JSONValue = boolean | number | string | null | JSONArray | JSONObject;
Package Files (1)
Dependencies (3)
Dev Dependencies (4)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@expo/json-file
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@expo/json-file)
- HTML<a href="https://www.jsdocs.io/package/@expo/json-file"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2979 ms. - Missing or incorrect documentation? Open an issue for this package.