Get unlimited public & private packages + team-based management with npm Teams.Learn more »

disposition

0.5.0 • Public • Published

Disposition

NPM Node Support Travis CI Codecov David

A NodeJS library for loading configuration files written in TypeScript or JavaScript (ES2015+) as ECMAScript or CommonJS modules.

Features

  • Seamless support for configuration files written in either JavaScript or TypeScript.
  • Support for both ECMAScript and CommonJS modules.
  • Support for JSX (currently only supported when using TypeScript).
  • Support for the latest ECMAScript features, regardless of what Node supports (currently only supported when using TypeScript).

This is currently beta quality software, so keep that in mind if you are looking at using this for production software.

Getting Started

First, install Disposition as a dependency.

~> yarn add disposition # or `npm install disposition` 

Then create a basic configuration file:

// example.config.ts
export default {
  foo: 'bar',
};

...and load it:

// index.ts
import Disposition from 'disposition';
 
interface Config {
  foo: string;
}
 
const config: Config = new Disposition('example').load();
console.log(config.foo); // => bar

And that is the basics down!

Changelog

The changelog can be found here.

Prior Art

Cosmiconfig has inspired and influenced this project.

Keywords

none

Install

npm i disposition

DownloadsWeekly Downloads

1

Version

0.5.0

License

MPL-2.0

Last publish

Collaborators

  • avatar