jtomler
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Jtomler

Reading json or toml files.

Example

const jtomler = require('jtomler');

const file_body = `message: "hello yml"
array:
    - "array_key1"
    - "array_key1"
    - "\\\${YML_KEY_TEST}"
object: 
    val1: "val1-key"
    val2: "val2-key"
    test: "\${YML_KEY_TEST}"`

const yml_config = jtomler.parse(file_body);
const json_config = jtomler.parseFileSync('config.json');
const toml_config = await jtomler.parseFile('config.toml');

jtomler.parse(content: string, env_flag: boolean = true) → Object

Parsing object from string.

params:

  • content - Content for parsing
  • env_flag - Flag for parsing environment keys.

jtomler.parseFileSync(file_path: string, env_flag: boolean = true) → Object

Parsing object from file.

params:

  • file_path - Path to file.
  • env_flag - Flag for parsing environment keys.

jtomler.parseFile(file_path: string, env_flag: boolean = true) → Promise<object>

Parsing object from file.

params:

  • file_path - Path to file.
  • env_flag - Flag for parsing environment keys.

Readme

Keywords

none

Package Sidebar

Install

npm i jtomler

Weekly Downloads

4

Version

1.0.1

License

ISC

Unpacked Size

5.04 kB

Total Files

4

Last publish

Collaborators

  • samuray