You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Bas Bosman (JIRA)" <ji...@apache.org> on 2014/01/30 23:34:12 UTC

[jira] [Updated] (CB-4849) Inconsistent constructors for the Contact objects

     [ https://issues.apache.org/jira/browse/CB-4849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bas Bosman updated CB-4849:
---------------------------

    Component/s: Plugin Contacts

> 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: CordovaJS, 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)