
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
array-reduce-prototypejs-fix
Advanced tools
Safe `Array.reduce()` when using PrototypeJS v1.6 and lower.
PrototypeJS was a popular JS library many years ago. It extended and changed native objects. Which led to collisions with newer versions of browsers, if they implemented methods with the same names. This is the case of Array.reduce() (see native versus Prototype's implementation).
This, kids, is exactly why you should never touch native objects. And this is why PrototypeJS lost JavaScript libraries war and Jquery won.
Anyway, if you need to use Array.reduce() in a project that uses PrototypeJS v1.6 and lower (they removed it from v1.7), this module should help you. Since PrototypeJS replaced the original method, there's no way to get it back. We could replace the method with polyfill, but that would potentially break the code expecting PrototypeJS' method. So instead we create a new function. It checks for the presence of PrototypeJS. If it is there, it uses polyfill. Otherwise it uses native implementation.
Just remember that this should be a temporary fix. Real fix would be to get rid of PrototypeJS from your project. Or at least to upgrade it to v1.7.
Does exactly the same as native Array.reduce(), but is safe to use when PrototypeJS v1.6 or lower is present.
Parameters
array [Array](default []) Array object upon which you would call the native reduce() method.params ...Any Rest of parameters which you would provide to native reduce() method.Returns Any
If you found any bugs, if you have feature requests or any questions, please, either file an issue at GitHub or send me an e-mail at riki@fczbkk.com.
Safe Array.reduce when usingPrototypeJS v1.6 and lower is published under the MIT license.
FAQs
Safe `Array.reduce()` when using PrototypeJS v1.6 and lower.
The npm package array-reduce-prototypejs-fix receives a total of 752 weekly downloads. As such, array-reduce-prototypejs-fix popularity was classified as not popular.
We found that array-reduce-prototypejs-fix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.