apps.websight-package-manager.web-resources.utils.CommonUtils.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of websight-package-manager-view Show documentation
Show all versions of websight-package-manager-view Show documentation
Package Manager View module is responsible for view part of Package Manager.
The newest version!
export const reorderCollection = (list, sourceIndex, destinationIndex) => {
const result = Array.from(list);
const [removed] = result.splice(sourceIndex, 1);
result.splice(destinationIndex, 0, removed);
return result;
};
export const getOptionByValue = (value, options) => {
return (options || []).find(option => option.value === value);
};
export const extendFunction = (toBeExtended, toBeAdded) => {
if (toBeAdded) {
const originalFunction = toBeExtended;
toBeExtended = (...args) => {
originalFunction(...args);
toBeAdded(...args);
};
}
return toBeExtended;
};