github.com/manicqin/nomad@v0.9.5/ui/app/utils/classes/text-decoder.js (about)

     1  // This is a very incomplete polyfill for TextDecoder used only
     2  // by browsers that don't provide one but still provide a ReadableStream
     3  // interface for fetch.
     4  
     5  // A complete polyfill exists if this becomes problematic:
     6  // https://github.com/inexorabletash/text-encoding
     7  export default window.TextDecoder ||
     8    function() {
     9      this.decode = function(value) {
    10        let text = '';
    11        for (let i = 3; i < value.byteLength; i++) {
    12          text += String.fromCharCode(value[i]);
    13        }
    14        return text;
    15      };
    16    };