Closed OlivierDa closed 5 years ago
Hi @OlivierDa .flatMap()
is a native ES method, on the Array prototype: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap
Unfortunately, nodeJS doesn't include .flatMap()
until v11. So if you're using an earlier version it will throw an error.
I was naively thinking that no-one would hit this issue - looks like I was wrong. After checking it seems that Edge also doesn't suport .flatMap()
yet either: https://caniuse.com/#search=flatmap
A (hopefully) quick fix for you is to upgrade nodejs to v11+ (Latest version is 12), but I realise that may not be possible depeding on your project, especially as v10 is the LTS release. I'll look at getting a small polyfill in place to fix the issue as soon as I can. Should be in the next day or two.
Okay, that should actually be working now, if you pull down the latest version (v3.1.1).
Please let me know if it's not.
Great news! I'm waiting for it to be available in Npm and confirm it !
Ah! Apologies, I forgot to publish it.. It should be available now: https://www.npmjs.com/package/rpg-dice-roller
Unfortunately it is still not working...
TypeError: Array.prototype.map.apply(...).flat is not a function
It seems that flat is also nodejs11+:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat
Hello ! I ran into an issue with the latest version (3.1.0) in nodeJs When calling :
i got this error :
When i look a the function rollGroups i see :
return group.flatMap(function (elm) {...}
It seems a working flatmap function has been created in this script but outside the scope of rollGroups and this semantics is not supported by NodeJs... It should must be something like this :
return flatMap(group,function(elem{...}))
Thanks in advance!