map: Force param/@default in translation to be numeric

The default ought to be numeric, always, but until we have the compiler
checking for that, I'm going to leave the casting in place.

DEV-10484
main
Mike Gerwitz 2022-03-07 10:53:38 -05:00
parent 054ad9b4c4
commit 70d1ad17b8
1 changed files with 3 additions and 3 deletions

View File

@ -2414,7 +2414,7 @@
{
// TODO: error
if ( Array.isArray( input ) ) input = input[0];
return ( input === '' || input === undefined ) ? +value : +input||0;
return ( input === '' || input === undefined ) ? +value||0 : +input||0;
}
// TODO: error for both
@ -2423,14 +2423,14 @@
// TODO: this maintains old behavior, but maybe should be an error;
// we cannot have empty index sets (see design/tpl).
if (input.length === 0) input = [+value];
if (input.length === 0) input = [+value||0];
return input.map( function( x ) {
return ( depth === 2 )
? Array.isArray( x )
? x.map( function(s) { return +s||0; } )
: [ x ]
: ( x === '' || x === undefined ) ? +value : +x||0;
: ( x === '' || x === undefined ) ? +value||0 : +x||0;
} );
}