0.0.6 • Published 7 months ago

@cfvergara/arrange v0.0.6

Weekly downloads
-
License
CC-BY-NC-SA-2.5
Repository
-
Last release
7 months ago

Arrange

Arrange is a library for loading configuration files.

It can load configs from any number of sources, as long as there is a config parser for that source.

By default, it ships with parsers for JSON and JS files.

Usage

JSON files

Suppose a config.json file like this one:

{
  "API": "https://233.234.235:123/service"
}

To consume it, you would do:

import { arrange } from ("@cfvergara/arrange");

const config = await arrange("./config.json");

console.log( config.API ); // "https://233.234.235:123/service"

JS files

Suppose a config.json file like this one:

module.exports = {
  API: process.env.API_URL || "https://233.234.235:123/service",
};

Or like this one:

export default function configureSomething() {
  API: process.env.API_URL || "https://233.234.235:123/service",
};

To consume it, you would do:

import { arrange } from ("@cfvergara/arrange");

const config = arrange("./config.mjs").then( console.log); // { "API": "https://233.234.235:123/service" }

License

Arrange is licensed under CC-BY-NC-SA(es, en) terms

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.1

7 months ago