@igor.dvlpr/jmap
v1.0.0
Published
🕶️ Reads a JSON file into a Map. 🌻
Downloads
2
Maintainers
Readme
jMap
🕶️ Reads a JSON file into a Map. 🌻
🕵🏼 Usage
Install it by executing:
npm i "@igor.dvlpr/jmap"
🤹🏼 API
jMap(path: string): Map<string, any>
Reads a JSON file into a Map.
path: string
- path to the JSON file, required.
Throws an exception if the file cannot be read or there is an error while parsing the JSON file.
Returns Map
with all JSON properties and values.
demo.ts
import { jMap } from '@igor.dvlpr/jmap'
const sample: Map<string, any> = jMap('./test/data/sample.json')
console.log(sample.get('glossary').title) // 'example glossary'
The used sample JSON file is located here, JSON sample.
🪪 License
Licensed under the MIT license which is available here, MIT license.
🧬 Related
🧠 Zep is a zero-dependency, efficient debounce module. ⏰
🧲 Provides ways of properly checking if a path exists inside a given array of files/directories both on Windows and UNIX-like operating systems. 🗺
@igor.dvlpr/adblock-filter-counter
🐲 A dead simple npm module that counts Adblock filter rules.🦘
🧮 Calculates an estimated file size of Mp3 files. 🎶
🔱 Odin is an Object wrapper that allows you to create objects and set their attributes - all at once! 🔺
Provided by Igor Dimitrijević (@igorskyflyer).