1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | exports.__esModule = true;
|
6 | exports.map = map;
|
7 | exports.forEach = forEach;
|
8 |
|
9 | var _react = _interopRequireDefault(require("react"));
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | function map(children, func) {
|
20 | var index = 0;
|
21 | return _react.default.Children.map(children, function (child) {
|
22 | return _react.default.isValidElement(child) ? func(child, index++) : child;
|
23 | });
|
24 | }
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | function forEach(children, func) {
|
34 | var index = 0;
|
35 |
|
36 | _react.default.Children.forEach(children, function (child) {
|
37 | if (_react.default.isValidElement(child)) func(child, index++);
|
38 | });
|
39 | } |
\ | No newline at end of file |