BC-DCBOR-Parse TypeScript Library - v1.0.0-alpha.20
    Preparing search index...

    Function composeDcborMap

    • Composes a dCBOR map from a slice of string slices, and returns a CBOR object representing the map.

      The length of the slice must be even, as each key must have a corresponding value.

      Each string slice is parsed as a dCBOR item.

      Parameters

      • array: readonly string[]

        Array of strings representing key-value pairs in alternating order

      Returns ComposeResult<Cbor>

      A CBOR map containing all parsed key-value pairs

      const result = composeDcborMap(["1", "2", "3", "4"]);
      if (result.ok) {
      console.log(result.value.toDiagnostic()); // "{1: 2, 3: 4}"
      }