9 Star 11 Fork 1

Franklin_Zhang/GeoModelServiceContainer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
load_dir.js 682 Bytes
一键复制 编辑 原始数据 按行查看 历史
chen7bin 提交于 2022-03-29 23:15 . 3/29 add mongodb data to nedb
/**
* Dynamically load module files under the specified folder without recursion
* Created by qingbin on 2022/3/29.
*/
var fs = require('fs');
var path = require('path');
var load = function(path, name) {
if (name) {
return require(path + name);
}
return require(path)
};
module.exports = function (dir) {
patcher = {}
fs.readdirSync(__dirname + '/' + dir).forEach(function (filename) {
if (!/\.js$/.test(filename)) {
return;
}
var name = path.basename(filename, '.js');
var _load = load.bind(null, './' + dir + '/', name);
patcher.__defineGetter__(name, _load);
});
return patcher;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/geomodeling/GeoModelServiceContainer.git
git@gitee.com:geomodeling/GeoModelServiceContainer.git
geomodeling
GeoModelServiceContainer
GeoModelServiceContainer
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385