You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by de...@apache.org on 2012/05/25 21:40:59 UTC
js commit: Make sure Contact vars are arrays.
Updated Branches:
refs/heads/master 4b72c211f -> 184b040fb
Make sure Contact vars are arrays.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/184b040f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/184b040f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/184b040f
Branch: refs/heads/master
Commit: 184b040fb677ad52348be7c5415c3bdd4e18f7d2
Parents: 4b72c21
Author: Drew Walters <de...@gmail.com>
Authored: Fri May 25 14:40:27 2012 -0500
Committer: Drew Walters <de...@gmail.com>
Committed: Fri May 25 14:40:27 2012 -0500
----------------------------------------------------------------------
lib/blackberry/plugin/blackberry/ContactUtils.js | 10 +++++++---
lib/blackberry/plugin/blackberry/contacts.js | 2 +-
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/184b040f/lib/blackberry/plugin/blackberry/ContactUtils.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/blackberry/ContactUtils.js b/lib/blackberry/plugin/blackberry/ContactUtils.js
index 28dc9e1..fe216c4 100644
--- a/lib/blackberry/plugin/blackberry/ContactUtils.js
+++ b/lib/blackberry/plugin/blackberry/ContactUtils.js
@@ -156,7 +156,7 @@ module.exports = {
var filterExpression = null;
if (fields && utils.isArray(fields)) {
var fe = null;
- for ( var f in fields) {
+ for (var f = 0; f < fields.length; f++) {
if (!fields[f]) {
continue;
}
@@ -170,8 +170,12 @@ module.exports = {
continue;
}
+ if (!utils.isArray(bbFields)) {
+ bbFields = [bbFields];
+ }
+
// construct the filter expression using the BlackBerry fields
- for ( var j in bbFields) {
+ for (var j = 0; j < bbFields.length; j++) {
fe = new blackberry.find.FilterExpression(bbFields[j],
"REGEX", filter);
if (filterExpression === null) {
@@ -223,7 +227,7 @@ module.exports = {
}
// add the fields specified
- for ( var i in fields) {
+ for (var i = 0; i < fields.length; i++) {
var field = fields[i];
if (!field) {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/184b040f/lib/blackberry/plugin/blackberry/contacts.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/blackberry/contacts.js b/lib/blackberry/plugin/blackberry/contacts.js
index 8edfa51..602b732 100644
--- a/lib/blackberry/plugin/blackberry/contacts.js
+++ b/lib/blackberry/plugin/blackberry/contacts.js
@@ -47,7 +47,7 @@ module.exports = {
// convert to Contact from blackberry.pim.Contact
var contacts = [];
- for ( var i in bbContacts) {
+ for (var i = 0; i < bbContacts.length; i++) {
if (bbContacts[i]) {
// W3C Contacts API specification states that only the fields
// in the search filter should be returned, so we create