UNPKG

id-card-helper

Version:
29 lines (25 loc) 505 B
class Formater { static get Error() { return { Empty: 'NotAllowedEmpty', }; } check(idCode) { try { /* is id empty? */ if (Formater.isEmpty(idCode)) { throw new Error(Formater.Error.Empty); } } catch (e) { throw e; } return true; } static isEmpty(idCode) { if (idCode === '') return true; if (idCode === null) return true; if (typeof idCode !== 'string') return true; return false; } } export default Formater;