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

@percy/config

Package Overview
Dependencies
Maintainers
6
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/config - npm Package Compare versions

Comparing version 1.0.0-beta.47 to 1.0.0-beta.48

4

dist/load.js

@@ -84,7 +84,5 @@ "use strict";

log.warn('Found older config file version, please run ' + '`percy config:migrate` to update to the latest version');
config = (0, _migrate.default)(result.config);
} else {
config = result.config;
}
config = (0, _migrate.default)(result.config);
cache.set(path, config);

@@ -91,0 +89,0 @@ }

@@ -10,2 +10,4 @@ "use strict";

var _logger = _interopRequireDefault(require("@percy/logger"));
var _normalize = _interopRequireDefault(require("./normalize"));

@@ -25,23 +27,51 @@

migrations.clear();
} // Assigns a value to the object at the path creating any necessary nested
} // Sets a value to the object at the path creating any necessary nested
// objects along the way
function assign(obj, path, value) {
function set(obj, path, value) {
path.split('.').reduce((loc, key, i, a) => loc[key] = i === a.length - 1 ? value : loc[key] || {}, obj);
return obj;
} // Maps a value from one path to another, deleting the first path
function map(obj, from, to, map = v => v) {
let val = from.split('.').reduce((loc, key, i, a) => {
let val = loc && loc[key];
if (loc && i === a.length - 1) delete loc[key];
return val;
}, obj);
return set(obj, to, map(val));
} // Deletes properties from an object at the paths
function del(obj, ...paths) {
for (let path of paths) {
path.split('.').reduce((loc, key, i, a) => {
if (loc && i === a.length - 1) delete loc[key];
return loc && loc[key];
}, obj);
}
return obj;
} // Calls each registered migration function with a normalize provided config
// and a `set` function which assigns values to the returned output
// and util functions for working with the config object
function migrate(config) {
let output = {
version: 2
config = (0, _normalize.default)(config);
let util = {
set: set.bind(null, config),
map: map.bind(null, config),
del: del.bind(null, config),
log: (0, _logger.default)('config')
};
let input = (0, _normalize.default)(config);
let set = assign.bind(null, output);
migrations.forEach(migration => {
migration(input, set);
migration(config, util);
});
return output;
return (0, _normalize.default)(config, {
overrides: {
version: 2
}
});
}
{
"name": "@percy/config",
"version": "1.0.0-beta.47",
"version": "1.0.0-beta.48",
"license": "MIT",

@@ -25,3 +25,3 @@ "main": "dist/index.js",

"dependencies": {
"@percy/logger": "^1.0.0-beta.47",
"@percy/logger": "^1.0.0-beta.48",
"ajv": "^8.0.5",

@@ -34,3 +34,3 @@ "cosmiconfig": "^7.0.0",

},
"gitHead": "76ec62a8760c712cae9118a4dd2a4a6eb49e5214"
"gitHead": "67f5911de2701d1ca4077806052e0ec28ac5d125"
}
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