code: function enumIndex(value) {
    if (isBool(value)) {
      if (boolFromValue(value)) {
        return 1;
      } else {
        return 0;
      }
    } else if (isColor(value)) {
      return toEnum(colorEnum(), colorFromValue(value));
    } else if (isDir(value)) {
      return toEnum(dirEnum(), dirFromValue(value));
    } else {
      throw Error('Value should be Bool, Color or Dir.');
    }
  }
docs: /* Generic operations