import { MIN_HEX_LENGTH, MAX_HEX_LENGTH } from './consts.js';

function correctHex(hex) {
  if (!hex || hex.length < MIN_HEX_LENGTH) {
    return "ffffff";
  }
  if (hex.length >= MAX_HEX_LENGTH) {
    return hex.substring(0, MAX_HEX_LENGTH);
  }
  return hex.substring(0, MIN_HEX_LENGTH);
}

export { correctHex };
