UNPKG

convert2base

Version:

Project developed to perform basic binary conversions involving binary, octal, decimal and hexadecimal numbers.

8 lines (7 loc) 247 B
export const validateOctalNumber = (octalNumber: string) => { if (!/^[0-7]+$/.test(octalNumber)) { throw new Error( 'The provided octal number is invalid. Make sure it contains only digits from 0 to 7.' ); } };