Closed North-West-Wind closed 3 years ago
I created this pr because I'm using Node v12, but now I guess I'll just create my own fork for Node <= 12
Oh ! I see.
You actually make me rethink about it, I will make it Node v12 and Node v10 compatible over the weekend.
Node v10 is still on until mid next year and Node v12 until April 2022. So after second thoughts, it would be nice to support it too.
I did not see that you push a correction to your first fix.
const match = datas.VIDEO_NUMBER === null || datas.VIDEO_NUMBER === undefined ? null : datas.VIDEO_NUMBER.match(/(?<=of )\d+/gi, '');
datas.VIDEO_NUMBER = match[0];
It's the idea but it will break. If datas.VIDEO_NUMBER is null. You will give to match a null value. In the next line you will try to access the index 0 of match. Crash.
I fixed it in #30 if you are curious ;)
Hello,
It's not a typo error. It's the
optionnal chaining
that has been finally added in the node v14. Our two lines are not doing the same :The first one :
Could be done in node v12 or under like this :
It tests first that the
datas.VIDEO_NUMBER
exists and has been defined for applying thematch
function.If you want more informations about it : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
Why I am using that instead of the v12 version that could give me a better compatibility ? Because the latest LTS version of Node is v14, so everyone should turn to that version. And also, I wanna try Node v14. I am already coding at my work in Node v14, Node v12 and Node v8 syntax ;)
But nice that someone see it :)