@grafctory/blue - v0.17.0
    Preparing search index...

    Function dictionary

    • Creates a dictionary shape.

      Contradictory constraints are rejected as the shape is built, so a shape that exists admits at least one value.

      Type Parameters

      Parameters

      • content: StringShape<string, undefined>

        The shape every string is held to, stating no datatype of its own

      • Optionalconstraints: C

        Optional shape constraints

      Returns DictionaryConstraints & {
          kind: "dictionary";
          content: StringShape<string, undefined>;
      } & { uniqueLang: C["uniqueLang"] }

      An immutable shape admitting the language maps whose text matches content and which the constraints bound, carrying a single string per tag where they state uniqueLang

      • Readonlykind: "dictionary"

        Discriminator identifying this as a dictionary shape.

        Inheritance — cannot be overridden.

      • Readonlycontent: StringShape<string, undefined>

        The shape every string is held to, whatever tag it is stated under.

        Admits the string shapes stating no datatype, such as string(), text() and markdown(). Localised text is typed as an RDF language-tagged string, so a shape fixing a datatype of its own, like date() or email(), has no localised form.

        Length, pattern and enumeration constraints hold for each string separately, so an entry is held to them whatever language it is stated in. Required values are matched across the strings of every map, under any tag.

        Inheritance — merged under the string!StringShape inheritance rules.

      • ReadonlyuniqueLang: C["uniqueLang"]

        Restricts every tag to a single string, exactly as stated.

        Carries the constraint at the value it was given rather than at the whole boolean domain, so that the content of a tag is typed at the arity the shape admits.

      TraceError Where the stated constraints contradict one another

      const label = required(dictionary(text(), { uniqueLang: true }));
      const description = optional(dictionary(markdown(), { languageIn: ["en", "it"] }));
      const keywords = multiple(dictionary(text(), { languageIn: ["en"] }));