Skip to content

Commit

Permalink
fix: trasnsform arguments to array before override
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Antico committed Jul 30, 2017
1 parent 73c9c83 commit 2adfe2e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var strRepeat = function (str, times) {
};

// Used to translate require macros to override arguments
var objExtend = function (args, obj) {var _a = args.slice(1); _a.unshift(Object.assign(obj, args[0])); return _a;};
var objExtend = function (args, obj) {args = Array.prototype.slice.call(args);var _a = args.slice(1); _a.unshift(Object.assign(obj, args[0])); return _a;};

// Default macros
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion test/templates/output/require_with_args.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function(obj){
var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
with(obj||{}){
__p+='Hello, ' + require("./bar.html").apply(null,(function (args, obj) {var _a = args.slice(1); _a.unshift(Object.assign(obj, args[0])); return _a;})(arguments, {"name":"emma","role":"dev"})) + '\n';
__p+='Hello, ' + require("./bar.html").apply(null,(function (args, obj) {args = Array.prototype.slice.call(args);var _a = args.slice(1); _a.unshift(Object.assign(obj, args[0])); return _a;})(arguments, {"name":"emma","role":"dev"})) + '\n';
}
return __p;
};

0 comments on commit 2adfe2e

Please sign in to comment.