UNPKG

apeman-doc

Version:
32 lines (27 loc) 577 B
/** * @function childrenData */ 'use strict' const path = require('path') /** @lends childrenData */ function childrenData ($children) { if (!$children) { return null } return Object.keys($children).map((key) => { let $child = $children[ key ] return { name: key, get path () { if (typeof $child === 'object') { $child = $child.$src || $child.$cwd } if (!$child) { return null } return path.relative(process.cwd() || '.', $child) } } }) } module.exports = childrenData