2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-31 14:25:57 +00:00

src: Load transpiled code for Node 5

References:
  * Bug-Report #297: https://github.com/yagop/node-telegram-bot-api/issues/297
  * Bug-Report-by: @jehy
  * PR  #298: https://github.com/yagop/node-telegram-bot-api/pull/298
  * PR-by: @jehy
This commit is contained in:
Evgeny Bondarenko
2017-03-09 17:17:03 +03:00
committed by Gocho Mugo
parent 607a39ed5e
commit c1fc486225
2 changed files with 8 additions and 8 deletions

View File

@@ -1,12 +1,12 @@
/**
* If running on Nodejs 4.x and below, we load the transpiled code.
* If running on Nodejs 5.x and below, we load the transpiled code.
* Otherwise, we use the ES6 code.
* We are deprecating support for Node.js v4.x and below.
* We are deprecating support for Node.js v5.x and below.
*/
const majorVersion = parseInt(process.versions.node.split('.')[0], 10);
if (majorVersion <= 4) {
if (majorVersion <= 5) {
const deprecate = require('depd')('node-telegram-bot-api');
deprecate('Node.js v4.x and below will no longer be supported in the future');
deprecate('Node.js v5.x and below will no longer be supported in the future');
module.exports = require('./lib/telegram');
} else {
module.exports = require('./src/telegram');