cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter (JIRA)" <>
Subject [jira] [Created] (CB-4849) Inconsistent constructors for the Contact objects
Date Tue, 17 Sep 2013 02:17:53 GMT
Peter created CB-4849:

             Summary: Inconsistent constructors for the Contact objects
                 Key: CB-4849
             Project: Apache Cordova
          Issue Type: Improvement
          Components: CordovaJS
    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,

var ContactField = function(type, value, pref) { = null;
    this.type = (type && type.toString()) || null;
    this.value = (value && value.toString()) || null;
    this.pref = (typeof pref != 'undefined' ? pref : false);


var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode,
country) { = 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; = country || null;

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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message