@svta/common-media-library
    Preparing search index...

    Function appendCmcdQuery

    • Beta

      Append CMCD query args to a URL.

      Parameters

      • url: string

        The URL to append to.

      • cmcd: Cmcd

        The CMCD object to append.

      • Optionaloptions: CmcdEncodeOptions

        Options for encoding the CMCD object.

      Returns string

      The URL with the CMCD query args appended.

      const url = 'https://test.com';
      const data = {
      br: 1000,
      };

      equal(appendCmcdQuery(url, data), `${url}?CMCD=br%3D1000`);
      equal(appendCmcdQuery(`${url}?hello=world`, data), `${url}?hello=world&CMCD=br%3D1000`);