Comparing version 1.1.0 to 1.1.1
@@ -23,4 +23,4 @@ "use strict"; | ||
options = Object.assign({ | ||
indent: 2, | ||
options: "utf-8" | ||
encoding: "utf-8", | ||
indent: 2 | ||
}, this.options, options); | ||
@@ -27,0 +27,0 @@ if (options.path && options.encoding) { |
@@ -31,4 +31,4 @@ import * as fs from "fs"; | ||
{ | ||
indent: 2, | ||
options: "utf-8" | ||
encoding: "utf-8", | ||
indent: 2 | ||
}, | ||
@@ -35,0 +35,0 @@ this.options, |
{ | ||
"name": "ftconfig", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "F*ck the config", | ||
@@ -59,2 +59,3 @@ "main": "dist/index.js", | ||
"@types/ini": "^1.3.30", | ||
"@types/js-yaml": "^3.11.2", | ||
"@types/json5": "0.0.30", | ||
@@ -61,0 +62,0 @@ "@types/make-dir": "^1.0.3", |
124
README.md
@@ -13,2 +13,126 @@ # ftconfig | ||
## Usage | ||
### Install with npm | ||
```bash | ||
npm install ftconfig | ||
``` | ||
```typescript | ||
const ftconfig = require("ftconfig"); | ||
const config = ftconfig.loadFile("./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` | ||
[NPM_URL]: https://img.shields.io/node/v/ftconfig.svg?style=flat-square&maxAge=600 | ||
@@ -15,0 +139,0 @@ [NPM_HREF]: https://www.npmjs.com/package/ftconfig |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18439
151
24