src/extensibility/node/package-validator.js
function parsePersonString(obj) {
    if (typeof (obj) === "string") {
        var parts = _personRegex.exec(obj);

        // No regex match, so we just synthesize an object with an opaque name string
        if (!parts) {
            return {
                name: obj
            };
        } else {
            var result = {
                name: parts[1]
            };
            if (parts[2]) {
                result.email = parts[2];
            }
            if (parts[3]) {
                result.url = parts[3];
            }
            return result;
        }
    } else {
        // obj is not a string, so return as is
        return obj;
    }
}
function parsePersonString(obj) {
    if (typeof (obj) === "string") {
        var parts = _personRegex.exec(obj);

        // No regex match, so we just synthesize an object with an opaque name string
        if (!parts) {
            return {
                name: obj
            };
        } else {
            var result = {
                name: parts[1]
            };
            if (parts[2]) {
                result.email = parts[2];
            }
            if (parts[3]) {
                result.url = parts[3];
            }
            return result;
        }
    } else {
        // obj is not a string, so return as is
        return obj;
    }
}
function parsePersonString ( obj ) { if ( typeof ( obj ) === "string" ) { var parts = _personRegex . exec ( obj ) ; // No regex match, so we just synthesize an object with an opaque name string if ( ! parts ) { return { name : obj } ; } else { var result = { name : parts [ 1 ] } ; if ( parts [ 2 ] ) { result . email = parts [ 2 ] ; } if ( parts [ 3 ] ) { result . url = parts [ 3 ] ; } return result ; } } else { // obj is not a string, so return as is return obj ; } }
Normalizes person fields from package.json.

These fields can be an object with name, email and url properties or a
string of the form "name <email> <url>". This does a tolerant parsing of
the data to try to return an object with name and optional email and url.
If the string does not match the format, the string is returned as the
name on the resulting object.

If an object other than a string is passed in, it's returned as is.

@param <String|Object> obj to normalize
@return {Object} person object with name and optional email and url
Normalizes person fields from package . json .