1234567891011121314151617181920212223 |
- "use strict";
- exports.__esModule = true;
- var create_slicer_1 = require("./create-slicer");
- function groupCstFlowCollectionItems(cstItems) {
- var groups = [];
- var sliceCstItems = create_slicer_1.createSlicer(cstItems, 1); // exclude `{` or `[`
- var hasItem = false;
- for (var i = 1; i < cstItems.length - 1; i++) {
- var cstItem = cstItems[i];
- if ("char" in cstItem && cstItem.char === ",") {
- groups.push(sliceCstItems(i));
- sliceCstItems(i + 1); // exclude `,`
- hasItem = false;
- continue;
- }
- hasItem = true;
- }
- if (hasItem) {
- groups.push(sliceCstItems(cstItems.length - 1)); // exclude `}` or `]`
- }
- return groups;
- }
- exports.groupCstFlowCollectionItems = groupCstFlowCollectionItems;
|