Socket
Socket
Sign inDemoInstall

formatic

Package Overview
Dependencies
Maintainers
4
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formatic - npm Package Compare versions

Comparing version 0.3.38 to 0.3.39

46

build/lib/components/fields/object.js

@@ -41,10 +41,42 @@ // # object component

componentWillReceiveProps: function componentWillReceiveProps(newProps) {
var _this = this;
if (hasDuplicateKeys(this.state.assocList)) {
return; // talk to the hand
}
var config = this.props.config;
this.setState({
assocList: config.objectToAssocList(newProps.field.value)
});
var newAssocList = config.objectToAssocList(newProps.field.value);
// If we came from an onChange, use the previous sort order for keys.
if (this.keysBeforeChange) {
(function () {
var keyToItem = newAssocList.reduce(function (obj, item) {
obj[item.key] = item;
return obj;
}, {});
var keysBeforeChangeSet = _this.keysBeforeChange.reduce(function (obj, key) {
obj[key] = true;
return obj;
}, {});
// Make a list in order of old keys.
var orderedAssocList = _this.keysBeforeChange.reduce(function (list, key) {
list.push(keyToItem[key]);
return list;
}, []);
// Add any new keys at the end.
newAssocList.reduce(function (list, item) {
if (!(item.key in keysBeforeChangeSet)) {
list.push(item);
}
return list;
}, orderedAssocList);
_this.setState({
assocList: orderedAssocList
});
})();
} else {
this.setState({
assocList: newAssocList
});
}
this.keysBeforeChange = null;
},

@@ -55,3 +87,7 @@

var value = config.assocListToObject(assocList);
var keys = assocList.map(function (item) {
return item.key;
});
// Need to hold onto keys to compare when receiving props.
this.keysBeforeChange = keys;
this.setState({ assocList: assocList });

@@ -58,0 +94,0 @@ if (!hasDuplicateKeys(assocList)) {

2

package.json
{
"name": "formatic",
"version": "0.3.38",
"version": "0.3.39",
"description": "Automatic, pluggable form generation",

@@ -5,0 +5,0 @@ "main": "./build/lib/formatic",

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