UNPKG

@rhino.fi/client-js

Version:
13 lines (12 loc) 382 B
/** * @param {Object} orderIdOrCid 'xxx' or { orderId: 'xxx' } or { cid: 'yyy' } */ module.exports = orderIdOrCid => { if (typeof orderIdOrCid === 'object' && orderIdOrCid !== null) { const { cid, orderId } = orderIdOrCid return cid ? { cid } : { orderId } } else { // Supporting input to be orderId as original behavior return { orderId: orderIdOrCid } } }