Skip to content

Latest commit

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

json-parse-default

Parse JSON with default value

Install

$ npm install json-parse-default

Usage

constjsonParse=require('json-prase-default');constjson='{"enable": true}';constjsonObj=jsonParse(json,null,{},null);constjsonObj=jsonParse(json,null,{},(e)=>console.log(e));

API

jsonParse(string, reviver?, default?, onError?)

string

Type: string

reviver

Type: Function

Prescribes how the value originally produced by parsing is transformed, before being returned. See JSON.parse docs for more.

default

Type: object

When there is exception, this value will be return

onError

Type: Function

error callback function


About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages