"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const actions_core_1 = require("@segment/actions-core");
const MIN_PHONE_NUMBER_CHAR_LENGTH = 7;
function removeNonNumeric(mobileNumber) {
    const numericOnly = mobileNumber.replace(/\D+/g, '');
    if (numericOnly.length < MIN_PHONE_NUMBER_CHAR_LENGTH) {
        throw new actions_core_1.PayloadValidationError('Invalid mobile number value');
    }
    return numericOnly;
}
const checkAndCleanMobileNumber = (mobileNumber) => {
    return removeNonNumeric(mobileNumber);
};
exports.default = checkAndCleanMobileNumber;
//# sourceMappingURL=checkAndCleanMobileNumber.js.map