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

map-factory

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

map-factory - npm Package Compare versions

Comparing version 3.7.4 to 3.7.5

4

CHANGELOG.md

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

### 3.7.5
Fixed a bug where ```{"alwaysSet":true}``` was not setting an empty array in all use cases.
### 3.7.4

@@ -2,0 +6,0 @@

8

dist/lib/object-mapper/set-key-value.js

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

// console.log(indent, "Destination has a value");
// console.log(indent, "Destination has a value", key, value, isValueArray);
if (isPropertyArray) {

@@ -133,5 +133,9 @@ arrayIndex = match[2] || 0;

// console.log(indent, "resolve", fromValue, destinationObject, parentIsArray);
// console.log(indent, "resolve", key, fromValue, destinationObject, parentIsArray);
if (parentIsArray === true && destinationStartedEmpty) return null;
if (isValueArray) {
destinationObject[key] = [];
}
return destinationObject;

@@ -138,0 +142,0 @@ }

@@ -283,2 +283,40 @@ "use strict";

});
group("multiple mappings and arrays", function () {
lab.test("when two mappings have an array as the first mapping", function () {
var mapper = (0, _index2.default)({ alwaysSet: true });
var source = {
foo: 0,
bar: []
};
var expected = { bar: [], foo: 0 };
mapper.map("bar").to("bar[]").map("foo");
var actual = mapper.execute(source);
(0, _code.expect)(actual).to.equal(expected);
});
lab.test("when two mappings have an array as the second mapping", function () {
var mapper = (0, _index2.default)({ alwaysSet: true });
var source = {
foo: 0,
bar: []
};
var expected = { bar: [], foo: 0 };
mapper.map("foo").map("bar").to("bar[]");
var actual = mapper.execute(source);
(0, _code.expect)(actual).to.equal(expected);
});
});
});

@@ -285,0 +323,0 @@

{
"name": "map-factory",
"version": "3.7.4",
"version": "3.7.5",
"description": "A simple object mapping utility that makes it easy to map data from one object to another. Create object mappers using fluent interface that supports deep references (dot notation), custom transformations, and object merging.",

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

"babel-cli": "^6.26.0",
"babel-eslint": "^9.0.0",
"babel-eslint": "^10.0.1",
"babel-preset-es2015": "^6.24.1",

@@ -58,0 +58,0 @@ "benchmark": "^2.1.3",

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