diff options
Diffstat (limited to 'importAddrBook.js')
-rw-r--r-- | importAddrBook.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/importAddrBook.js b/importAddrBook.js index 2a16f86..518002b 100644 --- a/importAddrBook.js +++ b/importAddrBook.js @@ -106,7 +106,18 @@ return cAddr; } - // secondLineInAddress("home", "mozillaHomeStreet", "mozillaHomeStreet2") + /** + * Manages squeezing two-line address into one value field + * + * @param type String ['home', 'work'] + * @param target String ContactsAddress attribute to be set (e.g., + * streetAddress) + * @param first String first line index in inRec + * @param second String second line index in inRec + * @return None + * sets variable inRec local to outer function + * deletes both fields from inRec so as to avoid duplication + */ function secondLineInAddress(type, target, first, second) { var curRec = findSubElement("adr", type); if (second in inRec) { @@ -209,7 +220,8 @@ } else if (["mozillaHomeStreet", "mozillaHomeStreet2"]. indexOf(key) !== -1) { - secondLineInAddress("home", "mozillaHomeStreet", "mozillaHomeStreet2"); + secondLineInAddress("home", "streetAddress", + "mozillaHomeStreet", "mozillaHomeStreet2"); } else if (key === "mozillaWorkUrl") { curRec = findSubElement("url", "work"); @@ -276,7 +288,8 @@ } else if (["street", "mozillaWorkStreet2"]. indexOf(key) !== -1) { - secondLineInAddress("work", "street", "mozillaWorkStreet2"); + secondLineInAddress("work", "streetAddress", + "street", "mozillaWorkStreet2"); } else if (key === "telephoneNumber") { curRec = findSubElement("tel", "work"); |