UNPKG

1.51 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.removeFirstNotification = exports.addMultipleNotifications = exports.addOneNotification = void 0;
9
10var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
11
12var _objectSpread2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectSpread"));
13
14var addOneNotification = function addOneNotification(uiState, notification) {
15 return (0, _objectSpread2.default)({}, uiState, {
16 notifications: (0, _toConsumableArray2.default)(uiState.notifications).concat((0, _toConsumableArray2.default)(notification ? [notification] : []))
17 });
18};
19
20exports.addOneNotification = addOneNotification;
21
22var addMultipleNotifications = function addMultipleNotifications(uiState) {
23 var notifications = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
24 return (0, _objectSpread2.default)({}, uiState, {
25 notifications: (0, _toConsumableArray2.default)(uiState.notifications).concat((0, _toConsumableArray2.default)(notifications))
26 });
27};
28
29exports.addMultipleNotifications = addMultipleNotifications;
30
31var removeFirstNotification = function removeFirstNotification(uiState) {
32 return (0, _objectSpread2.default)({}, uiState, {
33 notifications: uiState.notifications.splice(1)
34 });
35};
36
37exports.removeFirstNotification = removeFirstNotification;
\No newline at end of file