Created
May 12, 2010 14:51
-
-
Save tfluehr/398675 to your computer and use it in GitHub Desktop.
Prototype override of parseInt to default radix to 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parseInt = parseInt.wrap(function(proceed, val, radix){ | |
if (typeof(radix) == 'undefined'){ | |
radix = 10; | |
} | |
return proceed(val, radix); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`
// ES6 with lint
parseInt = parseInt.wrap((proceed, val, radix) => (
typeof(radix) === 'undefined' ? radix = 10 : proceed(val, radix)
));
`