@senzil/cec-monitor
Version:
HDMI-CEC library with a simple monitor written on ES6 to make cec enabled apps.
25 lines (22 loc) • 653 B
JavaScript
/**
* Created by pablo on 9/22/17.
*/
export default class Validate {
/**
* Determine if provided string matches a CEC physical address
* @param {String} address Address to test
* @return {Boolean} True if it matches form 0.0.0.0 otherwise false
*/
static isRoute(address) {
return /^\d\.\d\.\d\.\d$/gui.test(address)
}
/**
* Determine if provided string matches a hexadecimal number representation
* @param {String} address Address to test
* @return {Boolean} True if it matches form 0.0.0.0 otherwise false
*/
static isHexaNumber(address) {
return /^0[xX][\da-fA-F]+$/giu.test(address)
}
}