mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore(FE-188,193): create convertRowSelectionArrToObj and convertRowSelectionObjToArr helper function
This commit is contained in:
@@ -77,3 +77,23 @@ export function getByPath<T, D = undefined>(
|
||||
|
||||
return cur as D;
|
||||
}
|
||||
|
||||
export const convertRowSelectionArrToObj = (
|
||||
rowSelectionArr: string[] | number[]
|
||||
) => {
|
||||
const result: Record<string | number, boolean> = {};
|
||||
|
||||
rowSelectionArr.forEach((item) => {
|
||||
result[item] = true;
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export const convertRowSelectionObjToArr = (
|
||||
rowSelection: string[] | number[]
|
||||
) => {
|
||||
const result = Object.keys(rowSelection).map(Number);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user