github.com/hernad/nomad@v1.6.112/ui/mirage/data/logs.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  export const logFrames = [
     7    'hello world\n',
     8    'some more output\ngoes here\n\n--> potentially helpful',
     9    ' hopefully, at least.\n',
    10  ];
    11  
    12  export const logEncode = (frames, index) => {
    13    return frames
    14      .slice(0, index + 1)
    15      .map(frame => window.btoa(frame))
    16      .map((frame, innerIndex) => {
    17        const offset = frames.slice(0, innerIndex).reduce((sum, frame) => sum + frame.length, 0);
    18        return JSON.stringify({ Offset: offset, Data: frame });
    19      })
    20      .join('');
    21  };