fatsify核心功能示例测试!!!

This commit is contained in:
2025-09-21 14:50:41 +08:00
commit 9145aea047
1958 changed files with 230098 additions and 0 deletions

34
node_modules/avvio/lib/get-plugin-name.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
'use strict'
// this symbol is assigned by fastify-plugin
const { kPluginMeta } = require('./symbols')
/**
* @param {function} plugin
* @param {object} [options]
* @param {string} [options.name]
* @returns {string}
*/
function getPluginName (plugin, options) {
// use explicit function metadata if set
if (plugin[kPluginMeta] && plugin[kPluginMeta].name) {
return plugin[kPluginMeta].name
}
// use explicit name option if set
if (options && options.name) {
return options.name
}
// determine from the function
if (plugin.name) {
return plugin.name
} else {
// takes the first two lines of the function if nothing else works
return plugin.toString().split('\n').slice(0, 2).map(s => s.trim()).join(' -- ')
}
}
module.exports = {
getPluginName
}