cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-4849) Inconsistent constructors for the Contact objects
Date Mon, 24 Feb 2014 21:17:19 GMT

     [ 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)

Mime
View raw message