Profile
Achievement
Sephr's Recent Snippets
- All /
« Prev 1 Next »
Use this to extract an HTML5 origin from a URI. $1 is the origin.
The square brackets are there to support IPv6 addresses.
Example:
var html5OriginRegex = /^([\w-]+:\/*\[?[\w\.:-]+\]?(?::\d+)?).*/;
"http://www.google.com:42/foo/bar/...
0
580
posted 15 years ago by Sephr
ErrorConstructor produces error constructors that behave the same way as the seven native error constructors.
Usage: `ErrorConstructor([constructorName])`
*If no constructorName is specified, the default of `Error.prototype.name` is used*
Us...
1
644
posted 15 years ago by Sephr
object.forEach
=========
*Requires JavaScript 1.8*
`void object.forEach(function callback(item, value)[, thisObject])`
0
666
posted 15 years ago by Sephr
Get Function Name
============
This will only return (a string) if the object passed to getFunctionName is a function or an "object" function from IE.
The function does not rely on function.name if present as it can't always be trusted.
Examp...
0
653
posted 15 years ago by Sephr