@inkline/inkline
Version:
Inkline is the Vue.js UI/UX Library built for creating your next design system
15 lines • 418 B
JavaScript
import { getValueByPath } from './valueByPath.mjs';
/**
* Sort an array of objects by path
*
* @param path
* @returns {function(*=, *=): number}
*/
export function sortByPath(path) {
return (a, b) => {
return (getValueByPath(a, path) > getValueByPath(b, path))
? 1
: (getValueByPath(a, path) < getValueByPath(b, path)) ? -1 : 0;
};
}
//# sourceMappingURL=sortByPath.mjs.map