Skip to content

Arylo/ftconfig

Repository files navigation

ftconfig

F*ck the config

node Travis Coveralls Known Vulnerabilities David Author MIT-License 996ICU-License

Usage

Install with npm

npm install ftconfig
import ftconfig = require("ftconfig");
const config = ftconfig.readFile("./package.json")
  .modify((obj) => {
    config.name = "simple";
    return obj
  })
  .save();
const obj = config.toObject();

Module Methods

ftconfig.readFile(filepath, [options])

Paramseters

  • filepath {String} Filepath
  • options {Object}
    • encoding {String="utf-8"}
    • type {String}
      • yaml
      • json
      • json5
      • hjson
      • toml
      • ini

Return

Class Config

ftconfig.read(configString, [options])

Paramseters

  • configString {String} config string
  • options {Object}
    • type {String}
      • yaml
      • json
      • json5
      • hjson
      • toml
      • ini

Return

Class Config

ftconfig.read(configString, [type])

Paramseters

  • configString {String} config string
  • type {String}
    • yaml
    • json
    • json5
    • hjson
    • toml
    • ini

Return

Class Config

Config.modify(function)

Paramseters

  • configString {Function} Get which type Return what

Return

Class Config

Config.save([filepath])

Paramseters

  • filepath {String} Targe Filepath

Return

Class Config

Config.save([options])

Paramseters

  • options {Object}
    • path {String}
    • encoding {String="utf-8"}
    • indent {Number=2}

Return

Class Config

Config.toString([options])

Paramseters

  • options {any}

Return

String

Config.toObject()

Return

Object