1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-21 01:39:04 +02:00
video.js/build/jsdoc-typeof-plugin.js
Grzegorz Blaszczyk 2e96253632
fix: Improves types for registerPlugin and getPlugin (#8058)
* fix: improves types for registerPlugin and getPlugin

* fix: corrects parameter type for registerPlugin

* docs(fix): add support for {typeof class} expression

* chore: move js-doc-typeof-plugin to build dir
2023-01-24 22:07:30 +01:00

13 lines
414 B
JavaScript

/**
* The jsdoc plugin that will convert types like {typeof ClassName} into {Class<ClassName>}
*/
exports.handlers = {
jsdocCommentFound: event => {
event.comment = (event.comment || '').replace(/\{.*typeof\s+([^\s\|]+).*\}/g, typeExpression => {
return typeExpression.replace(/typeof\s+([^\s\|\}]+)/g, (expression, className) => {
return 'Class<' + className + '>';
});
});
}
};