helper.js 672 B

1234567891011121314151617181920212223
  1. /**
  2. * @Author HonorLee (dev@honorlee.me)
  3. * @Version 1.0 (2018-05-04)
  4. * @License MIT
  5. */
  6. module.exports = {
  7. __construct:function(){
  8. global.H = function(healperName){
  9. if(!healperName){
  10. LOGGER.error('Helper name undefined!!');
  11. return null
  12. }
  13. healperName = healperName.toLowerCase();
  14. try{
  15. FILE.statSync(Core.Path.Helper + '/'+healperName+'.js');
  16. }catch(e){
  17. LOGGER.error('No such helper ['+healperName+']');
  18. return null;
  19. }
  20. return require(Core.Path.Helper + '/'+healperName+'.js');
  21. }
  22. }
  23. }