From c39f2c9c3781e56e01e8a8f42ec899125ca1f28e Mon Sep 17 00:00:00 2001 From: Igor Hlina Date: Mon, 31 Dec 2012 21:06:55 +0100 Subject: [PATCH] Replace Underscore.js with Lo-Dash --- package.json | 2 +- tasks/jst.js | 2 +- test/expected/amd_wrapper.js | 13 ++++++------- test/expected/jst.js | 13 ++++++------- test/expected/ns_nested.js | 13 ++++++------- test/expected/pretty.js | 2 +- test/expected/pretty_amd.js | 2 +- test/expected/process_content.js | 13 ++++++------- test/expected/uglyfile.js | 11 +++++------ 9 files changed, 33 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 31aef39..f615f84 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "test": "grunt test" }, "dependencies": { - "underscore": "~1.3.3", + "lodash": "~1.0.0", "grunt-lib-contrib": "~0.3.0" }, "devDependencies": { diff --git a/tasks/jst.js b/tasks/jst.js index e589470..22939a5 100644 --- a/tasks/jst.js +++ b/tasks/jst.js @@ -10,7 +10,7 @@ module.exports = function(grunt) { - var _ = require('underscore'); + var _ = require('lodash'); // filename conversion for templates var defaultProcessName = function(name) { return name; }; diff --git a/test/expected/amd_wrapper.js b/test/expected/amd_wrapper.js index ae75be8..9f47f23 100644 --- a/test/expected/amd_wrapper.js +++ b/test/expected/amd_wrapper.js @@ -2,14 +2,13 @@ define(function(){ this["JST"] = this["JST"] || {}; -this["JST"]["test/fixtures/template.html"] = function(obj){ -var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')}; -with(obj||{}){ -__p+=''+ -( title )+ +this["JST"]["test/fixtures/template.html"] = function(obj) { +obj || (obj = {}); +var __t, __p = '', __e = _.escape, __d = obj.obj || obj; +__p += '<head><title>' + +((__t = ( obj.title )) == null ? '' : __t) + ''; -} -return __p; +return __p }; return this["JST"]; diff --git a/test/expected/jst.js b/test/expected/jst.js index cfa694d..a15d3ca 100644 --- a/test/expected/jst.js +++ b/test/expected/jst.js @@ -1,11 +1,10 @@ this["JST"] = this["JST"] || {}; -this["JST"]["test/fixtures/template.html"] = function(obj){ -var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')}; -with(obj||{}){ -__p+=''+ -( title )+ +this["JST"]["test/fixtures/template.html"] = function(obj) { +obj || (obj = {}); +var __t, __p = '', __e = _.escape, __d = obj.obj || obj; +__p += '<head><title>' + +((__t = ( obj.title )) == null ? '' : __t) + ''; -} -return __p; +return __p }; \ No newline at end of file diff --git a/test/expected/ns_nested.js b/test/expected/ns_nested.js index 9ecbd92..f51c8f4 100644 --- a/test/expected/ns_nested.js +++ b/test/expected/ns_nested.js @@ -2,12 +2,11 @@ this["MyApp"] = this["MyApp"] || {}; this["MyApp"]["JST"] = this["MyApp"]["JST"] || {}; this["MyApp"]["JST"]["Main"] = this["MyApp"]["JST"]["Main"] || {}; -this["MyApp"]["JST"]["Main"]["test/fixtures/template.html"] = function(obj){ -var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')}; -with(obj||{}){ -__p+=''+ -( title )+ +this["MyApp"]["JST"]["Main"]["test/fixtures/template.html"] = function(obj) { +obj || (obj = {}); +var __t, __p = '', __e = _.escape, __d = obj.obj || obj; +__p += '<head><title>' + +((__t = ( obj.title )) == null ? '' : __t) + ''; -} -return __p; +return __p }; \ No newline at end of file diff --git a/test/expected/pretty.js b/test/expected/pretty.js index cf23f33..a165cda 100644 --- a/test/expected/pretty.js +++ b/test/expected/pretty.js @@ -1,3 +1,3 @@ this["JST"] = this["JST"] || {}; -this["JST"]["test/fixtures/template.html"] = function(obj){var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};with(obj||{}){__p+=''+( title )+'';}return __p;}; \ No newline at end of file +this["JST"]["test/fixtures/template.html"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape, __d = obj.obj || obj;__p += '' +((__t = ( obj.title )) == null ? '' : __t) +'';return __p}; \ No newline at end of file diff --git a/test/expected/pretty_amd.js b/test/expected/pretty_amd.js index 5896a50..7d4b494 100644 --- a/test/expected/pretty_amd.js +++ b/test/expected/pretty_amd.js @@ -2,7 +2,7 @@ define(function(){ this["JST"] = this["JST"] || {}; - this["JST"]["test/fixtures/template.html"] = function(obj){var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};with(obj||{}){__p+=''+( title )+'';}return __p;}; + this["JST"]["test/fixtures/template.html"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape, __d = obj.obj || obj;__p += '' +((__t = ( obj.title )) == null ? '' : __t) +'';return __p}; return this["JST"]; }); \ No newline at end of file diff --git a/test/expected/process_content.js b/test/expected/process_content.js index b64bedd..941e0ce 100644 --- a/test/expected/process_content.js +++ b/test/expected/process_content.js @@ -1,11 +1,10 @@ this["JST"] = this["JST"] || {}; -this["JST"]["test/fixtures/indent_template.html"] = function(obj){ -var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')}; -with(obj||{}){ -__p+='
\n
\n
\n'+ -( name )+ +this["JST"]["test/fixtures/indent_template.html"] = function(obj) { +obj || (obj = {}); +var __t, __p = '', __e = _.escape, __d = obj.obj || obj; +__p += '
\n
\n
\n' + +((__t = ( obj.name )) == null ? '' : __t) + '\n
\n
\n
'; -} -return __p; +return __p }; \ No newline at end of file diff --git a/test/expected/uglyfile.js b/test/expected/uglyfile.js index 73cb991..1b4bb1c 100644 --- a/test/expected/uglyfile.js +++ b/test/expected/uglyfile.js @@ -1,9 +1,8 @@ this["JST"] = this["JST"] || {}; -this["JST"]["test/fixtures/it's-a-bad-filename.html"] = function(obj){ -var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')}; -with(obj||{}){ -__p+='never name your file like this.'; -} -return __p; +this["JST"]["test/fixtures/it's-a-bad-filename.html"] = function(obj) { +obj || (obj = {}); +var __t, __p = '', __e = _.escape, __d = obj.obj || obj; +__p += 'never name your file like this.'; +return __p }; \ No newline at end of file