main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
647 bytes
|
Rev | Line | |
---|
[d565449] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | var tslib_1 = require("tslib");
|
---|
| 4 | var useList_1 = tslib_1.__importDefault(require("./useList"));
|
---|
| 5 | /**
|
---|
| 6 | * @deprecated Use `useList` hook's upsert action instead
|
---|
| 7 | */
|
---|
| 8 | function useUpsert(predicate, initialList) {
|
---|
| 9 | if (initialList === void 0) { initialList = []; }
|
---|
| 10 | var _a = useList_1.default(initialList), list = _a[0], listActions = _a[1];
|
---|
| 11 | return [
|
---|
| 12 | list,
|
---|
| 13 | tslib_1.__assign(tslib_1.__assign({}, listActions), { upsert: function (newItem) {
|
---|
| 14 | listActions.upsert(predicate, newItem);
|
---|
| 15 | } }),
|
---|
| 16 | ];
|
---|
| 17 | }
|
---|
| 18 | exports.default = useUpsert;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.