New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

merge-dictionaries

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-dictionaries - npm Package Compare versions

Comparing version 0.0.3 to 1.0.0

21

index.js
var _ = require('@sailshq/lodash');
module.exports = function(dictA, dictB) {
// Create the customized merge function.
var merge = function(dictA, dictB) {
return _.merge(dictA, dictB, function(a, b) {

@@ -13,1 +14,19 @@ // If `a` is not a POJO, or it's an empty POJO, just replace it with `b`.

};
// Allow variadic usage.
// e.g. mergeDictionarys(dictOne, dictTwo, dictThree, dictFour, ...)
module.exports = function() {
// Special case: if only one arg is provided, just return it.
if (arguments.length === 1) {
return arguments[0];
}
// Otherwise use `_.reduce` to merge arguments from left to right.
var args = Array.prototype.slice.call(arguments);
var firstArg = args.shift();
return _.reduce(args, function(memo, arg) {
return merge(memo, arg);
}, firstArg);
};

2

package.json
{
"name": "merge-dictionaries",
"version": "0.0.3",
"version": "1.0.0",
"description": "Recursively merge two dictionaries together",

@@ -5,0 +5,0 @@ "main": "index.js",

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