Created
June 11, 2012 18:21
-
-
Save max-mapper/2911740 to your computer and use it in GitHub Desktop.
16 space indents from @izs
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
function parsePerson (person) { | |
if (typeof person !== "string") return person | |
var name = person.match(/^([^\(<]+)/) | |
var url = person.match(/\(([^\)]+)\)/) | |
var email = person.match(/<([^>]+)>/) | |
var obj = {} | |
if (name && name[0].trim()) obj.name = name[0].trim() | |
if (email) obj.email = email[1]; | |
if (url) obj.url = url[1]; | |
return obj | |
} |
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
function parsePerson (person) { | |
if (typeof person !== "string") return person | |
var name = person.match(/^([^\(<]+)/) | |
var url = person.match(/\(([^\)]+)\)/) | |
var email = person.match(/<([^>]+)>/) | |
var obj = {} | |
if (name && name[0].trim()) obj.name = name[0].trim() | |
if (email) obj.email = email[1]; | |
if (url) obj.url = url[1]; | |
return obj | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment