Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
let conformedValue = value;
const {
guide, placeholderChar, placeholder, currentCaretPosition,
showMask, keepCharPositions,
} = props;
const conformToMaskConfig = {
previousPlaceholder: placeholder,
guide,
placeholderChar,
pipe,
currentCaretPosition,
keepCharPositions,
};
const conformed = conformToMask(safeValue, mask, conformToMaskConfig);
if (conformed) {
({ conformedValue } = conformed);
}
if (typeof pipe === 'function') {
const pipeResults = pipe(conformedValue, { rawValue: safeValue, ...conformToMaskConfig });
if (typeof pipeResults === 'string') {
conformedValue = pipeResults;
}
}
if (conformedValue === placeholder) {
conformedValue = showMask ? placeholder : '';
}
return conformedValue;
};