export const findidx : Function = (arr : any, val : any) => {
	return arr.findIndex(item => {
		return item.id === val
	})
}

export const intersectionAlike : Function = (objA : any, objB : any) => {
	const result = {};
	for (const keyA in objA) {
		if (objB.hasOwnProperty(keyA)) {
			if (Array.isArray(objB[keyA])) {
				result[keyA] = [...objB[keyA]]; // 使用扩展运算符创建数组的副本
			} else {
				result[keyA] = objB[keyA];
			}
		}
	}
	return result;
}



export const hasValue : Function = (obj : any) => {
	let result = '';
	result = Object.keys(obj).filter(key => obj[key] !== 0).map(key => `${obj[key]}`).join('')
	return result;
}


export const divObj : Function = (obj : any) => {
	const result = []
	obj.reduce((acc, curr, index) => {
		curr.idx = index;
		result.push(curr)
		// const key = `node${index}Info`;
		// acc[key] = curr;
		// return acc;
	}, {});

	return result;
}



export const alreadyValue : Function = (obj : any) => {
	const result = []
	obj.reduce((acc, curr, index) => {
		curr.idx = index;
		result.push(curr)
		// const key = `node${index}Info`;
		// acc[key] = curr;
		// return acc;
	}, {});

	return result;
}