@gouvfr-anct/mednum
Version:
✨ Permet de transformer une source de données vers le schéma des lieux de mediation numerique
8 lines (7 loc) • 579 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCleanField = void 0;
const testCleanSelector = (cleanOperation, property) => property != null && new RegExp(cleanOperation.selector, 'u').test(property);
const shouldApplyFix = (cleanOperation, property) => cleanOperation.negate === true ? !testCleanSelector(cleanOperation, property) : testCleanSelector(cleanOperation, property);
const toCleanField = (toFix, cleanOperation) => shouldApplyFix(cleanOperation, toFix) ? cleanOperation.fix(toFix) : toFix;
exports.toCleanField = toCleanField;