shangerxin / config-ini Goto Github PK
View Code? Open in Web Editor NEWJavaScript Configuration file(.ini) content parser, similar to python ConfigParser without I/O operations
License: GNU Lesser General Public License v3.0
JavaScript Configuration file(.ini) content parser, similar to python ConfigParser without I/O operations
License: GNU Lesser General Public License v3.0
In the types file, get
has sectionName
as a required argument.
However, the docs say:
If there is no section supplied for the options then a default section will be used
So shouldn't sectionName
be optional in the types (i.e. sectionName?
)?
I'm trying to parse a php.ini file but the package is throwing an error when it reaches section headers with whitespace between the characters. For example, the section header "[CLI Server]" will throw an error.
The _sectionRegex regex expression does not cover this case. Setting the _sectionRegex variable to /^[([^\]\r\n]+)]/ has solved this problem for me.
Would be nice to have.
ini that have something like
[mysqlhotcopy]
interactive-timeout
throw error
hello, there is an issue with the module
[SMS_DC_Countries]
1=[ "1", "2" ]
61=[ "1", "2" ]
44=[ "1", "2", "16" ]
31=[ "16"]
32=[ "16"] ;; <-- this gives error {name: "ConfigIniParser Error", message: "Found duplicated section in the given ini file"} what is not section but value
353=[ "1", "2", "16" ]
420=[ "1", "2", "16" ]
421=[ "1", "2", "16" ]
please help
I have ini file
[FOLDERS]
DATA_ROOT_FOLDER=C:\wamp64\www\MyElectronAngularWorksFinal
When I do
parser.get('FOLDERS','DATA_ROOT_FOLDER')
I got [ConfigIniParser Error]: The specify option not found
When I remove the : string it works
I have my ini file which I created manually containing only this
[DB]
const iniContent = fs.readFileSync(filePath, 'utf-8'); console.log(iniContent); //this gives [DB]
parser.parse(iniContent);
This gives me error: ConfigIniParser Error Found duplicated section in the given ini file
How is it possible ? I've tryied many delimitters (I am on windows) like \n or \r\n
EDIT:
It's my fault I've called .parse method two times sorry
If I use any of those values as the third parameter for the get method, it throws errorNoOption.
Maybe you should replace "if (defaultValue)" with "if (defaultValue === undefined)".
I'm getting an error on the line:
var ConfigIniParser = require("config-ini-parser").ConfigIniParser;
ConfigIniParser Error: The specify option not found
at /home/ericiam/jbconnect-test/node_modules/config-ini-parser/config-ini.js:21:39
at Object.<anonymous> (/home/ericiam/jbconnect-test/node_modules/config-ini-parser/config-ini.js:423:2)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/theuser/jbconnect-test/workflows/primer3.end.js:12:17
node v10.x
I have tried to fix the typescript declarations in #11, but apparently the export in:
Line 142 in fcda310
import { ConfigIniParser } from "config-ini-parser";
const parser = new ConfigIniParser();
then typescript complains with:
src/account.ts:96:22 - error TS2351: This expression is not constructable.
Type 'ConfigIniParser' has no construct signatures.
96 const parser = new ConfigIniParser();
~~~~~~~~~~~~~~~
Unfortunately I have been unable to solve this myself. If anyone has an idea, any pointers would be greatly appreciated.
I hope it can detect by itself the delimiter
Hello, could you change this line:
value = line.substr(assignPosition + assignIdentifierLength);
to
value = line.substr(assignPosition + assignIdentifierLength).trim();
Otherwise, it's keeping spaces in values. Thank you for the package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.