1.0.1 • Published 3 years ago

jtomler v1.0.1

Weekly downloads
37
License
ISC
Repository
github
Last release
3 years ago

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.