@infinite-table/infinite-react 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -0
- package/index.css +896 -0
- package/index.d.ts +2264 -0
- package/index.esm.css +896 -0
- package/index.esm.js +15404 -0
- package/index.js +15240 -0
- package/package.json +3 -95
- package/.vscode/settings.json +0 -3
- package/API.md +0 -0
- package/build/buildPackageJson.js +0 -43
- package/build/scripts/test.js +0 -37
- package/bundler.config.js +0 -25
- package/globals.d.ts +0 -7
- package/rollup.config.js +0 -15
- package/run-build-deepmap.js +0 -47
- package/run-build.js +0 -45
- package/run-dts-concat.js +0 -21
- package/src/components/CSSVariableWatch.tsx +0 -82
- package/src/components/DataSource/BooleanCollectionState.ts +0 -214
- package/src/components/DataSource/BooleanDeepCollectionState.ts +0 -208
- package/src/components/DataSource/DataSourceContext.ts +0 -20
- package/src/components/DataSource/GroupRowsState.ts +0 -74
- package/src/components/DataSource/Indexer.ts +0 -27
- package/src/components/DataSource/RowSelectionState.ts +0 -763
- package/src/components/DataSource/defaultFilterTypes.ts +0 -64
- package/src/components/DataSource/index.tsx +0 -108
- package/src/components/DataSource/privateHooks/getChangeDetect.ts +0 -7
- package/src/components/DataSource/privateHooks/useLoadData.ts +0 -783
- package/src/components/DataSource/publicHooks/useDataSource.ts +0 -19
- package/src/components/DataSource/publicHooks/useDataSourceActions.ts +0 -14
- package/src/components/DataSource/state/getInitialState.ts +0 -494
- package/src/components/DataSource/state/normalizeSortInfo.ts +0 -35
- package/src/components/DataSource/state/reducer.ts +0 -466
- package/src/components/DataSource/state/rowInfoStatus.ts +0 -27
- package/src/components/DataSource/types.ts +0 -548
- package/src/components/HeadlessTable/HeadlessTableWithPinnedContainers.tsx +0 -142
- package/src/components/HeadlessTable/MappedCells.ts +0 -251
- package/src/components/HeadlessTable/RawTable.tsx +0 -98
- package/src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx +0 -1516
- package/src/components/HeadlessTable/index.tsx +0 -234
- package/src/components/InfiniteTable/InfiniteCls.css.ts +0 -164
- package/src/components/InfiniteTable/InfiniteTableContext.ts +0 -16
- package/src/components/InfiniteTable/api/getImperativeApi.ts +0 -391
- package/src/components/InfiniteTable/api/getSelectionApi.ts +0 -364
- package/src/components/InfiniteTable/api/type.ts +0 -11
- package/src/components/InfiniteTable/components/ActiveCellIndicator.css.ts +0 -51
- package/src/components/InfiniteTable/components/ActiveCellIndicator.tsx +0 -116
- package/src/components/InfiniteTable/components/ActiveRowIndicator.css.ts +0 -56
- package/src/components/InfiniteTable/components/ActiveRowIndicator.tsx +0 -94
- package/src/components/InfiniteTable/components/CheckBox.css.ts +0 -13
- package/src/components/InfiniteTable/components/CheckBox.tsx +0 -96
- package/src/components/InfiniteTable/components/FilterEditors.tsx +0 -52
- package/src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx +0 -27
- package/src/components/InfiniteTable/components/InfiniteTableBody/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx +0 -31
- package/src/components/InfiniteTable/components/InfiniteTableFooter/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx +0 -102
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx +0 -163
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx +0 -574
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx +0 -79
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderTypes.tsx +0 -25
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx +0 -185
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx +0 -159
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts +0 -124
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts +0 -166
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx +0 -146
- package/src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts +0 -240
- package/src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts +0 -358
- package/src/components/InfiniteTable/components/InfiniteTableHeader/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx +0 -114
- package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx +0 -146
- package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/footer.css.ts +0 -7
- package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx +0 -110
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx +0 -120
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCellTypes.ts +0 -74
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx +0 -457
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx +0 -107
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts +0 -6
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowTypes.ts +0 -32
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx +0 -75
- package/src/components/InfiniteTable/components/InfiniteTableRow/columnRendering.tsx +0 -263
- package/src/components/InfiniteTable/components/InfiniteTableRow/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts +0 -74
- package/src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts +0 -199
- package/src/components/InfiniteTable/components/LoadMask.css.ts +0 -34
- package/src/components/InfiniteTable/components/LoadMask.tsx +0 -27
- package/src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx +0 -56
- package/src/components/InfiniteTable/components/cell.css.ts +0 -192
- package/src/components/InfiniteTable/components/icons/ArrowDown.tsx +0 -14
- package/src/components/InfiniteTable/components/icons/ArrowUp.tsx +0 -14
- package/src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts +0 -31
- package/src/components/InfiniteTable/components/icons/ExpanderIcon.tsx +0 -63
- package/src/components/InfiniteTable/components/icons/Icon.tsx +0 -18
- package/src/components/InfiniteTable/components/icons/InfiniteTableIconClassName.ts +0 -1
- package/src/components/InfiniteTable/components/icons/LoadingIcon.css.ts +0 -8
- package/src/components/InfiniteTable/components/icons/LoadingIcon.tsx +0 -45
- package/src/components/InfiniteTable/components/icons/MenuIcon.tsx +0 -50
- package/src/components/InfiniteTable/components/icons/SortIcon.tsx +0 -113
- package/src/components/InfiniteTable/eventHandlers/eventHandlerTypes.ts +0 -57
- package/src/components/InfiniteTable/eventHandlers/index.ts +0 -95
- package/src/components/InfiniteTable/eventHandlers/keyboardNavigation.ts +0 -232
- package/src/components/InfiniteTable/eventHandlers/keyboardSelection.ts +0 -110
- package/src/components/InfiniteTable/eventHandlers/onCellClick.ts +0 -94
- package/src/components/InfiniteTable/eventHandlers/onKeyDown.ts +0 -25
- package/src/components/InfiniteTable/hooks/adjustColumnOrderForAllColumns.ts +0 -70
- package/src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts +0 -476
- package/src/components/InfiniteTable/hooks/useAutoSizeColumns.ts +0 -206
- package/src/components/InfiniteTable/hooks/useCellClassName.ts +0 -80
- package/src/components/InfiniteTable/hooks/useCellRendering.tsx +0 -217
- package/src/components/InfiniteTable/hooks/useColumnGroups.ts +0 -71
- package/src/components/InfiniteTable/hooks/useColumnMenu.ts +0 -72
- package/src/components/InfiniteTable/hooks/useColumnPointerEvents.ts +0 -258
- package/src/components/InfiniteTable/hooks/useColumnRowspan.ts +0 -43
- package/src/components/InfiniteTable/hooks/useColumnSizeFn.ts +0 -24
- package/src/components/InfiniteTable/hooks/useColumnsWhen.ts +0 -582
- package/src/components/InfiniteTable/hooks/useComputed.ts +0 -186
- package/src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts +0 -219
- package/src/components/InfiniteTable/hooks/useDOMProps.ts +0 -306
- package/src/components/InfiniteTable/hooks/useEffectWithRaf.ts +0 -47
- package/src/components/InfiniteTable/hooks/useInfiniteTable.ts +0 -10
- package/src/components/InfiniteTable/hooks/useInfiniteTableState.ts +0 -11
- package/src/components/InfiniteTable/hooks/useInternalProps.ts +0 -8
- package/src/components/InfiniteTable/hooks/useLicense/LicenseDetails.ts +0 -13
- package/src/components/InfiniteTable/hooks/useLicense/crc32.ts +0 -56
- package/src/components/InfiniteTable/hooks/useLicense/decode.ts +0 -147
- package/src/components/InfiniteTable/hooks/useLicense/useLicense.ts +0 -39
- package/src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts +0 -21
- package/src/components/InfiniteTable/hooks/useRowHover.ts +0 -18
- package/src/components/InfiniteTable/hooks/useScrollToActiveCell.ts +0 -48
- package/src/components/InfiniteTable/hooks/useScrollToActiveRow.ts +0 -44
- package/src/components/InfiniteTable/hooks/useScrollbars.ts +0 -51
- package/src/components/InfiniteTable/hooks/useToggleGroupRow.ts +0 -56
- package/src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx +0 -165
- package/src/components/InfiniteTable/hooks/useYourBrain.ts +0 -55
- package/src/components/InfiniteTable/index.tsx +0 -352
- package/src/components/InfiniteTable/internalProps.ts +0 -4
- package/src/components/InfiniteTable/state/computeColumnGroupsDepths.ts +0 -29
- package/src/components/InfiniteTable/state/getColumnVisibilityForHideEmptyGroupColumns.ts +0 -127
- package/src/components/InfiniteTable/state/getInitialState.ts +0 -375
- package/src/components/InfiniteTable/theme.css.ts +0 -556
- package/src/components/InfiniteTable/types/InfiniteTableAction.ts +0 -6
- package/src/components/InfiniteTable/types/InfiniteTableActionType.ts +0 -12
- package/src/components/InfiniteTable/types/InfiniteTableColumn.ts +0 -478
- package/src/components/InfiniteTable/types/InfiniteTableComputedValues.ts +0 -43
- package/src/components/InfiniteTable/types/InfiniteTableContextValue.ts +0 -12
- package/src/components/InfiniteTable/types/InfiniteTableInternalProps.ts +0 -3
- package/src/components/InfiniteTable/types/InfiniteTableProps.ts +0 -511
- package/src/components/InfiniteTable/types/InfiniteTableState.ts +0 -195
- package/src/components/InfiniteTable/types/Utility.ts +0 -35
- package/src/components/InfiniteTable/types/index.ts +0 -96
- package/src/components/InfiniteTable/utilities.css.ts +0 -179
- package/src/components/InfiniteTable/utils/MultiRowSelector.ts +0 -111
- package/src/components/InfiniteTable/utils/RenderHookComponentForInfinite.tsx +0 -52
- package/src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts +0 -33
- package/src/components/InfiniteTable/utils/assignFiltered.ts +0 -29
- package/src/components/InfiniteTable/utils/defaultGetColumContextMenuItems.tsx +0 -108
- package/src/components/InfiniteTable/utils/getColumnComputedType.ts +0 -33
- package/src/components/InfiniteTable/utils/getColumnForGroupBy.tsx +0 -313
- package/src/components/InfiniteTable/utils/getComputedVisibleColumns.ts +0 -773
- package/src/components/InfiniteTable/utils/getContextMenuForColumn.tsx +0 -72
- package/src/components/InfiniteTable/utils/infiniteDOMUtils.ts +0 -189
- package/src/components/InfiniteTable/utils/mapToObject.ts +0 -20
- package/src/components/InfiniteTable/utils/moveXatY.ts +0 -25
- package/src/components/InfiniteTable/utils/objectValuesExcept.ts +0 -9
- package/src/components/InfiniteTable/utils/progressiveSpeedScroller.ts +0 -158
- package/src/components/InfiniteTable/utils/rafFn.ts +0 -13
- package/src/components/InfiniteTable/utils/toCSSVarName.ts +0 -1
- package/src/components/InfiniteTable/utils/toMap.ts +0 -24
- package/src/components/Menu/Menu.tsx +0 -750
- package/src/components/Menu/MenuCls.css.ts +0 -139
- package/src/components/Menu/MenuContext.ts +0 -10
- package/src/components/Menu/MenuContextValue.ts +0 -15
- package/src/components/Menu/MenuProps.ts +0 -98
- package/src/components/Menu/MenuState.ts +0 -56
- package/src/components/Menu/MenuTriangleContext.ts +0 -352
- package/src/components/Menu/childrenToRuntimeItems.tsx +0 -103
- package/src/components/Menu/getMenuState.tsx +0 -119
- package/src/components/Menu/index.tsx +0 -88
- package/src/components/Menu/propToIdentifyMenu.ts +0 -1
- package/src/components/RawList/AvoidReactDiff.tsx +0 -48
- package/src/components/RawList/MappedItems.ts +0 -143
- package/src/components/RawList/ReactVirtualRenderer.tsx +0 -307
- package/src/components/RawList/index.tsx +0 -42
- package/src/components/RawList/types.ts +0 -23
- package/src/components/RawList/useVirtualRenderer.ts +0 -36
- package/src/components/RenderHookComponent.tsx +0 -10
- package/src/components/ResizeObserver/index.tsx +0 -170
- package/src/components/VirtualBrain/MatrixBrain.ts +0 -1621
- package/src/components/VirtualBrain/ScrollListener.ts +0 -39
- package/src/components/VirtualBrain/index.ts +0 -664
- package/src/components/VirtualList/ColumnListWithExternalScrolling.tsx +0 -78
- package/src/components/VirtualList/InfiniteListRootClassName.ts +0 -1
- package/src/components/VirtualList/RowListWithExternalScrolling.tsx +0 -120
- package/src/components/VirtualList/SpacePlaceholder.tsx +0 -32
- package/src/components/VirtualList/VirtualList.css.ts +0 -29
- package/src/components/VirtualList/VirtualList.tsx +0 -141
- package/src/components/VirtualList/VirtualRowList.tsx +0 -34
- package/src/components/VirtualList/types.ts +0 -56
- package/src/components/VirtualList/useCorrectHeightForRowElements.ts +0 -14
- package/src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts +0 -51
- package/src/components/VirtualScrollContainer/getScrollableClassName.ts +0 -30
- package/src/components/VirtualScrollContainer/index.tsx +0 -63
- package/src/components/flexbox/index.ts +0 -562
- package/src/components/hooks/useComponentState/index.tsx +0 -562
- package/src/components/hooks/useComponentState/types.ts +0 -32
- package/src/components/hooks/useEffectOnceWithProperUnmount.ts +0 -33
- package/src/components/hooks/useEffectWithChanges.ts +0 -56
- package/src/components/hooks/useImmutableRef.ts +0 -7
- package/src/components/hooks/useInterceptedMap.ts +0 -71
- package/src/components/hooks/useLatest.tsx +0 -8
- package/src/components/hooks/useLazyLatest.ts +0 -23
- package/src/components/hooks/useMemoShallowObjectMerge.ts +0 -16
- package/src/components/hooks/useMounted.ts +0 -18
- package/src/components/hooks/useOnMount.ts +0 -21
- package/src/components/hooks/useOnScroll.ts +0 -34
- package/src/components/hooks/useOnce.ts +0 -10
- package/src/components/hooks/useOverlay/index.tsx +0 -418
- package/src/components/hooks/usePrevious.ts +0 -8
- package/src/components/hooks/usePropertyOld.ts +0 -168
- package/src/components/hooks/useRerender.ts +0 -12
- package/src/components/hooks/xuseProperty.ts +0 -165
- package/src/components/types/CellPosition.ts +0 -4
- package/src/components/types/NonUndefined.ts +0 -1
- package/src/components/types/RemoveObject.ts +0 -22
- package/src/components/types/Renderable.ts +0 -3
- package/src/components/types/ScrollPosition.ts +0 -7
- package/src/components/types/Setter.ts +0 -2
- package/src/components/types/Size.ts +0 -6
- package/src/components/types/SubscriptionCallback.ts +0 -10
- package/src/components/types/VoidFn.ts +0 -1
- package/src/components/utils/buildSubscriptionCallback.tsx +0 -60
- package/src/components/utils/clamp.ts +0 -3
- package/src/components/utils/debounce.ts +0 -16
- package/src/components/utils/decamelize.ts +0 -11
- package/src/components/utils/discardCallsWithEqualArg.ts +0 -42
- package/src/components/utils/getRenderIndexes.ts +0 -33
- package/src/components/utils/getScrollbarWidth.ts +0 -31
- package/src/components/utils/getVirtualRenderCount.ts +0 -21
- package/src/components/utils/isControlled.ts +0 -12
- package/src/components/utils/isControlledValue.ts +0 -5
- package/src/index.tsx +0 -34
- package/src/test.tsx +0 -18
- package/src/utils/DeepMap/index.ts +0 -588
- package/src/utils/DeepMap/once.ts +0 -16
- package/src/utils/DeepMap/sortAscending.ts +0 -1
- package/src/utils/DeepMap/tsconfig.deepmap.json +0 -17
- package/src/utils/DeepMap/xpackage.json +0 -26
- package/src/utils/debug.ts +0 -40
- package/src/utils/deepClone.ts +0 -38
- package/src/utils/getGlobal.ts +0 -3
- package/src/utils/groupAndPivot/defaultToKey.ts +0 -3
- package/src/utils/groupAndPivot/getGroupKeysForDataItem.ts +0 -19
- package/src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts +0 -361
- package/src/utils/groupAndPivot/index.ts +0 -1229
- package/src/utils/groupAndPivot/types.ts +0 -10
- package/src/utils/join.ts +0 -4
- package/src/utils/mathIntersection.ts +0 -21
- package/src/utils/minified.d.ts +0 -2
- package/src/utils/minified.js +0 -6
- package/src/utils/multisort/index.ts +0 -151
- package/src/utils/multisort/sortTypes.ts +0 -25
- package/src/utils/notes-status.md +0 -92
- package/src/utils/pageGeometry/ConvexPoly.ts +0 -34
- package/src/utils/pageGeometry/Point.ts +0 -51
- package/src/utils/pageGeometry/PolyWithPoints.ts +0 -52
- package/src/utils/pageGeometry/Rectangle.ts +0 -98
- package/src/utils/pageGeometry/Triangle.ts +0 -16
- package/src/utils/pageGeometry/alignment/index.ts +0 -221
- package/src/utils/pageGeometry/polyContainsPoint.ts +0 -182
- package/src/utils/pageGeometry/types.ts +0 -3
- package/src/utils/proxyFnCall.ts +0 -46
- package/src/utils/raf.ts +0 -13
- package/src/utils/selectParent.ts +0 -18
- package/src/utils/shallowEqualObjects.ts +0 -49
- package/src/utils/stripVar.ts +0 -3
- package/src/utils/toUpperFirst.ts +0 -5
- package/todo.md +0 -2
- package/tsconfig.build.json +0 -8
- package/tsconfig.dev.json +0 -7
- package/tsconfig.json +0 -30
- package/tsconfig.typebundler.json +0 -13
- package/typedoc.json +0 -4
package/src/index.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export { debounce } from './components/utils/debounce';
|
|
2
|
-
|
|
3
|
-
export * from './components/InfiniteTable';
|
|
4
|
-
|
|
5
|
-
export * from './components/DataSource';
|
|
6
|
-
export * from './components/Menu';
|
|
7
|
-
export * from './components/Menu/MenuProps';
|
|
8
|
-
export * from './components/hooks/useOverlay';
|
|
9
|
-
|
|
10
|
-
import { InfiniteCheckBox } from './components/InfiniteTable/components/CheckBox';
|
|
11
|
-
import { LoadMask } from './components/InfiniteTable/components/LoadMask';
|
|
12
|
-
|
|
13
|
-
export const components = {
|
|
14
|
-
CheckBox: InfiniteCheckBox,
|
|
15
|
-
LoadMask,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { group, flatten } from './utils/groupAndPivot';
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
useComponentState,
|
|
22
|
-
getComponentStateRoot,
|
|
23
|
-
} from './components/hooks/useComponentState';
|
|
24
|
-
|
|
25
|
-
export { interceptMap } from './components/hooks/useInterceptedMap';
|
|
26
|
-
|
|
27
|
-
export { useEffectWithChanges } from './components/hooks/useEffectWithChanges';
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
defaultFilterEditors,
|
|
31
|
-
StringFilterEditor,
|
|
32
|
-
NumberFilterEditor,
|
|
33
|
-
} from './components/InfiniteTable/components/FilterEditors';
|
|
34
|
-
export { defaultFilterTypes } from './components/DataSource/defaultFilterTypes';
|
package/src/test.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as CSS from 'csstype';
|
|
2
|
-
|
|
3
|
-
const x: CSS.PositionProperty = 'relative';
|
|
4
|
-
console.log(x);
|
|
5
|
-
|
|
6
|
-
import * as PropTypes from 'prop-types';
|
|
7
|
-
import { ReactNodeArray } from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import { Dispatch } from 'react';
|
|
10
|
-
|
|
11
|
-
const arr: PropTypes.ReactNodeArray = [];
|
|
12
|
-
const arr1: ReactNodeArray = [];
|
|
13
|
-
|
|
14
|
-
const d: Dispatch<string> = (_x: string) => {};
|
|
15
|
-
|
|
16
|
-
console.log(arr);
|
|
17
|
-
console.log(arr1);
|
|
18
|
-
console.log(d);
|
|
@@ -1,588 +0,0 @@
|
|
|
1
|
-
import { once } from './once';
|
|
2
|
-
import { sortAscending } from './sortAscending';
|
|
3
|
-
|
|
4
|
-
type VoidFn = () => void;
|
|
5
|
-
|
|
6
|
-
type Pair<KeyType, ValueType> = {
|
|
7
|
-
value?: ValueType;
|
|
8
|
-
map?: Map<KeyType, Pair<KeyType, ValueType>>;
|
|
9
|
-
length: number;
|
|
10
|
-
revision?: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const SORT_ASC_REVISION = (p1: Pair<any, any>, p2: Pair<any, any>) =>
|
|
14
|
-
sortAscending(p1.revision!, p2.revision!);
|
|
15
|
-
|
|
16
|
-
export type DeepMapVisitFn<KeyType, ValueType> = (
|
|
17
|
-
pair: Pair<KeyType, ValueType>,
|
|
18
|
-
keys: KeyType[],
|
|
19
|
-
next: VoidFn,
|
|
20
|
-
) => void;
|
|
21
|
-
|
|
22
|
-
export class DeepMap<KeyType, ValueType> {
|
|
23
|
-
private map = new Map<KeyType, Pair<KeyType, ValueType>>();
|
|
24
|
-
private length = 0;
|
|
25
|
-
private revision = 0;
|
|
26
|
-
private emptyKey = Symbol('emptyKey') as any as KeyType;
|
|
27
|
-
|
|
28
|
-
static clone<KeyType, ValueType>(map: DeepMap<KeyType, ValueType>) {
|
|
29
|
-
const clone = new DeepMap<KeyType, ValueType>();
|
|
30
|
-
|
|
31
|
-
map.visit((pair, keys) => {
|
|
32
|
-
clone.set(keys, pair.value!);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return clone;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
constructor(initial?: [KeyType[], ValueType][]) {
|
|
39
|
-
this.fill(initial);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
fill(initial?: [KeyType[], ValueType][]) {
|
|
43
|
-
if (initial) {
|
|
44
|
-
initial.forEach((entry) => {
|
|
45
|
-
const [keys, value] = entry;
|
|
46
|
-
|
|
47
|
-
this.set(keys, value);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
getValuesStartingWith(
|
|
53
|
-
keys: KeyType[],
|
|
54
|
-
excludeSelf?: boolean,
|
|
55
|
-
depthLimit?: number,
|
|
56
|
-
): ValueType[] {
|
|
57
|
-
const result: ValueType[] = [];
|
|
58
|
-
this.getStartingWith(
|
|
59
|
-
keys,
|
|
60
|
-
(_keys, value) => {
|
|
61
|
-
result.push(value);
|
|
62
|
-
},
|
|
63
|
-
excludeSelf,
|
|
64
|
-
depthLimit,
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
getKeysStartingWith(
|
|
71
|
-
keys: KeyType[],
|
|
72
|
-
excludeSelf?: boolean,
|
|
73
|
-
depthLimit?: number,
|
|
74
|
-
): KeyType[][] {
|
|
75
|
-
const result: KeyType[][] = [];
|
|
76
|
-
this.getStartingWith(
|
|
77
|
-
keys,
|
|
78
|
-
(keys) => {
|
|
79
|
-
result.push(keys);
|
|
80
|
-
},
|
|
81
|
-
excludeSelf,
|
|
82
|
-
depthLimit,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private getStartingWith(
|
|
89
|
-
keys: KeyType[],
|
|
90
|
-
fn: (key: KeyType[], value: ValueType) => void,
|
|
91
|
-
excludeSelf?: boolean,
|
|
92
|
-
depthLimit?: number,
|
|
93
|
-
) {
|
|
94
|
-
let currentMap = this.map;
|
|
95
|
-
let pair: Pair<KeyType, ValueType> | undefined;
|
|
96
|
-
let stop = false;
|
|
97
|
-
|
|
98
|
-
if (keys.length) {
|
|
99
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
100
|
-
const key = keys[i];
|
|
101
|
-
|
|
102
|
-
pair = currentMap.get(key);
|
|
103
|
-
|
|
104
|
-
if (!pair || !pair.map) {
|
|
105
|
-
stop = true;
|
|
106
|
-
if (i === len - 1) {
|
|
107
|
-
// if on the last key
|
|
108
|
-
// we want to allow the if clause below to run and check if the value on the last
|
|
109
|
-
// pair is present
|
|
110
|
-
stop = true;
|
|
111
|
-
break;
|
|
112
|
-
} else {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
currentMap = pair.map;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (pair && pair.value !== undefined) {
|
|
122
|
-
if (!excludeSelf) {
|
|
123
|
-
fn(keys, pair.value!);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (stop) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
this.visitWithNext(
|
|
131
|
-
keys,
|
|
132
|
-
(value, keys, _i, next) => {
|
|
133
|
-
fn(keys, value);
|
|
134
|
-
next?.();
|
|
135
|
-
},
|
|
136
|
-
currentMap,
|
|
137
|
-
depthLimit,
|
|
138
|
-
excludeSelf,
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private getMapAt(keys: KeyType[]) {
|
|
143
|
-
let currentMap = this.map;
|
|
144
|
-
let pair: Pair<KeyType, ValueType> | undefined;
|
|
145
|
-
if (!keys.length) {
|
|
146
|
-
return this.map;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
150
|
-
const key = keys[i];
|
|
151
|
-
|
|
152
|
-
pair = currentMap.get(key);
|
|
153
|
-
|
|
154
|
-
if (!pair || !pair.map) {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
currentMap = pair.map;
|
|
159
|
-
}
|
|
160
|
-
return currentMap;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getAllChildrenSizeFor(keys: KeyType[]) {
|
|
164
|
-
let currentMap = this.map;
|
|
165
|
-
let pair: Pair<KeyType, ValueType> | undefined;
|
|
166
|
-
if (!keys.length) {
|
|
167
|
-
return this.length;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
171
|
-
const key = keys[i];
|
|
172
|
-
|
|
173
|
-
pair = currentMap.get(key);
|
|
174
|
-
|
|
175
|
-
if (!pair || !pair.map) {
|
|
176
|
-
return 0;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
currentMap = pair.map;
|
|
180
|
-
}
|
|
181
|
-
return pair!.length;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
getDirectChildrenSizeFor(keys: KeyType[]) {
|
|
185
|
-
let currentMap = this.map;
|
|
186
|
-
if (!keys.length) {
|
|
187
|
-
keys = [this.emptyKey];
|
|
188
|
-
}
|
|
189
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
190
|
-
const key = keys[i];
|
|
191
|
-
const last = i === len - 1;
|
|
192
|
-
const pair = currentMap.get(key);
|
|
193
|
-
|
|
194
|
-
if (!pair || !pair.map) {
|
|
195
|
-
return 0;
|
|
196
|
-
}
|
|
197
|
-
currentMap = pair.map;
|
|
198
|
-
if (last) {
|
|
199
|
-
return currentMap?.size ?? 0;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return 0;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
set(keys: KeyType[] & { length: Omit<number, 0> }, value: ValueType) {
|
|
206
|
-
let currentMap = this.map;
|
|
207
|
-
if (!keys.length) {
|
|
208
|
-
keys = [this.emptyKey];
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
212
|
-
const key = keys[i];
|
|
213
|
-
const last = i === len - 1;
|
|
214
|
-
const pair = currentMap.get(key)! || {
|
|
215
|
-
length: 0,
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
if (last) {
|
|
219
|
-
pair.revision = this.revision++;
|
|
220
|
-
pair.value = value;
|
|
221
|
-
|
|
222
|
-
currentMap.set(key, pair);
|
|
223
|
-
this.length++;
|
|
224
|
-
} else {
|
|
225
|
-
if (!pair.map) {
|
|
226
|
-
pair.map = new Map<KeyType, Pair<KeyType, ValueType>>();
|
|
227
|
-
currentMap.set(key, pair);
|
|
228
|
-
}
|
|
229
|
-
pair.length++;
|
|
230
|
-
|
|
231
|
-
currentMap = pair.map;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return this;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
get(keys: KeyType[]): ValueType | undefined {
|
|
239
|
-
let currentMap = this.map;
|
|
240
|
-
if (!keys.length) {
|
|
241
|
-
keys = [this.emptyKey];
|
|
242
|
-
}
|
|
243
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
244
|
-
const key = keys[i];
|
|
245
|
-
const last = i === len - 1;
|
|
246
|
-
const pair = currentMap.get(key);
|
|
247
|
-
if (last) {
|
|
248
|
-
return pair ? pair.value : undefined;
|
|
249
|
-
} else {
|
|
250
|
-
if (!pair || !pair.map) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
currentMap = pair.map;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
get size() {
|
|
260
|
-
return this.length;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
clear() {
|
|
264
|
-
const clearMap = (map: Map<KeyType, Pair<KeyType, ValueType>>) => {
|
|
265
|
-
map.forEach((value, _key) => {
|
|
266
|
-
const { map } = value;
|
|
267
|
-
if (map) {
|
|
268
|
-
clearMap(map);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
map.clear();
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
clearMap(this.map);
|
|
276
|
-
|
|
277
|
-
this.length = 0;
|
|
278
|
-
this.revision = 0;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
delete(keys: KeyType[]): boolean {
|
|
282
|
-
let currentMap = this.map;
|
|
283
|
-
if (!keys.length) {
|
|
284
|
-
keys = [this.emptyKey];
|
|
285
|
-
} else {
|
|
286
|
-
keys = [...keys];
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const maps = [currentMap];
|
|
290
|
-
const pairs = [];
|
|
291
|
-
|
|
292
|
-
let result = false;
|
|
293
|
-
|
|
294
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
295
|
-
const key = keys[i];
|
|
296
|
-
const last = i === len - 1;
|
|
297
|
-
const pair = currentMap.get(key);
|
|
298
|
-
if (last) {
|
|
299
|
-
if (pair) {
|
|
300
|
-
if (pair.hasOwnProperty('value')) {
|
|
301
|
-
delete pair.value;
|
|
302
|
-
delete pair.revision;
|
|
303
|
-
|
|
304
|
-
result = true;
|
|
305
|
-
pairs.forEach((pair) => {
|
|
306
|
-
pair.length--;
|
|
307
|
-
});
|
|
308
|
-
this.length--;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (pair.map && pair.map.size === 0) {
|
|
312
|
-
delete pair.map;
|
|
313
|
-
}
|
|
314
|
-
if (!pair.map) {
|
|
315
|
-
// pair is empty, so we can remove it altogether
|
|
316
|
-
currentMap.delete(key);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
break;
|
|
321
|
-
} else {
|
|
322
|
-
if (!pair || !pair.map) {
|
|
323
|
-
result = false;
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
pairs.push(pair);
|
|
327
|
-
currentMap = pair.map;
|
|
328
|
-
maps.push(currentMap);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
while (maps.length) {
|
|
333
|
-
const map = maps.pop();
|
|
334
|
-
const keysLen = keys.length;
|
|
335
|
-
keys.pop();
|
|
336
|
-
if (keysLen > 0 && map?.size === 0) {
|
|
337
|
-
const parentMap = maps[maps.length - 1];
|
|
338
|
-
const parentKey = keys[keys.length - 1];
|
|
339
|
-
const pair = parentMap?.get(parentKey);
|
|
340
|
-
if (pair) {
|
|
341
|
-
// pair.map === map ; which can be deleted
|
|
342
|
-
delete pair.map;
|
|
343
|
-
|
|
344
|
-
if (!pair.hasOwnProperty('value')) {
|
|
345
|
-
// whole pair can be successfully deleted from parentMap
|
|
346
|
-
parentMap.delete(parentKey);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
return result;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
has(keys: KeyType[]) {
|
|
355
|
-
let currentMap = this.map;
|
|
356
|
-
if (!keys.length) {
|
|
357
|
-
keys = [this.emptyKey];
|
|
358
|
-
}
|
|
359
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
360
|
-
const key = keys[i];
|
|
361
|
-
const last = i === len - 1;
|
|
362
|
-
const pair = currentMap.get(key);
|
|
363
|
-
if (last) {
|
|
364
|
-
return pair ? pair.hasOwnProperty('value') : false;
|
|
365
|
-
} else {
|
|
366
|
-
if (!pair || !pair.map) {
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
currentMap = pair.map;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
private visitKey(
|
|
376
|
-
key: KeyType,
|
|
377
|
-
currentMap: Map<KeyType, Pair<KeyType, ValueType>>,
|
|
378
|
-
parentKeys: KeyType[],
|
|
379
|
-
fn: DeepMapVisitFn<KeyType, ValueType>,
|
|
380
|
-
) {
|
|
381
|
-
const pair = currentMap.get(key);
|
|
382
|
-
|
|
383
|
-
if (!pair) {
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
const { map } = pair;
|
|
387
|
-
|
|
388
|
-
const keys = key === this.emptyKey ? [] : [...parentKeys, key];
|
|
389
|
-
|
|
390
|
-
const next = once(() => {
|
|
391
|
-
if (map) {
|
|
392
|
-
map.forEach((_, k) => {
|
|
393
|
-
this.visitKey(k, map, keys, fn);
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
if (pair.hasOwnProperty('value')) {
|
|
399
|
-
fn(pair, keys, next);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// if it was called by fn, it won't be called again, as it's once-d
|
|
403
|
-
next();
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
visit = (fn: DeepMapVisitFn<KeyType, ValueType>) => {
|
|
407
|
-
this.map.forEach((_, k) => this.visitKey(k, this.map, [], fn));
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
visitDepthFirst = (
|
|
411
|
-
fn: (
|
|
412
|
-
value: ValueType,
|
|
413
|
-
keys: KeyType[],
|
|
414
|
-
indexInGroup: number,
|
|
415
|
-
next?: VoidFn,
|
|
416
|
-
) => void,
|
|
417
|
-
) => {
|
|
418
|
-
this.visitWithNext([], fn);
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
private visitWithNext = (
|
|
422
|
-
parentKeys: KeyType[],
|
|
423
|
-
|
|
424
|
-
fn: (
|
|
425
|
-
value: ValueType,
|
|
426
|
-
keys: KeyType[],
|
|
427
|
-
indexInGroup: number,
|
|
428
|
-
next?: VoidFn,
|
|
429
|
-
) => void,
|
|
430
|
-
currentMap: Map<KeyType, Pair<KeyType, ValueType>> = this.map,
|
|
431
|
-
depthLimit?: number,
|
|
432
|
-
skipSelfValue?: boolean,
|
|
433
|
-
) => {
|
|
434
|
-
if (!currentMap) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
let i = 0;
|
|
438
|
-
const hasEmptyKey = currentMap.has(this.emptyKey);
|
|
439
|
-
let allowEmptyKey = skipSelfValue ? false : true;
|
|
440
|
-
|
|
441
|
-
if (depthLimit !== undefined) {
|
|
442
|
-
if (depthLimit < 0) {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
depthLimit--;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const iterator = (_: Pair<KeyType, ValueType>, key: KeyType) => {
|
|
449
|
-
const pair = currentMap.get(key);
|
|
450
|
-
|
|
451
|
-
if (!pair) {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
const { map } = pair;
|
|
455
|
-
|
|
456
|
-
const isEmptyKey = key === this.emptyKey;
|
|
457
|
-
if (isEmptyKey && !allowEmptyKey) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
const keys = isEmptyKey ? [] : [...parentKeys, key];
|
|
461
|
-
|
|
462
|
-
let next = map
|
|
463
|
-
? () =>
|
|
464
|
-
this.visitWithNext(
|
|
465
|
-
keys,
|
|
466
|
-
fn,
|
|
467
|
-
map,
|
|
468
|
-
depthLimit !== undefined ? depthLimit - 1 : undefined,
|
|
469
|
-
)
|
|
470
|
-
: undefined;
|
|
471
|
-
|
|
472
|
-
if (pair.hasOwnProperty('value')) {
|
|
473
|
-
fn(pair.value!, keys, i, next);
|
|
474
|
-
i++;
|
|
475
|
-
} else {
|
|
476
|
-
next?.();
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
if (hasEmptyKey) {
|
|
481
|
-
iterator(undefined as any as Pair<KeyType, ValueType>, this.emptyKey);
|
|
482
|
-
allowEmptyKey = false;
|
|
483
|
-
i = 0;
|
|
484
|
-
}
|
|
485
|
-
currentMap.forEach(iterator);
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
private getArray<ReturnType>(
|
|
489
|
-
fn: (pair: Pair<KeyType, ValueType> & { keys: KeyType[] }) => ReturnType,
|
|
490
|
-
) {
|
|
491
|
-
const result: ReturnType[] = [];
|
|
492
|
-
|
|
493
|
-
this.visit((pair, keys) => {
|
|
494
|
-
const res = fn({ ...pair, keys });
|
|
495
|
-
if (keys.length === 0) {
|
|
496
|
-
result.splice(0, 0, res);
|
|
497
|
-
} else {
|
|
498
|
-
result.push(res);
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
return result;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
valuesAt(keys: KeyType[]): ValueType[] {
|
|
506
|
-
const map = this.getMapAt(keys);
|
|
507
|
-
if (!map) {
|
|
508
|
-
return [];
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
const result: ValueType[] = [];
|
|
512
|
-
map.forEach((bag) => {
|
|
513
|
-
if (bag.value !== undefined) {
|
|
514
|
-
result.push(bag.value);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
return result;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
values() {
|
|
522
|
-
return this.sortedIterator<ValueType>((pair) => pair.value!);
|
|
523
|
-
}
|
|
524
|
-
keys() {
|
|
525
|
-
const keys = this.sortedIterator<KeyType[]>((pair) => pair.keys);
|
|
526
|
-
|
|
527
|
-
return keys;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
entries() {
|
|
531
|
-
return this.sortedIterator<[KeyType[], ValueType]>((pair) => [
|
|
532
|
-
pair.keys,
|
|
533
|
-
pair.value!,
|
|
534
|
-
]);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
topDownEntries() {
|
|
538
|
-
return this.getArray<[KeyType[], ValueType]>((pair) => [
|
|
539
|
-
pair.keys,
|
|
540
|
-
pair.value!,
|
|
541
|
-
]);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
topDownKeys() {
|
|
545
|
-
return this.getArray<KeyType[]>((pair) => pair.keys);
|
|
546
|
-
}
|
|
547
|
-
topDownValues() {
|
|
548
|
-
return this.getArray<ValueType>((pair) => pair.value!);
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
private sortedIterator<ReturnType>(
|
|
552
|
-
fn: (pair: Pair<KeyType, ValueType> & { keys: KeyType[] }) => ReturnType,
|
|
553
|
-
) {
|
|
554
|
-
const result: (Pair<KeyType, ValueType> & { keys: KeyType[] })[] = [];
|
|
555
|
-
|
|
556
|
-
this.visit((pair, keys) => {
|
|
557
|
-
result.push({ ...pair, keys });
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
result.sort(SORT_ASC_REVISION);
|
|
561
|
-
|
|
562
|
-
function* makeIterator() {
|
|
563
|
-
for (let i = 0, len = result.length; i < len; i++) {
|
|
564
|
-
yield fn(result[i]);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
return makeIterator();
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// private iterator<ReturnType>(
|
|
572
|
-
// fn: (pair: Pair<KeyType, ValueType> & { keys: KeyType[] }) => ReturnType,
|
|
573
|
-
// ) {
|
|
574
|
-
// const result: (Pair<KeyType, ValueType> & { keys: KeyType[] })[] = [];
|
|
575
|
-
|
|
576
|
-
// this.visit((pair, keys) => {
|
|
577
|
-
// result.push({ ...pair, keys });
|
|
578
|
-
// });
|
|
579
|
-
|
|
580
|
-
// function* makeIterator() {
|
|
581
|
-
// for (let i = 0, len = result.length; i < len; i++) {
|
|
582
|
-
// yield fn(result[i]);
|
|
583
|
-
// }
|
|
584
|
-
// }
|
|
585
|
-
|
|
586
|
-
// return makeIterator();
|
|
587
|
-
// }
|
|
588
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function once<ReturnType>(fn: () => ReturnType): () => ReturnType {
|
|
2
|
-
let called = false;
|
|
3
|
-
let result: ReturnType | null = null;
|
|
4
|
-
|
|
5
|
-
const onceFn = () => {
|
|
6
|
-
if (called) {
|
|
7
|
-
return result!;
|
|
8
|
-
}
|
|
9
|
-
called = true;
|
|
10
|
-
result = fn();
|
|
11
|
-
|
|
12
|
-
return result;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return onceFn;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const sortAscending = (a: number, b: number) => a - b;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"rootDir": ".",
|
|
4
|
-
/* Basic Options */
|
|
5
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
6
|
-
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
|
7
|
-
"module": "system" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
|
8
|
-
"declaration": true,
|
|
9
|
-
|
|
10
|
-
/* Strict Type-Checking Options */
|
|
11
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
12
|
-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
13
|
-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
14
|
-
},
|
|
15
|
-
"include": ["index.ts"],
|
|
16
|
-
"exclude": ["node_modules", "dist", "dist-deepmap"]
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@infinite-table/deep-map",
|
|
3
|
-
"description": "DeepMap structure - ala Map but with keys being arrays",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"module": "index.esm.js",
|
|
7
|
-
"typings": "types.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "npm run esbuild && npm run tsc",
|
|
10
|
-
"tsc": "tsc --emitDeclarationOnly --project tsconfig.deepmap.json --outFile ../../../dist-deepmap/types.d.ts ",
|
|
11
|
-
"esbuild": "npm run esbuild-esm && npm run esbuild-cjs",
|
|
12
|
-
"esbuild-esm": "node ../../../run-build-deepmap.js esm",
|
|
13
|
-
"esbuild-cjs": "node ../../../run-build-deepmap.js cjs",
|
|
14
|
-
"///": "//",
|
|
15
|
-
"bump:canary": "npm version prerelease --preid=canary",
|
|
16
|
-
"bump:major:canary": "npm version premajor --preid=canary",
|
|
17
|
-
"bump:minor:canary": "npm version preminor --preid=canary",
|
|
18
|
-
"bump:patch:canary": "npm version prepatch --preid=canary",
|
|
19
|
-
"////": "//",
|
|
20
|
-
"bump:patch": "npm version patch",
|
|
21
|
-
"bump:minor": "npm version minor",
|
|
22
|
-
"bump:major": "npm version major"
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
"license": "MIT"
|
|
26
|
-
}
|