Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BDA7B10666 for ; Mon, 24 Feb 2014 21:17:23 +0000 (UTC) Received: (qmail 63511 invoked by uid 500); 24 Feb 2014 21:17:20 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 63490 invoked by uid 500); 24 Feb 2014 21:17:19 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 63479 invoked by uid 99); 24 Feb 2014 21:17:19 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Feb 2014 21:17:19 +0000 Date: Mon, 24 Feb 2014 21:17:19 +0000 (UTC) From: "Andrew Grieve (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CB-4849) Inconsistent constructors for the Contact objects MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-4849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrew Grieve updated CB-4849: ------------------------------ Component/s: (was: CordovaJS) > Inconsistent constructors for the Contact objects > ------------------------------------------------- > > Key: CB-4849 > URL: https://issues.apache.org/jira/browse/CB-4849 > Project: Apache Cordova > Issue Type: Improvement > Components: Plugin Contacts > Affects Versions: 2.9.0 > Reporter: Peter > Assignee: Andrew Grieve > Priority: Minor > > It is curious that the ContactField constructor ensures that members are converted to strings as per the documentation, but the other Contact constructors like ContactOrganization, ContactAddress do not follow the same code pattern. Is there some reason for the difference? > For example, > {code} > var ContactField = function(type, value, pref) { > this.id = null; > this.type = (type && type.toString()) || null; > this.value = (value && value.toString()) || null; > this.pref = (typeof pref != 'undefined' ? pref : false); > }; > {code} > vs. > {code} > var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode, country) { > this.id = null; > this.pref = (typeof pref != 'undefined' ? pref : false); > this.type = type || null; > this.formatted = formatted || null; > this.streetAddress = streetAddress || null; > this.locality = locality || null; > this.region = region || null; > this.postalCode = postalCode || null; > this.country = country || null; > }; > {code} > It means (for example) that user can create a ContactField for a phone numbers passing a value of 123456 and it will be coverted OK to '123456'. But if user passed numeric 1234 as a ContactAddress postalCode the assigned member will have the wrong type. -- This message was sent by Atlassian JIRA (v6.1.5#6160)