Code Monkey home page Code Monkey logo

config-ini's People

Contributors

dcermak avatar dependabot[bot] avatar mftrips avatar qwerchuan avatar shangerxin avatar simon-laux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

config-ini's Issues

"This expression is not constructable" error when consuming the ConfigIniParser from typescript

I have tried to fix the typescript declarations in #11, but apparently the export in:

declare const _exported: { ConfigIniParser: ConfigIniParser }

is not correct. When I try to use the class in typescript code:

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.

Found duplicated section in the given ini file

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

Error parsing section header with spaces

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.

valid config gives 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

Can't use false, 0 or '' as default value.

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)".

trim issue

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.

Typings for default section

I'm trying out the library with Typescript. It seems like accessing the default section requires one to pass null to methods like items() and get(). Maybe the type definition needs to include null as well?

image

ConfigIniParser Error: The specify option not found

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

Two points ":" causing error

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.