MCPcopy Create free account
hub / github.com/decaporg/decap-cms / getChangedProps

Function getChangedProps

packages/decap-cms-widget-code/src/CodeControl.js:23–34  ·  view source on GitHub ↗
(previous, next, keys)

Source from the content-addressed store, hash-verified

21
22// TODO: relocate as a utility function
23function getChangedProps(previous, next, keys) {
24 const propNames = keys || uniq(Object.keys(previous), Object.keys(next));
25 const changedProps = propNames.reduce((acc, prop) => {
26 if (previous[prop] !== next[prop]) {
27 acc[prop] = next[prop];
28 }
29 return acc;
30 }, {});
31 if (!isEmpty(changedProps)) {
32 return changedProps;
33 }
34}
35
36const languages = languageData.map(lang => ({
37 label: lang.label,

Callers 1

updateCodeMirrorPropsFunction · 0.85

Calls 1

isEmptyFunction · 0.85

Tested by

no test coverage detected