0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

move callIfExists to base file scope

This commit is contained in:
Charlie Humphreys
2022-12-05 22:39:38 -06:00
parent 208593d203
commit 4e2f6b1d26

View File

@@ -15,6 +15,12 @@ const SYSTEMS = ['5e', '4e', '3.5e', 'Pathfinder'];
const homebreweryThumbnail = require('../../thumbnail.png');
const callIfExists = (val, fn, ...args)=>{
if(val[fn]) {
val[fn](...args);
}
};
const MetadataEditor = createClass({
displayName : 'MetadataEditor',
getDefaultProps : function() {
@@ -53,12 +59,6 @@ const MetadataEditor = createClass({
},
handleFieldChange : function(name, e){
const callIfExists = (val, fn, ...args)=>{
if(val[fn]) {
val[fn](...args);
}
};
callIfExists(e, 'persist');
// load validation rules, and check input value against them