Merge "Refactored duplicated code in Util"

This commit is contained in:
GWicke 2012-07-30 17:55:31 +00:00 committed by Gerrit Code Review
commit d0c07ca6dd

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;