code: function enumeration(name, type, ...constants) {
    if (name[TYPICAL_TYPE]) {
      constants.unshift(type);
      type = name;
      name = `Some${type.name}Enum`;
    }
  
    /* istanbul ignore else */
    if (__DEV__) {
      assert(typeof name === 'string', `enum()'s name must be a string`);
      assert(type[TYPICAL_TYPE], `enum()'s type must be a type`);
      for (const constant of constants) {
        assert(type.is(constant), `enum()'s constant must have given type`);
      }
    }
  
    const api = this;
  
    function Enumeration(value, context) {
      if (Context.isRequired(context)) {
        return Context.with(value, Enumeration, context, api);
      }
  
      // All constants are guaranteed to have base type. See above.
      for (const constant of constants) {
        if (is(constant, value)) {
          return context.toValue(value, Enumeration);
        }
      }
      return context.valueIsNotOfType(value, Enumeration);
    }
  
    return decorate(Enumeration, name, enumeration, type, ...constants);
  }
docs: /* --------------------------------------------------------------------------------