1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-22 16:30:11 +00:00

Fix issue with undefined sections.

Fixes #127.
This commit is contained in:
hacksalot 2016-01-29 15:50:21 -05:00
parent 0f65e4c9f3
commit 896b7055c1
2 changed files with 21 additions and 14 deletions

View File

@ -108,18 +108,22 @@ Generic template helper definitions for HackMyResume / FluentCV.
@method section @method section
*/ */
section: function(title, options) { section: function(title, options) {
var obj; var obj, ret;
title = title.trim().toLowerCase(); title = title.trim().toLowerCase();
obj = LO.get(this.r, title); obj = LO.get(this.r, title);
if (_.isArray(obj)) { ret = '';
if (obj.length) { if (obj) {
return options.fn(this); if (_.isArray(obj)) {
} else { if (obj.length) {
return void 0; ret = options.fn(this);
}
} else if (_.isObject(obj)) {
if ((obj.history && obj.history.length) || (obj.sets && obj.sets.length)) {
ret = options.fn(this);
}
} }
} else if (_.isObject(obj)) {
return (obj.history && obj.history.length) || (obj.sets && obj.sets.length ? options.fn(this) : void 0);
} }
return ret;
}, },
/** /**

View File

@ -74,12 +74,15 @@ GenericHelpers = module.exports =
section: ( title, options ) -> section: ( title, options ) ->
title = title.trim().toLowerCase() title = title.trim().toLowerCase()
obj = LO.get this.r, title obj = LO.get this.r, title
if _.isArray obj ret = ''
return if obj.length then options.fn(this) else undefined; if obj
else if _.isObject obj if _.isArray obj
return (obj.history && obj.history.length) || if obj.length
if ( obj.sets && obj.sets.length ) ret = options.fn @
then options.fn(this) else undefined else if _.isObject obj
if (obj.history && obj.history.length) || (obj.sets && obj.sets.length)
ret = options.fn @
ret
###* ###*
Emit the size of the specified named font. Emit the size of the specified named font.