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.
27 lines • 775 B
JavaScript
import { isArray, isObject, isString } from "./is";
import warning from "./warning";
// eslint-disable-next-line import/no-anonymous-default-export
export default function () {
const length = arguments.length;
let classNames = [];
for (let i = 0; i < length; i++) {
const v = i < 0 || arguments.length <= i ? undefined : arguments[i];
if (!v) {
continue;
}
if (isString(v)) {
classNames.push(v);
} else if (isArray(v)) {
classNames = classNames.concat(v);
} else if (isObject(v)) {
Object.keys(v).forEach(k => {
if (v[k]) {
classNames.push(k);
}
});
} else {
warning(true, "arguments must be one of string/array/object.");
}
}
return [...new Set(classNames)].join(" ");
}