Skip to content

Instantly share code, notes, and snippets.

@tfluehr
Created May 12, 2010 14:51
Show Gist options
  • Save tfluehr/398675 to your computer and use it in GitHub Desktop.
Save tfluehr/398675 to your computer and use it in GitHub Desktop.
Prototype override of parseInt to default radix to 10
parseInt = parseInt.wrap(function(proceed, val, radix){
if (typeof(radix) == 'undefined'){
radix = 10;
}
return proceed(val, radix);
});
@tygas
Copy link

tygas commented Apr 17, 2018

`
// ES6 with lint
parseInt = parseInt.wrap((proceed, val, radix) => (
typeof(radix) === 'undefined' ? radix = 10 : proceed(val, radix)
));

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment