Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cba01c8

Browse files
author
Neil Fraser
committed
Overhaul nativeToPseudo and pseudoToNative
These twin functions were inconsistent with each other. n2p used a positive test for primitives, p2n used a more dangerous negative test. n2p didn't have cycle-detection, but p2n did. p2n had '__proto__' protection on objects but not arrays. Both were vulnerable to hanging on sparse arrays with enormous lengths. Removed arrayNativeToPseudo, use nativeToPseudo instead. Removed all but one use of the non-recursive arrayPseudoToNative (function bind needs it for arguments). Made this function private.
1 parent c3f7c00 commit cba01c8

File tree

2 files changed

+203
-219
lines changed

2 files changed

+203
-219
lines changed

0 commit comments

Comments
 (0)