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 2.1.1 to 2.2.0

40

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

@@ -20,10 +20,6 @@ "name": "Steve King",

"dependencies": {
"mkdirp": "~0.5.1"
"mkdirp": "^1.0.4"
},
"devDependencies": {
"@kwsites/file-exists": "^1.0.0",
"expect.js": "^0.3.1",
"mocha": "^6.1.4",
"rimraf": "^2.6.3",
"sinon": "^7.3.2"
"jest": "^26.6.3"
},

@@ -46,3 +42,3 @@ "keywords": [

"postversion": "npm publish && git push && git push --tags",
"test": "mocha ./test/*.spec.js"
"test": "jest --coverage"
},

@@ -52,3 +48,29 @@ "engines": {

},
"license": "MIT"
"license": "MIT",
"jest": {
"roots": [
"<rootDir>/src/",
"<rootDir>/test/"
],
"coverageThreshold": {
"global": {
"branches": 80,
"functions": 80,
"lines": 80,
"statements": 80
}
},
"coveragePathIgnorePatterns": [
"<rootDir>/test/"
],
"coverageReporters": [
"json",
"lcov",
"text",
"clover"
],
"testMatch": [
"**/test/**/*.spec.*"
]
}
}

@@ -1,5 +0,9 @@

const fs = require('fs');
const {readFileSync, statSync} = require('fs');
const propertyAppender = require('./property-appender').propertyAppender;
const propertyWriter = require('./property-writer').propertyWriter;
const has = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);
const SECTION = Symbol('SECTION');
function PropertiesReader (sourceFile, encoding, options = {}) {

@@ -19,3 +23,3 @@ this._encoding = typeof encoding === 'string' && encoding || 'utf-8';

*/
PropertiesReader.prototype._section = '';
PropertiesReader.prototype[SECTION] = '';

@@ -97,3 +101,3 @@ /**

if (sourceFile) {
this.read(fs.readFileSync(sourceFile, typeof encoding === 'string' && encoding || this._encoding));
this.read(readFileSync(sourceFile, typeof encoding === 'string' && encoding || this._encoding));
}

@@ -111,3 +115,3 @@

PropertiesReader.prototype.read = function (input) {
delete this._section;
delete this[SECTION];
('' + input).split('\n').forEach(this._readLine, this);

@@ -127,6 +131,6 @@ return this;

if (section) {
this._section = section[1];
this[SECTION] = section[1];
}
else if (property) {
section = this._section ? this._section + '.' : '';
section = this[SECTION] ? this[SECTION] + '.' : '';
this.set(section + property[1].trim(), property[3].trim());

@@ -218,3 +222,8 @@ }

}
source = (source[step] = source[step] || {});
if (!has(source, step)) {
Object.defineProperty(source, step, { value: {} });
}
source = source[step]
}

@@ -303,3 +312,3 @@

if (value && /\.(path|dir)$/.test(key)) {
value = Path.join(basePath, Path.relative(basePath, value));
value = Path.resolve(basePath, value);
this.set(key, value);

@@ -312,3 +321,3 @@

}
else if (!fs.statSync(directoryPath).isDirectory()) {
else if (!statSync(directoryPath).isDirectory()) {
throw new Error("Path is not a directory that already exists");

@@ -315,0 +324,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