How would one initiate a class from a variable in CoffeScript? in another words:
className = 'Domain'
domain = new className()
should.exist(domain)
'Domain'.should.equal(domain.constructor.name)
How would the line two should look like to satisfy the assertions? Thank You
Edit: The class is declared as following
class Domain
constructor: (obj) ->
for own key, value of obj
@[key] = value
save: (fn) ->
self = @
...
module.exports = Domain
Peter Lyons answer works with a little adjustments to the way our class defined. In short, the solution:
DomainClass = require('./index')
newDomain = new DomainClass({...})