2016-02-14 09:10:23 +00:00
|
|
|
(function() {
|
2018-02-12 05:05:29 +00:00
|
|
|
/**
|
|
|
|
Block helper definitions for HackMyResume / FluentCV.
|
|
|
|
@license MIT. See LICENSE.md for details.
|
|
|
|
@module helpers/generic-helpers
|
|
|
|
*/
|
|
|
|
/** Block helper function definitions. */
|
2016-02-14 09:10:23 +00:00
|
|
|
var BlockHelpers, HMSTATUS, LO, _, unused;
|
|
|
|
|
|
|
|
HMSTATUS = require('../core/status-codes');
|
|
|
|
|
|
|
|
LO = require('lodash');
|
|
|
|
|
|
|
|
_ = require('underscore');
|
|
|
|
|
|
|
|
unused = require('../utils/string');
|
|
|
|
|
|
|
|
BlockHelpers = module.exports = {
|
|
|
|
/**
|
|
|
|
Emit the enclosed content if the resume has a section with
|
|
|
|
the specified name. Otherwise, emit an empty string ''.
|
2018-02-12 05:05:29 +00:00
|
|
|
*/
|
2016-02-14 09:10:23 +00:00
|
|
|
section: function(title, options) {
|
|
|
|
var obj, ret;
|
|
|
|
title = title.trim().toLowerCase();
|
|
|
|
obj = LO.get(this.r, title);
|
|
|
|
ret = '';
|
|
|
|
if (obj) {
|
|
|
|
if (_.isArray(obj)) {
|
|
|
|
if (obj.length) {
|
|
|
|
ret = options.fn(this);
|
|
|
|
}
|
|
|
|
} else if (_.isObject(obj)) {
|
|
|
|
if ((obj.history && obj.history.length) || (obj.sets && obj.sets.length)) {
|
|
|
|
ret = options.fn(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
},
|
2018-02-07 10:55:27 +00:00
|
|
|
ifHasSkill: function(rez, skill, options) {
|
|
|
|
var ret, skUp;
|
|
|
|
skUp = skill.toUpperCase();
|
|
|
|
ret = _.some(rez.skills.list, function(sk) {
|
|
|
|
return (skUp.toUpperCase() === sk.name.toUpperCase()) && sk.years;
|
|
|
|
}, this);
|
|
|
|
if (ret) {
|
|
|
|
return options.fn(this);
|
|
|
|
}
|
|
|
|
},
|
2016-02-14 09:10:23 +00:00
|
|
|
/**
|
|
|
|
Emit the enclosed content if the resume has the named
|
|
|
|
property or subproperty.
|
2018-02-12 05:05:29 +00:00
|
|
|
*/
|
2016-02-14 09:10:23 +00:00
|
|
|
has: function(title, options) {
|
|
|
|
title = title && title.trim().toLowerCase();
|
|
|
|
if (LO.get(this.r, title)) {
|
|
|
|
return options.fn(this);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
Return true if either value is truthy.
|
|
|
|
@method either
|
2018-02-12 05:05:29 +00:00
|
|
|
*/
|
2016-02-14 09:10:23 +00:00
|
|
|
either: function(lhs, rhs, options) {
|
|
|
|
if (lhs || rhs) {
|
|
|
|
return options.fn(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}).call(this);
|
|
|
|
|
|
|
|
//# sourceMappingURL=block-helpers.js.map
|