UNPKG

pay-sdk-react

Version:

A cross-platform payment SDK for React, supporting Alipay, WeChat Pay, PayPal, Stripe, Payssion, and Airwallex, compatible with H5, PC, and App environments.

35 lines (33 loc) 985 B
/* eslint-disable no-redeclare */ export function mergeProps() { var ret = {}; for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) { items[_key] = arguments[_key]; } items.forEach(function (item) { if (item) { Object.keys(item).forEach(function (key) { if (item[key] !== undefined) { ret[key] = item[key]; } }); } }); return ret; } /** * Merge props and return the first non-undefined value. * The later has higher priority. e.g. (10, 1, 5) => 5 wins. * This is useful with legacy props that have been deprecated. */ export function mergeProp(defaultProp) { for (var _len2 = arguments.length, propList = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { propList[_key2 - 1] = arguments[_key2]; } for (var i = propList.length - 1; i >= 0; i -= 1) { if (propList[i] !== undefined) { return propList[i]; } } return defaultProp; }