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

    Function tagsForValues

    • Converts an array of tag values to their corresponding Tag objects. Matches Rust's tags_for_values() function.

      This function looks up each tag value in the global tag registry and returns an array of complete Tag objects. For any tag values that aren't registered in the global registry, it creates a basic Tag with just the value (no name).

      Parameters

      • values: (number | bigint)[]

        Array of numeric tag values to convert

      Returns Tag[]

      Array of Tag objects corresponding to the input values

      // Register some tags first
      registerTags();

      // Convert tag values to Tag objects
      const tags = tagsForValues([1, 42, 999]);

      // The first tag (value 1) should be registered as "date"
      console.log(tags[0].value); // 1
      console.log(tags[0].name); // "date"

      // Unregistered tags will have a value but no name
      console.log(tags[1].value); // 42
      console.log(tags[2].value); // 999