code: function pluginate(transform, state) {
  
     return through.obj((file, encoding, done) => {
  
        // Nothing to transform.
        if (file.isNull() || state.error) {
           done(null, file)
           return
        }
  
        // Transform function returns a vinyl file or file contents (in form of a
        // stream, a buffer or a string), or a promise which resolves with those.
        new Promise((resolve, reject) => {
           try {
              resolve(transform(file.contents, file))
           }
           catch (e) {
              reject(e)
           }
        }).then((result) => {
           if (!Vinyl.isVinyl(result)) {
              if (result instanceof Buffer)
                 file.contents = result
              else if (typeof result === "string")
                 file.contents = Buffer.from(result)
              else
                 throw new Error("Transforms must return/resolve with a file, a buffer or a string.")
           }
        }).catch((e) => {
           console.error(e)
           state.error = true
        }).then(() => {
           done(null, file)
        })
  
     })
  
  }
docs: Convert a string transform function into a stream.