// @ts-check

/**
 * Extract a value from an object using a path
 *
 * @template T
 *
 * @param {object} object the input object
 * @param {string} path the path to the value in the object
 *
 * @returns {T}
 */
export function extract(object, path) {
	return path.split('.').reduce((acc, elem) => typeof acc[elem] === 'undefined' ? null : acc[elem], object);
}