Package Exports
- read-file-json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (read-file-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
read-file-json
Reads JSON and JSON5 from a file. Returns null if file does not exist (or is a directory) instead of throwing an Error.
Installation
npm install --save read-file-json@^1.1.0yarn add read-file-json@^1.1.0
(if configured properly)
npm install --save @jaid/read-file-json@^1.1.0Example
import readFileJson from "read-file-json"
readFileJson("./exists.json5").then(result => {
})
readFileJson("./doesNotExist.json5").then(result2 => {
})Variable result will be:
["a", "b", "c"]Variable result2 will be:
nullDevelopment
Setting up:
git clone git@github.com:jaid/read-file-json.git
cd read-file-json
npm installTesting:
npm run test:devTesting in production environment:
npm run testLicense
MIT License
Copyright © 2021, Jaid <jaid.jsx@gmail.com> (https://github.com/jaid)