Refactored duplicated code in Util

Change-Id: I05d02b73cd35b4b61843fdc17e97a4a8c5d0e8b6
This commit is contained in:
Subramanya Sastry 2012-07-30 10:24:43 -05:00
parent 595dfc0615
commit de1d734f23

View file

@ -104,22 +104,6 @@ var Util = {
}
},
lookup: function ( kvs, key ) {
if ( ! kvs ) {
return null;
}
var kv;
for ( var i = 0, l = kvs.length; i < l; i++ ) {
kv = kvs[i];
if ( kv.k.trim() === key ) {
// found, return it.
return kv.v;
}
}
// nothing found!
return null;
},
lookupKV: function ( kvs, key ) {
if ( ! kvs ) {
return null;
@ -136,6 +120,11 @@ var Util = {
return null;
},
lookup: function ( kvs, key ) {
var kv = this.lookupKV(kvs, key);
return kv == null ? null : kv.v;
},
lookupValue: function ( kvs, key ) {
if ( ! kvs ) {
return null;