Spread | function getParams(marker, query_text, level) {
const params = {
...(marker ? { marker } : {}),
...(query_text ? { query_text } : {}),
...(level || level === 0 ? { level } : {}),
};
return params;
}
getParams();
getParams("marker");
getParams("marker", "query_text");
getParams("marker", "query_text", 0);
getParams("marker", "query_text", 0);
getParams("marker", "query_text");
getParams("marker");
getParams();
| ready |
Dot | function getParams(marker, query_text, level) {
let params = {};
if (marker) {
params.marker = marker;
}
if (query_text) {
params.query_text = query_text;
}
if (level || level === 0) {
params.level = level;
}
return params;
}
getParams();
getParams("marker");
getParams("marker", "query_text");
getParams("marker", "query_text", 0);
getParams("marker", "query_text", 0);
getParams("marker", "query_text");
getParams("marker");
getParams();
| ready |
Assign | function getParams(marker, query_text, level) {
let params = {};
if (marker) {
params = Object.assign(params, { marker });
}
if (query_text) {
params = Object.assign(params, { query_text });
}
if (level || level === 0) {
params = Object.assign(params, { level });
}
return params;
}
getParams();
getParams("marker");
getParams("marker", "query_text");
getParams("marker", "query_text", 0);
getParams("marker", "query_text", 0);
getParams("marker", "query_text");
getParams("marker");
getParams();
| ready |