akdubya / dustjs

Asynchronous templates for the browser and node.js
http://akdubya.github.com/dustjs/
MIT License
1.44k stars 131 forks source link

Testing `foo instanceof Context` is fugly #52

Open soci-viii opened 12 years ago

soci-viii commented 12 years ago

I've been using foo instanceof dust.makeBase({}).constructor: that seems clunky. I'd like a way to get the constructor directly, without having to instantiate an object: foo instanceof dust.Context.

Eliminating makeBase() altogether might also belong on the table here? Swapping the stack and global arguments would make Context operate very much like makeBase does now. Further, no external code at present relies on Context() directly; the only change required would be adding a couple null or undefined leading parameters in dust.js proper.

soci-viii commented 12 years ago

I've posted commits for both resolutions. Thanks for your consideration. https://github.com/socialtables/dustjs/commit/342d99cf3c90c92ca5d4dcc43782b7a900419a3f https://github.com/socialtables/dustjs/commit/f00b69595f62e4c71627f6bb4e6a879272af4eec

The second has a pull request you are welcome to take if the change pleases you: https://github.com/akdubya/dustjs/pull/53