function parsePairs(doc, cst) {
    const seq = (0, _parseSeq.default)(doc, cst);

    for (let i = 0; i < seq.items.length; ++i) {
      let item = seq.items[i];
      if (item instanceof _Pair.default) continue;else if (item instanceof _Map$1.default) {
        if (item.items.length > 1) {
          const msg = 'Each pair must have its own sequence indicator';
          throw new errors.YAMLSemanticError(cst, msg);
        }

        const pair = item.items[0] || new _Pair.default();
        if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore;
        if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment;
        item = pair;
      }
      seq.items[i] = item instanceof _Pair.default ? item : new _Pair.default(item);
    }

    return seq;
  }
Returns a Buffer in node and an Uint8Array in browsers

To use the resulting buffer as an image, you'll want to do something like:

  const blob = new Blob([buffer], { type: 'image/jpeg' })
  document.querySelector('#photo').src = URL.createObjectURL(blob)