Comparing version 1.2.0 to 1.2.1
37
index.js
const axios = require('axios'); | ||
const fs = require('fs'); | ||
@@ -6,27 +7,25 @@ //////////////// | ||
////////////// | ||
import { readFileSync } from 'fs'; | ||
function readPropertiesFile(filePath) { | ||
const fileContent = readFileSync(filePath, 'utf-8'); | ||
const lines = fileContent.split('\n'); | ||
const config = {}; | ||
const fileContent = fs.readFileSync(filePath, 'utf-8'); | ||
const lines = fileContent.split('\n'); | ||
const config = {}; | ||
lines.forEach(line => { | ||
const trimmedLine = line.trim(); | ||
if (trimmedLine && trimmedLine.includes('=')) { | ||
const [key, ...valueParts] = trimmedLine.split('='); | ||
const value = valueParts.join('=').trim(); | ||
config[key.trim()] = value; | ||
} | ||
}); | ||
lines.forEach(line => { | ||
const trimmedLine = line.trim(); | ||
if (trimmedLine && trimmedLine.includes('=')) { | ||
const [key, ...valueParts] = trimmedLine.split('='); | ||
const value = valueParts.join('=').trim(); | ||
config[key.trim()] = value; | ||
} | ||
}); | ||
return config; | ||
return config; | ||
} | ||
function replacePlaceholders(url, replacements) { | ||
for (const placeholder in replacements) { | ||
const placeholderValue = replacements[placeholder]; | ||
url = url.replace(new RegExp(`\\$\\{${placeholder}\\}`, 'g'), placeholderValue); | ||
} | ||
return url; | ||
for (const placeholder in replacements) { | ||
const placeholderValue = replacements[placeholder]; | ||
url = url.replace(new RegExp(`\\$\\{${placeholder}\\}`, 'g'), placeholderValue); | ||
} | ||
return url; | ||
} | ||
@@ -33,0 +32,0 @@ |
{ | ||
"name": "jwz", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Utils", | ||
@@ -5,0 +5,0 @@ "repository": { |
7140