UNPKG

@ohu-mobile/core

Version:
23 lines (22 loc) 789 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addTargetClass = addTargetClass; var _isPlainObject = _interopRequireDefault(require("./isPlainObject")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function addTargetClass(currentClass, targetClass) { if (!targetClass) return currentClass; if (typeof targetClass === 'string') { currentClass[targetClass] = true; } else if (targetClass instanceof Array) { targetClass.map(function (classStr) { return currentClass[classStr] = true; }); } else if ((0, _isPlainObject.default)(targetClass)) { Object.keys(targetClass).map(function (key) { currentClass[key] = targetClass[key]; }); } return currentClass; }