lib/parsers/text.js
function parseText (file) {
    if (typeof file.data === "string") {
      return file.data;
    }
    else if (Buffer.isBuffer(file.data)) {
      return file.data.toString(this.encoding);
    }
    else {
      throw new Error("data is not text");
    }
  }
function parseText (file) {
    if (typeof file.data === "string") {
      return file.data;
    }
    else if (Buffer.isBuffer(file.data)) {
      return file.data.toString(this.encoding);
    }
    else {
      throw new Error("data is not text");
    }
  }
function parseText ( file ) { if ( typeof file . data === "string" ) { return file . data ; } else if ( Buffer . isBuffer ( file . data ) ) { return file . data . toString ( this . encoding ) ; } else { throw new Error ( "data is not text" ) ; } }
Parses the given file as text

@param {object} file           - An object containing information about the referenced file
@param {string} file.url       - The full URL of the referenced file
@param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.)
@param {*}      file.data      - The file contents. This will be whatever data type was returned by the resolver
@returns {Promise<string>}
Parses the given file as text