Skip to content

Instantly share code, notes, and snippets.

@muloka
Created May 5, 2011 15:04
Show Gist options
  • Save muloka/957211 to your computer and use it in GitHub Desktop.
Save muloka/957211 to your computer and use it in GitHub Desktop.
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
String.prototype.isNumber = function() {
return typeof parseFloat(this, 10) === 'number' && isFinite(this) && this.trim().length > 0;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment