0.1.4 • Published 6 years ago

tomlrc v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

tomlrc

Search for and load TOML configuration files.

tomlrc is like cosmiconfig, but only searches for TOML files.

Install

npm install tomlrc

Usage

# .unicornrc
envs = ["ava"]
globals = ["graphql"]
extends = "xo"

[rules]
"unicorn/filename-case" = "off"
"import/newline-after-import" = "off"
prefer-const = "error"
const tomlrc = require("tomlrc");

const config = tomlrc("unicorn");
console.log(config);
/*
{
  "rules": {
    "unicorn/filename-case": "off",
    "import/newline-after-import": "off",
    "prefer-const": "error"
  },
  "envs": [
    "ava"
  ],
  "globals": [
    "graphql"
  ],
  "extends": "xo"
}
*/

API

tomlrc(namespace: string, cwd?: string): Object

cwd is the directory to start searching up from.

The following files will be searched for, according to the passed-in namespace:

[
  ".{nameSpace}rc",
  ".{nameSpace}rc.toml",
  "{nameSpace}rc",
  "{nameSpace}rc.toml"
]

If no tomlrc file is found, an empty object {} is returned.

If a namespace is not passed it, an Error will be thrown.

License

MIT © Jorge Gonzalez

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago