diff --git a/.jshintrc b/.jshintrc index c862aec..e66f0ed 100644 --- a/.jshintrc +++ b/.jshintrc @@ -16,7 +16,8 @@ "dust": true, "require": true, "module": true, + "define": true, "console": true, "__dirname": true } -} \ No newline at end of file +} diff --git a/lib/dust-helpers.js b/lib/dust-helpers.js index 304f968..15cbc9c 100644 --- a/lib/dust-helpers.js +++ b/lib/dust-helpers.js @@ -1,4 +1,12 @@ -(function(dust){ +(function(root, factory) { + if (typeof define === 'function' && define.amd && define.amd.dust === true) { + define(['dust.core'], factory); + } else if (typeof exports === 'object') { + module.exports = factory(require('dustjs-linkedin')); + } else { + factory(root.dust); + } +}(this, function(dust) { // Use dust's built-in logging when available var _log = dust.log ? function(msg, level) { @@ -611,12 +619,10 @@ var helpers = { }; - for (var key in helpers) { + for(var key in helpers) { dust.helpers[key] = helpers[key]; } - if(typeof exports !== 'undefined') { - module.exports = dust; - } + return dust; -})(typeof exports !== 'undefined' ? require('dustjs-linkedin') : dust); +}));