woocommerce/plugins/woocommerce-blocks/bin/hook-docs/utilities/generate-hook-name.js

17 lines
321 B
JavaScript
Raw Normal View History

const generateHookName = ( hook ) => {
const hookName = hook.name;
const tags = hook.doc.tags || [];
const isDeprecated = tags.find(
( { name: tagName } ) => tagName === 'deprecated'
);
return [
{
h2: isDeprecated ? `~~${ hookName }~~` : `${ hookName }`,
},
];
};
module.exports = { generateHookName };