declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
19 lines • 810 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.createGetVariables = void 0;
const UnexpectedCodePathError_1 = require("../../UnexpectedCodePathError");
/**
* createGetVariables creates a function which you can use to access project variables in your check functions
*/
const createGetVariables = (example) => {
return (context) => {
if (!context.projectVariables) {
if (process.env.NODE_ENV === 'test')
return example;
throw new UnexpectedCodePathError_1.UnexpectedCodePathError('project variables were not defined on context and it is not a test environment');
}
return context.projectVariables;
};
};
exports.createGetVariables = createGetVariables;
//# sourceMappingURL=createGetVariables.js.map
;