woocommerce/plugins/woocommerce-blocks/bin/hook-docs/format-hook-doc/related.js

16 lines
363 B
JavaScript

const related = ( hookDoc ) => {
const tags = hookDoc.tags || [];
const seeDocs =
tags.filter( ( { name: tagName } ) => tagName === 'see' ) || [];
return seeDocs && seeDocs.length
? {
ul: seeDocs.map( ( { refers, content = '' } ) => {
return content ? refers + ' - ' + content : refers;
} ),
}
: null;
};
module.exports = { related };