From 4572b5d70f0f7b8dbeec505bedfe2a6affcc5dfd Mon Sep 17 00:00:00 2001 From: passion-27 Date: Thu, 9 Feb 2017 15:25:38 +0300 Subject: [PATCH] src/telegram: Add shim for Array#findIndex() Bug: Array#findIndex() is unavailable in Node.js v0.x. Since we are deprecating Node.js v0.x already, we can use a shim in the mean time. Once we stop supporting that version range, we can drop the shim entirely. tags: deprecate/node-v0.x --- package.json | 3 ++- src/telegram.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 322f95d..0fc46da 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,10 @@ "author": "Yago PĂ©rez ", "license": "MIT", "engines": { - "node" : ">=0.12" + "node": ">=0.12" }, "dependencies": { + "array.prototype.findindex": "^2.0.0", "bl": "^1.1.2", "bluebird": "^3.3.4", "debug": "^2.2.0", diff --git a/src/telegram.js b/src/telegram.js index 405131d..28b1819 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -1,3 +1,6 @@ +// shims +require('array.prototype.findindex').shim(); // for Node.js v0.x + const TelegramBotWebHook = require('./telegramWebHook'); const TelegramBotPolling = require('./telegramPolling'); const debug = require('debug')('node-telegram-bot-api');