MVFv3 API Documentation
    Preparing search index...
    • Checks if a flag is set in an object WithFlags.

      First find the NavigationFlagDeclaration using the key, then check a flagged object with this function to see if it's present. You can safely pass an undefined flag (the check will return false). This is useful when trying to use a well-known flag, which may or may not be actually present in the MVF.

      Parameters

      • withFlags: { flags: number[] }

        The WithFlags object to check

      • Optionalflag: { bit: number; index: number } & {
            details?: {
                description?: string;
                externalId?: string;
                icon?: string;
                name?: string;
                shortName?: string;
            };
        }

        The flag to check for

        • bit: number

          The bit position of the flag in a flag's bitfield. ie, 0 means the first bit, 1 means the second bit, etc. A flag bitfield with that bit set to 1 means the flag is present. Other than for Well Known Flags, this is not expected to be durable across different versions of the same MVF.

        • index: number

          The index of the flag in a flags array. ie, 0 means the first bitfield, 1 means the second bitfield, etc.

        • Optionaldetails?: {
              description?: string;
              externalId?: string;
              icon?: string;
              name?: string;
              shortName?: string;
          }

          {@inheritDoc utility-types/details!Details}

      Returns undefined | boolean

      true if the flag is set, false otherwise

      const obj: WithFlags = { flags: [1] };
      const flag: NavigationFlagDeclaration = { index: 0, bit: 0 };
      const hasAccessible = hasFlag(obj, flag); // true