import { getIntlayer } from "./getIntlayer.mjs";

//#region ../react-intlayer/dist/esm/@intlayer/core/dist/esm/interpreter/getNesting.mjs
/**
* Allow to extract the content of another dictionary.
*
* Usage:
* ```ts
* const content = getNesting("dictionaryKey", "path.to.content");
* // 'Example content'
* ```
*/
const getNesting = (dictionaryKey, path, props) => {
	const dictionary = getIntlayer(dictionaryKey, props?.locale, props?.plugins);
	if (typeof path === "string") {
		const pathArray = path.split(".");
		let current = dictionary;
		for (const key of pathArray) {
			current = current?.[key];
			if (current === void 0) return dictionary;
		}
		return current;
	}
	return dictionary;
};

//#endregion
export { getNesting };
//# sourceMappingURL=getNesting.mjs.map