1.0.0 • Published 1 year ago

@igor.dvlpr/jmap v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

@igor.dvlpr/zep

🧠 Zep is a zero-dependency, efficient debounce module. ⏰

@igor.dvlpr/pathexists

🧲 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.🦘

@igor.dvlpr/mp3size

🧮 Calculates an estimated file size of Mp3 files. 🎶

@igor.dvlpr/odin

🔱 Odin is an Object wrapper that allows you to create objects and set their attributes - all at once! 🔺

Provided by Igor Dimitrijević (@igorskyflyer).