function hasDuplicateChild (flatState, k) {
  const keyList = Object.keys(flatState)
  let hasDuplicateChild = false
  let duplicateCount = 0
  for (let j = 0 ; j < keyList.length ; j++) {
    const currentKey = keyList[j]
    const splitKey = currentKey.split('.')
    if (splitKey[splitKey.length -1] === k) {
      duplicateCount += 1
      if (duplicateCount > 1) {
        hasDuplicateChild = true
      }
    }
  }
  return hasDuplicateChild
}
/*
 * Function to check if a given key has a duplicate child in the object
 * @param flatState - An object representing the partially flattened state
 * @param k - Key to check
 * @return {boolean}
 */
Function to check if a given key has a duplicate child in the object
@param flatState - An object representing the partially flattened state
@param k - Key to check
@return {boolean}
Function to check if a given key has a duplicate child in the object @param flatState - An object representing the partially flattened state @param k - Key to check @return { boolean }
function hasDuplicateChild (flatState, k) {
  const keyList = Object.keys(flatState)
  let hasDuplicateChild = false
  let duplicateCount = 0
  for (let j = 0 ; j < keyList.length ; j++) {
    const currentKey = keyList[j]
    const splitKey = currentKey.split('.')
    if (splitKey[splitKey.length -1] === k) {
      duplicateCount += 1
      if (duplicateCount > 1) {
        hasDuplicateChild = true
      }
    }
  }
  return hasDuplicateChild
}
function hasDuplicateChild ( flatState , k ) { const keyList = Object . keys ( flatState ) let hasDuplicateChild = false let duplicateCount = 0 for ( let j = 0 ; j < keyList . length ; j ++ ) { const currentKey = keyList [ j ] const splitKey = currentKey . split ( '.' ) if ( splitKey [ splitKey . length - 1 ] === k ) { duplicateCount += 1 if ( duplicateCount > 1 ) { hasDuplicateChild = true } } } return hasDuplicateChild }
Function to check if a given key has a duplicate child in the object
 @param flatState - An object representing the partially flattened state
 @param k - Key to check
 @return {boolean}
Function to check if a given key has a duplicate child in the object @param flatState - An object representing the partially flattened state @param k - Key to check @return { boolean }