Skip to content

mithray/js-load-object

Repository files navigation

load-object

npm package Coverage Status GitHub last commit Snyk Vulnerabilities for npm package NPM

Libraries.io dependency status for GitHub repo

load-object is a useful node.js utility package for loading data. load-object loads data into a Javascript object from JSON, YAML, TOML, CBOR, Dhall, XML, HTML and Markdown both locally and remotely, thereby removing the need to manually pass the files to different parsers.

Issues:

  • Dhall will probably only work on Linux and if you have dhall-to-json installed as it depends on native bindings. A resolution is planned for this by rewriting in Purescript.

Installation

npm install load-object

Usage

ES Modules

import { load } from "load-object"

Use Locally

// Should have one of these extensions: .json, .yaml, .yml, .dhall, .toml, .md, .cbor
const filePath = "./openapi.json"
const object  = load(filePath)

Use Remotely

// Should have one of these extensions: .json, .yaml, .yml, .dhall, .toml, .md
const url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json"
const object = load(url)

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published