@empathyco/x-components
Version:
Empathy X Components
29 lines (27 loc) • 1 kB
JavaScript
/**
* Asserts that the passed options object is valid, providing helpful error messages.
*
* @param options - The options to check if they are valid.
* @public
*/
function assertXPluginOptionsAreValid(options) {
if (!options) {
throw new Error('XPlugin needs to be installed with an options object containing at least an adapter. Please provide a valid object');
}
if (options.adapter == null) {
throw new Error("The options object doesn't seem to have an adapter. Please, create one and pass it through the options object");
}
}
/**
* Generates a getter path string with the module and getter name.
*
* @param moduleName - The module name the getter belongs to.
* @param getterName - The getter name.
* @returns A string representing the getter path.
* @public
*/
function getGetterPath(moduleName, getterName) {
return `x/${moduleName}/${getterName}`;
}
export { assertXPluginOptionsAreValid, getGetterPath };
//# sourceMappingURL=x-plugin.utils.js.map