{"_id":"prop-ini","_rev":"411001","name":"prop-ini","description":"Reads, Writes, Manages INI/Property files","dist-tags":{"latest":"0.0.2"},"maintainers":[{"name":"npm:paulbennetjoshua","email":""},{"name":"paulbennetjoshua","email":"paulbennetjoshua@gmail.com"}],"time":{"modified":"2021-08-04T05:08:29.000Z","created":"2015-12-26T18:33:58.365Z","0.0.2":"2015-12-26T19:43:29.137Z","0.0.1":"2015-12-26T18:33:58.365Z"},"users":{},"author":{"name":"Paul Bennet"},"repository":{"type":"git","url":"git+https://github.com/paulbennet/propini.git"},"versions":{"0.0.2":{"name":"prop-ini","version":"0.0.2","description":"Reads, Writes, Manages INI/Property files","main":"prop-ini.js","directories":{"test":"test"},"dependencies":{"extend":"^3.0.0"},"devDependencies":{},"scripts":{"test":"test/test.js"},"keywords":["propertyfile","ini"],"author":{"name":"Paul Bennet"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/paulbennet/propini.git"},"bugs":{"url":"https://github.com/paulbennet/propini/issues"},"homepage":"https://github.com/paulbennet/propini#readme","gitHead":"49b882b66568298ecd8179fbd04151cea4e040d3","_id":"prop-ini@0.0.2","_shasum":"6733a7cb5242acab2be42e607583d8124b172a5b","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"paulbennetjoshua","email":"paulbennetjoshua@gmail.com"},"dist":{"shasum":"6733a7cb5242acab2be42e607583d8124b172a5b","size":6462,"noattachment":false,"key":"/prop-ini/-/prop-ini-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/prop-ini/download/prop-ini-0.0.2.tgz"},"maintainers":[{"name":"npm:paulbennetjoshua","email":""},{"name":"paulbennetjoshua","email":"paulbennetjoshua@gmail.com"}],"publish_time":1451159009137,"_cnpm_publish_time":1451159009137,"_hasShrinkwrap":false},"0.0.1":{"name":"prop-ini","version":"0.0.1","description":"Reads, Writes, Manages INI/Property files","main":"prop-ini.js","directories":{"test":"test"},"dependencies":{"extend":"^3.0.0"},"devDependencies":{},"scripts":{"test":"test/test.js"},"keywords":["propertyfile","ini"],"author":{"name":"Paul Bennet"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/paulbennet/propini.git"},"bugs":{"url":"https://github.com/paulbennet/propini/issues"},"homepage":"https://github.com/paulbennet/propini#readme","gitHead":"4fdd97a546c41b9117324977e193cf2cdd181472","_id":"prop-ini@0.0.1","_shasum":"df7b0fd1f43f18219ea14276b94064945dc09de2","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"paulbennetjoshua","email":"paulbennetjoshua@gmail.com"},"dist":{"shasum":"df7b0fd1f43f18219ea14276b94064945dc09de2","size":5326,"noattachment":false,"key":"/prop-ini/-/prop-ini-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/prop-ini/download/prop-ini-0.0.1.tgz"},"maintainers":[{"name":"npm:paulbennetjoshua","email":""},{"name":"paulbennetjoshua","email":"paulbennetjoshua@gmail.com"}],"publish_time":1451154838365,"_cnpm_publish_time":1451154838365,"_hasShrinkwrap":false}},"readme":"# PropINI\r\n\r\nRead, Write, Encode, Decode & Manage INI/Property files with ease.\r\n\r\n#\r\n##### Install\r\n#\r\n> npm install prop-ini\r\n\r\n#\r\n##### Usage\r\n#\r\n1] Require the module in your code\r\n```javascript\r\n    var PropINI = require(\"prop-ini\");\r\n```\r\n#\r\n2] Create new instance for PropINI\r\n```javascript\r\n    var piTheOne = PropIni.createInstance();\r\n```\r\n\r\n#\r\n3] Decode/Read data\r\n```javascript\r\n    var iniData = piTheOne.decode(<config>);\r\n```\r\n`<config>` is an object with following props\r\n- `config.data` - Pass the INI/Properties format data directly as a string\r\n- `config.file` - Tell the function to get the data from this file\r\n- `config.charset` - Tell function to read file by this encoding\r\n- `config.lineSeparator` - Tell function to split lines based on this char\r\n\r\nThe returned `iniData` is an object with following props\r\n- `iniData.sections` - Object containing sections as top-level nodes and properties of appropriate sections as child nodes for them. `_global` is a special section where properties without any section are available\r\n- `iniData.sectionOrder` - Array of section names in exact order matching the parsed data. `_global` will be the first entry\r\n\r\nOn successfull decode the parsed values will be stored with the PropINI instance as properties. You may access them using `piTheOne.sections` and `piThOne.sectionOrder`. Handle with care !\r\n\r\n#\r\n4] Encode/Write data\r\n```javascript\r\n    var iniString = piTheOne.encode(<config>);\r\n```\r\n`<config>` is an object with following props\r\n- `config.sortSections` - Sort section names using `String.prototype.localeCompare`\r\n- `config.sortKeys` - Sort properties/keys under each section with `localeCompare`\r\n- `config.file` - Tell function write the encoded data to this file\r\n- `config.charset` - Tell function to write file with this encoding\r\n- `config.lineSeparator` - Tell function to join lines based on this char\r\n\r\nThe returned `iniString` is a string type variable containg INI/Property file format data\r\n#\r\n##### Other convenience functions (After parsing data ...)\r\n#\r\n1] Get section names as an Array\r\n```javascript\r\n    var sections = piTheOne.getSections();\r\n```\r\n- `sections` is an Array containing all sections in the parsed instance data\r\n- `_global` is excluded\r\n- Parsed section order is maintained\r\n\r\n#\r\n2] Get anything you want ! \r\n```javascript\r\n    var data = piTheOne.getData(<section>, <key>);\r\n```\r\n- `section` is the name of the section. In absense of `key` whole section's object with child properties will be returned\r\n- `key` is the name of the property under some section. In absense of `section`, `_global` section will be used. String value of a key will be returned\r\n- In absense of both `section` & `key`, whole data will be returned as an object with `sections`, `sectionOrder` as properties\r\n\r\n#\r\n3] Set anything you want ! \r\n```javascript\r\n    var success = piTheOne.addData(<value>, <section>, <key>);\r\n```\r\n- `section` is the name of the section. `value` should be given as an object in this case\r\n- `key` is the name of the property under some section. In absense of `section`, `_global` section will be used. `value` should be of String type in this case\r\n- In absense of both `section` & `key`, you can set the whole data for the instance. An object with `sections`, `sectionOrder` as properties should be given for `value`. `sections` property should have `_global` child property.\r\n\r\n#\r\n4] Remove anything you want ! \r\n```javascript\r\n    var success = piTheOne.removeData(<section>, <key>);\r\n```\r\n- `section` is the name of the section. In absense of `key` whole section will be removed.\r\n- `key` is the name of the property under some section. In absense of `section`, `_global` section will be used.\r\n- In absense of both `section` & `key`, whole instance data will be reset to empty state.\r\n\r\n\r\n#\r\n##### And, one more thing  ...\r\n#\r\n- Since the data is exposed as instance properties you can directly process them as you wish. But please respect the format PropINI expects the data to be in.\r\n- `piTheOne.sections` should always be an object\r\n- `piTheOne.sectionOrder` should always be an array and should be in sync with `piTheOne.sections` data\r\n- `piTheOne.sections` should always have a child object `_global`\r\n\r\n#\r\n##### LEGAL STUFF\r\n#\r\n- Check project's license info\r\n","_attachments":{},"homepage":"https://github.com/paulbennet/propini#readme","bugs":{"url":"https://github.com/paulbennet/propini/issues"},"license":"MIT"}