react-native-mask-text
Version:
A React Native and Expo library to mask text
22 lines (19 loc) • 615 B
JavaScript
import { DIGIT, ALPHA, ALPHANUM } from './constants';
/**
* function addPlaceholder
* @param {string[]} output
* @param {number} index
* @param {string} placeholder
* @returns {string[]}
*/
function addPlaceholder(output, index, placeholder) {
for (let newIndex = index; newIndex < output.length; newIndex++) {
if (output[newIndex] === DIGIT || output[newIndex] === ALPHA || output[newIndex] === ALPHANUM) {
// eslint-disable-next-line no-param-reassign
output[newIndex] = placeholder;
}
}
return output;
}
export default addPlaceholder;
//# sourceMappingURL=addPlaceholder.js.map