@resource-sentry/reader-json
v1.0.0
Published
Resource Sentry JSON Reader.
Downloads
3
Maintainers
Readme
Reader: JSON
Combines all properties from a single or directory of JSON files. The reader can walk through deeply nested objects with some conventional limitations.
- Visits only first element of Array
- Adds parent property to the qualifying name
- Converts
Boolean
to aNumber
(Example: 0 or 1) - Converts
null
to aNULL <String>
- Converts empty
Array
to aNULL <String>
Installation
yarn add --dev @resource-sentry/reader-json
Configuration
entry
, path to a single or a directory of JSON filesdeep
, limit for nesting. Where0
disables walk through nested objects. By default there is no limitation if this optional parameter is not provided.
Example
{
"title": "My Title",
"desc": {
"header": "Big Header"
}
}
JSON will be explored and added into rs.js
file ready for use in production code.
import * as Rs from './rs';
Rs.getResource(Rs.Text.TITLE); // Return "My Title"
Rs.getResource(Rs.Text.DESC_HEADER); // Return "Big Header"