mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Add jsdocs to fp build modules.
This commit is contained in:
@@ -18,16 +18,29 @@ var templateData = {
|
||||
'toFuncList': toFuncList
|
||||
};
|
||||
|
||||
function toArgOrder(array) {
|
||||
/**
|
||||
* Converts arranged argument `indexes` into a named argument string
|
||||
* representation of their order.
|
||||
*
|
||||
* @param {number[]} indexes The arranged argument indexes.
|
||||
* @returns {string} Returns the named argument string.
|
||||
*/
|
||||
function toArgOrder(indexes) {
|
||||
var reordered = [];
|
||||
_.each(array, function(newIndex, index) {
|
||||
_.each(indexes, function(newIndex, index) {
|
||||
reordered[newIndex] = argNames[index];
|
||||
});
|
||||
return '`(' + reordered.join(', ') + ')`';
|
||||
}
|
||||
|
||||
function toFuncList(array) {
|
||||
var chunks = _.chunk(array.slice().sort(), 5),
|
||||
/**
|
||||
* Converts `funcNames` into a backticked chunked list string representation.
|
||||
*
|
||||
* @param {string[]} funcNames The function names.
|
||||
* @returns {string} Returns the function list string.
|
||||
*/
|
||||
function toFuncList(funcNames) {
|
||||
var chunks = _.chunk(funcNames.slice().sort(), 5),
|
||||
lastChunk = _.last(chunks),
|
||||
last = lastChunk ? lastChunk.pop() : undefined;
|
||||
|
||||
@@ -51,12 +64,22 @@ function toFuncList(array) {
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A no-frills callback that throws any error it receives.
|
||||
*
|
||||
* @param {Object} [error] The error object.
|
||||
*/
|
||||
function onComplete(error) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the FP-Guide wiki at the `target` path.
|
||||
*
|
||||
* @param {string} target The output file path.
|
||||
*/
|
||||
function build(target) {
|
||||
target = path.resolve(target);
|
||||
fs.writeFile(target, template.wiki(templateData), onComplete);
|
||||
|
||||
Reference in New Issue
Block a user