"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));

/**
 * 根据条件，选择性调用 a 与 b 其中一个方法。
 * @param a
 * @param b
 */
function toggle(a, b) {
  return function (target, value) {
    var options = [target].concat((0, _toConsumableArray2["default"])(value));
    return function (condition) {
      if (condition) {
        a.apply(void 0, (0, _toConsumableArray2["default"])(options));
      } else {
        b.apply(void 0, (0, _toConsumableArray2["default"])(options));
      }
    };
  };
}

var _default = toggle;
exports["default"] = _default;
//# sourceMappingURL=toggle.js.map
