Closed GoogleCodeExporter closed 8 years ago
I've been thinking of supporting multiple values but just haven't got the time
to implement it. If you have time I could add you to the project :).
Let's say you enter addMarker( {'foo': 'a|b|c' }), I would need to delimit that
string to find e.g. *a* (find, markers, { property:foo, value:b, delimiter: |
}). If you'd enter an array you would have to check that the property is an
instance of array and skip the split. I guess you could expand that method more
with other types.
Original comment by johansalllarsson
on 15 Feb 2012 at 8:00
I wouldnt mind being a committer, if you want to add me use koryak at gmail -
thats my personal email.
Also, what are your plans for replacing a,b,c,d,e with normal variable names?
It will be much easier for me to add stuff if i can read the code faster ;)
Original comment by mi...@openmile.com
on 15 Feb 2012 at 8:17
Added. The trunk is updated with maintainable code :)
Original comment by johansalllarsson
on 15 Feb 2012 at 8:21
I did some rough coding
find: function(ctx, options, callback) {
var obj = this.get(ctx);
for ( var property in obj ) {
if ( obj.hasOwnProperty(property) ) {
console.log(options.values);
var isFound = false;
for ( var value in options.values ) {
var items = ( options.delimiter && typeof obj[property][options.property] === 'string' ) ? obj[property][options.property].split(options.delimiter) : obj[property][options.property];
if ( $.inArray(options.values[value], items) > -1 ) {
isFound = true;
}
}
if (isFound) {
console.log(obj[property][options.property]);
}
callback(obj[property], isFound, obj[property][options.property]);
//callback(obj[property], (( options.delimiter && obj[property][options.property] ) ? ( $.inArray(options.value, obj[property][options.property].split(options.delimiter)) > -1 ) : ( obj[property][options.property] === options.value )));
}
};
return this;
}
I guess you could start with that and see where you can refactor and make better
Original comment by johansalllarsson
on 15 Feb 2012 at 8:33
Original comment by johansalllarsson
on 15 Feb 2012 at 8:44
Original comment by johansalllarsson
on 27 Mar 2012 at 8:33
Original issue reported on code.google.com by
mi...@openmile.com
on 15 Feb 2012 at 7:27