load-object

1.8.5 • Public • Published

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)

/load-object/

    Package Sidebar

    Install

    npm i load-object

    Weekly Downloads

    15

    Version

    1.8.5

    License

    MIT

    Unpacked Size

    15.7 kB

    Total Files

    16

    Last publish

    Collaborators

    • mithray