easy-ini
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -61,3 +61,3 @@ const _EMPTY_LINE = 0, | ||
for (let l of lines) { | ||
if(this.autoTrim) {l = l.trim()} | ||
if (this.autoTrim) {l = l.trim()} | ||
const lineType = this._findType(l) | ||
@@ -84,3 +84,3 @@ try{ | ||
} | ||
for(const l of this._secArr(section)) { | ||
for (const l of this._secArr(section)) { | ||
curLine = this._lineGens[l.type](l, shouldTrim, shouldFix) | ||
@@ -219,3 +219,3 @@ if (cleanEmptyLines && this._findType(curLine) == _EMPTY_LINE) {continue} | ||
for (const line of sLines) { | ||
if(line.type == _PAIR) { | ||
if (line.type == _PAIR) { | ||
if (line.val.indexOf(token) >= 0) { | ||
@@ -222,0 +222,0 @@ line.val = line.val.replace(token, value) |
{ | ||
"name": "easy-ini", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "manage ini files content", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,3 +19,3 @@ | ||
2. You care about preserving comments | ||
3. You want want easy formatting and cool logic like merge and replace | ||
3. You want easy formatting and cool logic like merge and replace | ||
@@ -222,3 +222,3 @@ ### basic example | ||
while (includes = productConfig.getLinesByMatch("#INCLUDE")){ | ||
if(includes.length == 0) {break} | ||
if (includes.length == 0) {break} | ||
productConfig.removeLineByMatch('#INCLUDE', true) | ||
@@ -237,2 +237,19 @@ for (const include of includes.reverse()) { | ||
#### ini template proccessing | ||
```javascript | ||
const fs = require('fs') | ||
const INI = require('easy-ini') | ||
const webCon = new INI(fs.readFileSync('./website_config.ini',{encoding: 'utf8'})) | ||
// latest=GGEZ.v69.zip | ||
// download-url=<<SubDomain>>.<<BaseDomain>>/download/%latest% | ||
webCon.findAndReplace('<<BaseDomain>>', 'easy-ini.com', true) | ||
webCon.findAndReplace('<<SubDomain>>', 'download', true) | ||
webCon.findAndReplace('<<Author>>', 'Gal Angel', true) | ||
webCon.solveSelfReferences('%', '%') | ||
const upCon = webCon.createINIString() | ||
fs.writeFileSync("./to_upload.ini", upCon) | ||
``` | ||
<br> | ||
--- | ||
@@ -239,0 +256,0 @@ ## Author |
56570
266