MCPcopy Create free account
hub / github.com/SparkPost/node-sparkpost / addressToObject

Function addressToObject

lib/transmissions.js:158–175  ·  view source on GitHub ↗
(address)

Source from the content-addressed store, hash-verified

156}
157
158function addressToObject(address) {
159 let addressObject = address;
160
161 if (_.isString(address)) {
162 addressObject = {};
163
164 const matches = /"?(.[^"]*)?"?\s*<(.+)>/gi.exec(address);
165
166 if (matches) {
167 addressObject.name = matches[1];
168 addressObject.email = matches[2];
169 } else {
170 addressObject.email = address;
171 }
172 }
173
174 return addressObject;
175}

Callers 2

formatPayloadFunction · 0.85
addListToRecipientsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected