【发布时间】:2019-04-01 09:12:37
【问题描述】:
我在pickBy函数中传递一个数组作为参数
return fetch(API_BASE + url + (params ? '?' + stringify(pickBy(params, v=>v===false||!!v)) : ''), {
method: 'GET',
headers,
credentials: 'include'
}).then(resp=>{
authGuard(resp);
return resp;
});
我的 params 对象是
currencyId: [12,44]
dueDateEnd: null
dueDateStart: null
exceptionTypeIds: (2) ["Contract updates/correction WIP", "Closed Contract"]
现在每当我只传递一个 exceptionTypeIds 时它就可以工作,但是当我传递两个值时,它会抛出 exceptionTypeIds must be a string ,CurrencyId must be a number 的错误。 我想实现这一点,只要我传递任何值,它就会起作用。
【问题讨论】:
-
什么是预期输出并分享您尝试过的代码。
标签: javascript node.js lodash