/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

//#region src/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js
/**
* Copyright IBM Corp. 2022, 2022
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const getCellIdAsObject = (oldId) => {
	const updatedOldValuesArray = oldId.split("-").map((item) => {
		if (isNaN(item)) return item;
		return Number(item);
	});
	const indexArray = updatedOldValuesArray.filter(Number.isFinite);
	const keyArray = updatedOldValuesArray.filter((item) => typeof item === "string");
	const activeCellCoords = {};
	keyArray.forEach((element, index) => {
		activeCellCoords[element] = indexArray[index];
	});
	return activeCellCoords;
};
//#endregion
exports.getCellIdAsObject = getCellIdAsObject;
