mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-02 20:37:08 +01:00
feat: introduce stringOrObject & linkMD helpers
This commit is contained in:
33
dist/helpers/generic-helpers.js
vendored
33
dist/helpers/generic-helpers.js
vendored
@ -369,6 +369,18 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
Emit a conditional Markdown link.
|
||||
@method link
|
||||
*/
|
||||
linkMD: function(text, url) {
|
||||
if (url && url.trim()) {
|
||||
return '[' + text + '](' + url + ')';
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
Return the last word of the specified text.
|
||||
@method lastWord
|
||||
@ -527,6 +539,10 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
return options.inverse(this);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
Emit padded text.
|
||||
*/
|
||||
pad: function(stringOrArray, padAmount, unused) {
|
||||
var PAD, ret;
|
||||
stringOrArray = stringOrArray || '';
|
||||
@ -542,6 +558,11 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
Given the name of a skill ("JavaScript" or "HVAC repair"), return the number
|
||||
of years assigned to that skill in the resume.skills.list collection.
|
||||
*/
|
||||
skillYears: function(skill, rez) {
|
||||
var sk;
|
||||
sk = _.find(rez.skills.list, function(sk) {
|
||||
@ -552,6 +573,18 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
} else {
|
||||
return '?';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
Given an object that may be a string or an object, return it as-is if it's a
|
||||
string, otherwise return the value at obj[objPath].
|
||||
*/
|
||||
stringOrObject: function(obj, objPath, rez) {
|
||||
if (_.isString(obj)) {
|
||||
return obj;
|
||||
} else {
|
||||
return LO.get(obj, objPath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user