@intlayer/core
Version:
Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.
20 lines • 537 B
JavaScript
import { getIntlayer } from "./getIntlayer.mjs";
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;
};
export {
getNesting
};
//# sourceMappingURL=getNesting.mjs.map