feat(ai-code-review): 新增 AI 程式碼審查主程式、模組與測試

This commit is contained in:
Jeffery
2026-07-02 16:09:12 +08:00
parent 18314b88a3
commit f46dfe6258
448 changed files with 78568 additions and 16 deletions
+34
View File
@@ -0,0 +1,34 @@
var defer = require('./defer.js');
// API
module.exports = async;
/**
* Runs provided callback asynchronously
* even if callback itself is not
*
* @param {function} callback - callback to invoke
* @returns {function} - augmented callback
*/
function async(callback)
{
var isAsync = false;
// check if async happened
defer(function() { isAsync = true; });
return function async_callback(err, result)
{
if (isAsync)
{
callback(err, result);
}
else
{
defer(function nextTick_callback()
{
callback(err, result);
});
}
};
}