it's actually javascript shorthand for 'new Number(val)'


On Mon, Sep 9, 2013 at 11:30 AM, Daniel Roberts <notifications@github.com>wrote:

> In corehq/apps/reports/static/reports/javascripts/maps.js:
>
> >
> > -    $.each(data.features, function(i, e) {
> > -	var val = getPropValue(e.properties, meta);
> > -	if (isNull(val)) {
> > -	    return;
> > -	}
> > +    var iterate = function(callback) {
> > +	$.each(data.features, function(i, e) {
> > +	    var val = getPropValue(e.properties, meta);
> > +	    if (isNull(val)) {
> > +		return;
> > +	    }
> > +
> > +	    var numeric = isNumeric(val);
> > +	    var polygon = e.geometry.type != 'Point';
> > +	    callback(numeric ? +val : val, numeric, polygon);
>
> Is this a convention I don't know about/understand? Naively I'd think that
> +val and val are the same thing. With some detective work I'm going to
> guess that val is a string that may or may not look like an int and +val is
> supposed to convert it. If that's the case, perhpas you could use the more
> explicit parseInt(val, 10).
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/dimagi/commcare-hq/pull/1125/files#r6241035>
> .
>