function sort (array, path, direction) {
  const parsedPath = path && path !== '.' ? parsePath(path) : []
  const sign = direction === 'desc' ? -1 : 1

  const sortedArray = array.slice()
  sortedArray.sort((a, b) => {
    const aValue = get(a, parsedPath)
    const bValue = get(b, parsedPath)

    return sign * (aValue > bValue ? 1 : aValue < bValue ? -1 : 0)
  })

  return sortedArray
}
Sort object keys using natural sort
@param {Array} array
@param {String} [path] JSON pointer
@param {'asc' | 'desc'} [direction]