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

app-conf

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-conf - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

2

_pMap.js
module.exports = function pMap(array, iteratee) {
const { then } = array;
return typeof then === "function"
? then.call(array, array => pMap(array, iteratee))
? then.call(array, (array) => pMap(array, iteratee))
: Promise.all(array.map(iteratee));
};

@@ -21,4 +21,4 @@ "use strict";

function readFile(path) {
return realpath(path).then(function(path) {
return fs$readFile(path).then(function(buffer) {
return realpath(path).then(function (path) {
return fs$readFile(path).then(function (buffer) {
return {

@@ -47,3 +47,3 @@ path: path,

name: "vendor",
dir: opts => opts.appDir,
dir: (opts) => opts.appDir,
read: (_, dir) => pMap(glob(j(dir, "config.*")), readFile),

@@ -55,3 +55,3 @@ },

name: "system",
dir: opts => j("/etc", opts.appName),
dir: (opts) => j("/etc", opts.appName),
read: (_, dir) => pMap(glob(j(dir, "config.*")), readFile),

@@ -63,3 +63,3 @@ },

name: "global",
dir: opts => {
dir: (opts) => {
const configDir = xdgBasedir.config;

@@ -91,3 +91,3 @@ return configDir && j(configDir, opts.appName);

return pMap(
pMap(paths.reverse(), path =>
pMap(paths.reverse(), (path) =>
glob(path, {

@@ -94,0 +94,0 @@ silent: true,

@@ -34,4 +34,4 @@ "use strict";

if (value !== null && typeof value === "object") {
return pMap(Object.keys(value), key =>
resolvePaths(value[key], base).then(resolved => {
return pMap(Object.keys(value), (key) =>
resolvePaths(value[key], base).then((resolved) => {
value[key] = resolved;

@@ -67,3 +67,3 @@ })

const entryOpts = { appDir, appName };
return pMap(entries, entry => {
return pMap(entries, (entry) => {
if (useWhitelist && !whitelist.has(entry.name)) {

@@ -77,5 +77,5 @@ return [];

})
.then(files => {
.then((files) => {
files = flatten(files);
return pMap(files, file => {
return pMap(files, (file) => {
try {

@@ -92,3 +92,3 @@ const data = unserialize(file);

})
.then(data =>
.then((data) =>
data.reduce((acc, cfg) => {

@@ -115,3 +115,3 @@ if (cfg !== undefined) {

const entryOpts = { appName, appDir };
entries.forEach(entry => {
entries.forEach((entry) => {
const dirFn = entry.dir;

@@ -131,3 +131,3 @@ const dir = typeof dirFn === "function" ? dirFn(entryOpts) : dirFn;

const loadWrapper = () => {
load(appName, opts).then(config => cb(undefined, config), cb);
load(appName, opts).then((config) => cb(undefined, config), cb);
};

@@ -134,0 +134,0 @@

{
"name": "app-conf",
"version": "0.9.0",
"version": "0.9.1",
"license": "ISC",

@@ -30,18 +30,17 @@ "author": "Julien Fontanet <julien.fontanet@isonoe.net> (http://julien.isonoe.net/)",

"make-error": "^1.3.5",
"promise-toolbox": "^0.16.0",
"xdg-basedir": "^3.0.0"
"promise-toolbox": "^0.19.0",
"xdg-basedir": "^4.0.0"
},
"devDependencies": {
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-config-standard": "^14.1.0",
"eslint": "^7.23.0",
"eslint-config-prettier": "^8.2.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"husky": "^3.0.9",
"jest": "^24.8.0",
"lint-staged": "^9.4.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"husky": "^4",
"jest": "^26.6.3",
"lint-staged": "^10",
"mock-fs": "^4.7.0",
"prettier": "^1.15.2",
"prettier": "^2.2.1",
"rimraf": "^3.0.0"

@@ -66,3 +65,2 @@ },

"prettier --write",
"git add",
"eslint --ignore-pattern '!*'",

@@ -69,0 +67,0 @@ "jest --findRelatedTests --passWithNoTests"

@@ -34,3 +34,3 @@ # app-conf

ignoreUnknownFormats: false,
}).then(function(config) {
}).then(function (config) {
console.log(config);

@@ -37,0 +37,0 @@ });

@@ -8,3 +8,3 @@ "use strict";

const formatJson = JSON.stringify;
const parseJson = (function() {
const parseJson = (function () {
try {

@@ -34,3 +34,3 @@ // eslint-disable-next-line node/no-extraneous-require

// Test whether this “file” seems to be on the correct format.
test: function(file) {
test: function (file) {
return file.path && /\.json5?$/i.test(file.path);

@@ -40,3 +40,3 @@ },

// Unserialize the content of the file.
unserialize: function(file) {
unserialize: function (file) {
return parseJson(String(file.content));

@@ -46,3 +46,3 @@ },

// Serialize the value to a string/buffer.
serialize: function(value, opts) {
serialize: function (value, opts) {
opts || (opts = {});

@@ -61,9 +61,9 @@ const indent = "indent" in opts ? opts.indent : 2;

serializers.ini = {
test: function(file) {
test: function (file) {
return file.path && /\.ini$/i.test(file.path);
},
unserialize: function(file) {
unserialize: function (file) {
return ini.decode(String(file.content));
},
serialize: function(value) {
serialize: function (value) {
return ini.encode(value);

@@ -90,14 +90,22 @@ },

let { dump, load } = yaml;
// compat with js-yaml < 4
if ("DEFAULT_SAFE_SCHEMA" in yaml) {
dump = yaml.safeDump;
load = yaml.safeLoad;
}
serializers.yaml = {
test: function(file) {
test: function (file) {
return file.path && /\.yaml$/i.test(file.path);
},
unserialize: function(file) {
return yaml.safeLoad(String(file.content));
unserialize: function (file) {
return load(String(file.content));
},
serialize: function(value, opts) {
serialize: function (value, opts) {
opts || (opts = {});
const indent = "indent" in opts ? opts.indent : 2;
return yaml.safeDump(value, {
return dump(value, {
indent: indent,

@@ -111,4 +119,4 @@ });

const detectFormat = function(file) {
return findKey(serializers, function(serializer) {
const detectFormat = function (file) {
return findKey(serializers, function (serializer) {
return serializer.test(file);

@@ -118,3 +126,3 @@ });

const serialize = function(value, format, opts) {
const serialize = function (value, format, opts) {
let buffer = serializers[format].serialize(value, opts);

@@ -129,3 +137,3 @@

const unserialize = function(file, format) {
const unserialize = function (file, format) {
format || (format = detectFormat(file));

@@ -132,0 +140,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