sharyn
Version:
Combines all the other packages under one.
37 lines (27 loc) • 1.51 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.removeFirstNotification = exports.addMultipleNotifications = exports.addOneNotification = void 0;
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectSpread"));
var addOneNotification = function addOneNotification(uiState, notification) {
return (0, _objectSpread2.default)({}, uiState, {
notifications: (0, _toConsumableArray2.default)(uiState.notifications).concat((0, _toConsumableArray2.default)(notification ? [notification] : []))
});
};
exports.addOneNotification = addOneNotification;
var addMultipleNotifications = function addMultipleNotifications(uiState) {
var notifications = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return (0, _objectSpread2.default)({}, uiState, {
notifications: (0, _toConsumableArray2.default)(uiState.notifications).concat((0, _toConsumableArray2.default)(notifications))
});
};
exports.addMultipleNotifications = addMultipleNotifications;
var removeFirstNotification = function removeFirstNotification(uiState) {
return (0, _objectSpread2.default)({}, uiState, {
notifications: uiState.notifications.splice(1)
});
};
exports.removeFirstNotification = removeFirstNotification;