Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

properties-reader

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

properties-reader - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

src/properties-reader-factory.js

4

package.json
{
"name": "properties-reader",
"description": "Properties file reader for Node.js",
"version": "1.0.0",
"version": "2.0.0",
"author": {

@@ -38,3 +38,3 @@ "name": "Steve King",

},
"main": "src/PropertiesReader",
"main": "src/properties-reader-factory",
"files": [

@@ -41,0 +41,0 @@ "src/**/*.js"

@@ -13,5 +13,2 @@ Properties-Reader

Or clone the repo [git clone https://github.com/steveukx/properties](https://github.com/steveukx/properties) and
import the `/src/PropertiesReader.js` script.
API

@@ -22,4 +19,4 @@ ===

var PropertiesReader = require('properties-reader');
var properties = PropertiesReader('/path/to/properties.file');
var propertiesReader = require('properties-reader');
var properties = propertiesReader('/path/to/properties.file');

@@ -78,11 +75,9 @@ The properties are then accessible either by fully qualified name, or if the property names are in dot-delimited

```
```javascript
// async/await ES6
const props = new PropertiesReader(filePath);
const propertiesReader = require('properties-reader');
const props = propertiesReader(filePath);
await props.save(filePath);
// tradtitonal
const props = new PropertiesReader(filePath);
// ES5 callback style
// ES5 callback styles
props.save(filePath, function then(err, data) { ... });

@@ -92,6 +87,4 @@

props.save(filePath).then(onSaved, onSaveError);
```
Data Types

@@ -103,2 +96,19 @@ ==========

FAQ / Breaking Changes
======================
## Duplicate Section Headings
From version `2.0.0` the default behaviour relating to multiple `[section]` blocks with the same name has changed
so combine the items of each same-named section into the one section. This is only visible when saving the items
(via `reader.save()`).
To restore the previous behaviour which would allow duplicate `[...]` blocks to be created, supply an appender
configuration with the property `allowDuplicateSections` set to `true`.
```javascript
const propertiesReader = require('properties-reader');
const props = propertiesReader(filePath, 'utf-8', { allowDuplicateSections: true });
```
Contributions

@@ -105,0 +115,0 @@ =============

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc