9 lines
188 B
JavaScript
9 lines
188 B
JavaScript
|
// @flow
|
||
|
const HEX_REGEX = /([0-9]|[a-f])/gim;
|
||
|
|
||
|
export const isHex = (input: ?string) => {
|
||
|
if (!input) return false;
|
||
|
|
||
|
return (input.match(HEX_REGEX) || []).length === input.length;
|
||
|
};
|