This is a modified version of browserify-string. Basically it is pull request #5.
browserify = require 'browserify'
path = require 'path'
{Readable} = require 'stream'
module.exports = ( str, opts ) ->
if typeof str is 'function'
str = [
'('
str.toString()
')();'
].join '\n'
opts.basedir ?= process.cwd()
stream = new Readable()
stream.push str
stream.push null
browserify stream, opts