@tanstack/react-table 8.0.0-alpha.7 → 8.0.0-alpha.70

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.
Files changed (113) hide show
  1. package/build/cjs/react-table/src/index.js +133 -0
  2. package/build/cjs/react-table/src/index.js.map +1 -0
  3. package/build/cjs/table-core/build/esm/index.js +4033 -0
  4. package/build/cjs/table-core/build/esm/index.js.map +1 -0
  5. package/build/esm/index.js +3342 -4072
  6. package/build/esm/index.js.map +1 -1
  7. package/build/stats-html.html +1 -1
  8. package/build/stats-react.json +24 -783
  9. package/build/types/index.d.ts +16 -8
  10. package/build/umd/index.development.js +3372 -4072
  11. package/build/umd/index.development.js.map +1 -1
  12. package/build/umd/index.production.js +11 -1
  13. package/build/umd/index.production.js.map +1 -1
  14. package/package.json +5 -1
  15. package/src/index.tsx +113 -8
  16. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -112
  17. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  18. package/build/cjs/aggregationTypes.js +0 -130
  19. package/build/cjs/aggregationTypes.js.map +0 -1
  20. package/build/cjs/core.js +0 -552
  21. package/build/cjs/core.js.map +0 -1
  22. package/build/cjs/createTable.js +0 -122
  23. package/build/cjs/createTable.js.map +0 -1
  24. package/build/cjs/features/ColumnSizing.js +0 -317
  25. package/build/cjs/features/ColumnSizing.js.map +0 -1
  26. package/build/cjs/features/Expanding.js +0 -251
  27. package/build/cjs/features/Expanding.js.map +0 -1
  28. package/build/cjs/features/Filters.js +0 -445
  29. package/build/cjs/features/Filters.js.map +0 -1
  30. package/build/cjs/features/Grouping.js +0 -249
  31. package/build/cjs/features/Grouping.js.map +0 -1
  32. package/build/cjs/features/Headers.js +0 -549
  33. package/build/cjs/features/Headers.js.map +0 -1
  34. package/build/cjs/features/Ordering.js +0 -86
  35. package/build/cjs/features/Ordering.js.map +0 -1
  36. package/build/cjs/features/Pagination.js +0 -198
  37. package/build/cjs/features/Pagination.js.map +0 -1
  38. package/build/cjs/features/Pinning.js +0 -149
  39. package/build/cjs/features/Pinning.js.map +0 -1
  40. package/build/cjs/features/RowSelection.js +0 -541
  41. package/build/cjs/features/RowSelection.js.map +0 -1
  42. package/build/cjs/features/Sorting.js +0 -327
  43. package/build/cjs/features/Sorting.js.map +0 -1
  44. package/build/cjs/features/Visibility.js +0 -166
  45. package/build/cjs/features/Visibility.js.map +0 -1
  46. package/build/cjs/filterTypes.js +0 -172
  47. package/build/cjs/filterTypes.js.map +0 -1
  48. package/build/cjs/index.js +0 -32
  49. package/build/cjs/index.js.map +0 -1
  50. package/build/cjs/sortTypes.js +0 -122
  51. package/build/cjs/sortTypes.js.map +0 -1
  52. package/build/cjs/utils/columnFilterRowsFn.js +0 -131
  53. package/build/cjs/utils/columnFilterRowsFn.js.map +0 -1
  54. package/build/cjs/utils/expandRowsFn.js +0 -38
  55. package/build/cjs/utils/expandRowsFn.js.map +0 -1
  56. package/build/cjs/utils/globalFilterRowsFn.js +0 -101
  57. package/build/cjs/utils/globalFilterRowsFn.js.map +0 -1
  58. package/build/cjs/utils/groupRowsFn.js +0 -155
  59. package/build/cjs/utils/groupRowsFn.js.map +0 -1
  60. package/build/cjs/utils/paginateRowsFn.js +0 -44
  61. package/build/cjs/utils/paginateRowsFn.js.map +0 -1
  62. package/build/cjs/utils/sortRowsFn.js +0 -94
  63. package/build/cjs/utils/sortRowsFn.js.map +0 -1
  64. package/build/cjs/utils.js +0 -141
  65. package/build/cjs/utils.js.map +0 -1
  66. package/build/types/aggregationTypes.d.ts +0 -22
  67. package/build/types/core.d.ts +0 -109
  68. package/build/types/createTable.d.ts +0 -52
  69. package/build/types/features/ColumnSizing.d.ts +0 -67
  70. package/build/types/features/Expanding.d.ts +0 -53
  71. package/build/types/features/Filters.d.ts +0 -98
  72. package/build/types/features/Grouping.d.ts +0 -82
  73. package/build/types/features/Headers.d.ts +0 -41
  74. package/build/types/features/Ordering.d.ts +0 -19
  75. package/build/types/features/Pagination.d.ts +0 -44
  76. package/build/types/features/Pinning.d.ts +0 -39
  77. package/build/types/features/RowSelection.d.ts +0 -66
  78. package/build/types/features/Sorting.d.ts +0 -78
  79. package/build/types/features/Visibility.d.ts +0 -47
  80. package/build/types/filterTypes.d.ts +0 -50
  81. package/build/types/sortTypes.d.ts +0 -18
  82. package/build/types/types.d.ts +0 -127
  83. package/build/types/utils/columnFilterRowsFn.d.ts +0 -2
  84. package/build/types/utils/expandRowsFn.d.ts +0 -2
  85. package/build/types/utils/globalFilterRowsFn.d.ts +0 -2
  86. package/build/types/utils/groupRowsFn.d.ts +0 -2
  87. package/build/types/utils/paginateRowsFn.d.ts +0 -2
  88. package/build/types/utils/sortRowsFn.d.ts +0 -2
  89. package/build/types/utils.d.ts +0 -24
  90. package/src/aggregationTypes.ts +0 -115
  91. package/src/core.tsx +0 -1091
  92. package/src/createTable.tsx +0 -264
  93. package/src/features/ColumnSizing.ts +0 -453
  94. package/src/features/Expanding.ts +0 -406
  95. package/src/features/Filters.ts +0 -762
  96. package/src/features/Grouping.ts +0 -466
  97. package/src/features/Headers.ts +0 -912
  98. package/src/features/Ordering.ts +0 -133
  99. package/src/features/Pagination.ts +0 -325
  100. package/src/features/Pinning.ts +0 -198
  101. package/src/features/RowSelection.ts +0 -831
  102. package/src/features/Sorting.ts +0 -547
  103. package/src/features/Visibility.ts +0 -279
  104. package/src/filterTypes.ts +0 -251
  105. package/src/sortTypes.ts +0 -159
  106. package/src/types.ts +0 -331
  107. package/src/utils/columnFilterRowsFn.ts +0 -155
  108. package/src/utils/expandRowsFn.ts +0 -50
  109. package/src/utils/globalFilterRowsFn.ts +0 -122
  110. package/src/utils/groupRowsFn.ts +0 -194
  111. package/src/utils/paginateRowsFn.ts +0 -34
  112. package/src/utils/sortRowsFn.ts +0 -115
  113. package/src/utils.tsx +0 -195
@@ -1,194 +0,0 @@
1
- import { ReactTable, Row, RowModel } from '../types'
2
- import { flattenBy } from '../utils'
3
-
4
- export function groupRowsFn<
5
- TData,
6
- TValue,
7
- TFilterFns,
8
- TSortingFns,
9
- TAggregationFns
10
- >(
11
- instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>,
12
- sortedRowModel: RowModel<
13
- TData,
14
- TValue,
15
- TFilterFns,
16
- TSortingFns,
17
- TAggregationFns
18
- >
19
- ): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> {
20
- const groupingState = instance.getState().grouping
21
- // Filter the grouping list down to columns that exist
22
- const existingGrouping = groupingState.filter(columnId =>
23
- instance.getColumn(columnId)
24
- )
25
-
26
- // Find the columns that can or are aggregating
27
- // Uses each column to aggregate rows into a single value
28
- const aggregateRowsToValues = (
29
- leafRows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[],
30
- groupedRows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[],
31
- depth: number
32
- ) => {
33
- const values: Record<string, unknown> = {}
34
-
35
- instance.getAllLeafColumns().forEach(column => {
36
- // Don't aggregate columns that are in the grouping
37
- if (existingGrouping.includes(column.id)) {
38
- values[column.id] = groupedRows[0]
39
- ? groupedRows[0].values[column.id]
40
- : null
41
- return
42
- }
43
-
44
- // Aggregate the values
45
- const aggregateFn = instance.getColumnAggregationFn(column.id)
46
-
47
- if (aggregateFn) {
48
- // Get the columnValues to aggregate
49
- const groupedValues = groupedRows.map(row => row.values[column.id])
50
-
51
- // Get the columnValues to aggregate
52
- const leafValues = leafRows.map(row => {
53
- let columnValue = row.values[column.id]
54
-
55
- if (!depth && column.aggregateValue) {
56
- columnValue = column.aggregateValue(columnValue)
57
- }
58
-
59
- return columnValue
60
- })
61
-
62
- values[column.id] = aggregateFn(leafValues, groupedValues)
63
- } else if (column.aggregationType) {
64
- console.info({ column })
65
- throw new Error(
66
- process.env.NODE_ENV !== 'production'
67
- ? `React Table: Invalid column.aggregateType option for column listed above`
68
- : ''
69
- )
70
- } else {
71
- values[column.id] = null
72
- }
73
- })
74
-
75
- return values
76
- }
77
-
78
- const groupedFlatRows: Row<
79
- TData,
80
- TValue,
81
- TFilterFns,
82
- TSortingFns,
83
- TAggregationFns
84
- >[] = []
85
- const groupedRowsById: Record<
86
- string,
87
- Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
88
- > = {}
89
- // const onlyGroupedFlatRows: Row[] = [];
90
- // const onlyGroupedRowsById: Record<RowId, Row> = {};
91
- // const nonGroupedFlatRows: Row[] = [];
92
- // const nonGroupedRowsById: Record<RowId, Row> = {};
93
-
94
- // Recursively group the data
95
- const groupUpRecursively = (
96
- rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[],
97
- depth = 0,
98
- parentId: string
99
- ) => {
100
- // This is the last level, just return the rows
101
- if (depth === existingGrouping.length) {
102
- return rows
103
- }
104
-
105
- const columnId = existingGrouping[depth]!
106
-
107
- // Group the rows together for this level
108
- const rowGroupsMap = groupBy(rows, columnId)
109
-
110
- // Peform aggregations for each group
111
- const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(
112
- ([groupingValue, groupedRows], index) => {
113
- let id = `${columnId}:${groupingValue}`
114
- id = parentId ? `${parentId}>${id}` : id
115
-
116
- // First, Recurse to group sub rows before aggregation
117
- const subRows = groupUpRecursively(groupedRows, depth + 1, id)
118
-
119
- // Flatten the leaf rows of the rows in this group
120
- const leafRows = depth
121
- ? flattenBy(groupedRows, row => row.leafRows)
122
- : groupedRows
123
-
124
- const values = aggregateRowsToValues(leafRows, groupedRows, depth)
125
-
126
- const row = instance.createRow(id, undefined, index, depth, values)
127
-
128
- Object.assign(row, {
129
- groupingColumnId: columnId,
130
- groupingValue,
131
- subRows,
132
- leafRows,
133
- })
134
-
135
- subRows.forEach(subRow => {
136
- groupedFlatRows.push(subRow)
137
- groupedRowsById[subRow.id] = subRow
138
- // if (subRow.getIsGrouped?.()) {
139
- // onlyGroupedFlatRows.push(subRow);
140
- // onlyGroupedRowsById[subRow.id] = subRow;
141
- // } else {
142
- // nonGroupedFlatRows.push(subRow);
143
- // nonGroupedRowsById[subRow.id] = subRow;
144
- // }
145
- })
146
-
147
- return row
148
- }
149
- )
150
-
151
- return aggregatedGroupedRows
152
- }
153
-
154
- const groupedRows = groupUpRecursively(sortedRowModel.rows, 0, '')
155
-
156
- groupedRows.forEach(subRow => {
157
- groupedFlatRows.push(subRow)
158
- groupedRowsById[subRow.id] = subRow
159
- // if (subRow.getIsGrouped?.()) {
160
- // onlyGroupedFlatRows.push(subRow);
161
- // onlyGroupedRowsById[subRow.id] = subRow;
162
- // } else {
163
- // nonGroupedFlatRows.push(subRow);
164
- // nonGroupedRowsById[subRow.id] = subRow;
165
- // }
166
- })
167
-
168
- return {
169
- rows: groupedRows,
170
- flatRows: groupedFlatRows,
171
- rowsById: groupedRowsById,
172
- }
173
- }
174
-
175
- function groupBy<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(
176
- rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[],
177
- columnId: string
178
- ) {
179
- const groupMap = new Map<
180
- any,
181
- Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[]
182
- >()
183
-
184
- return rows.reduce((map, row) => {
185
- const resKey = `${row.values[columnId]}`
186
- const previous = map.get(resKey)
187
- if (!previous) {
188
- map.set(resKey, [row])
189
- } else {
190
- map.set(resKey, [...previous, row])
191
- }
192
- return map
193
- }, groupMap)
194
- }
@@ -1,34 +0,0 @@
1
- import { ReactTable, RowModel } from '../types'
2
- import { expandRowsFn } from './expandRowsFn'
3
-
4
- export function paginateRowsFn<
5
- TData,
6
- TValue,
7
- TFilterFns,
8
- TSortingFns,
9
- TAggregationFns
10
- >(
11
- instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>,
12
- rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
13
- ): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> {
14
- const { pageSize, pageIndex } = instance.getState().pagination
15
- let { rows, flatRows, rowsById } = rowModel
16
- const pageStart = pageSize * pageIndex
17
- const pageEnd = pageStart + pageSize
18
-
19
- rows = rows.slice(pageStart, pageEnd)
20
-
21
- if (!instance.options.paginateExpandedRows) {
22
- return expandRowsFn(instance, {
23
- rows,
24
- flatRows,
25
- rowsById,
26
- })
27
- }
28
-
29
- return {
30
- rows,
31
- flatRows,
32
- rowsById,
33
- }
34
- }
@@ -1,115 +0,0 @@
1
- import { ReactTable, Row, RowModel } from '../types'
2
- import { SortingFn } from '../features/Sorting'
3
-
4
- export function sortRowsFn<
5
- TData,
6
- TValue,
7
- TFilterFns,
8
- TSortingFns,
9
- TAggregationFns
10
- >(
11
- instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>,
12
- rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>
13
- ): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> {
14
- const sortingState = instance.getState().sorting
15
-
16
- const sortedFlatRows: Row<
17
- TData,
18
- TValue,
19
- TFilterFns,
20
- TSortingFns,
21
- TAggregationFns
22
- >[] = []
23
-
24
- // Filter out sortings that correspond to non existing columns
25
- const availableSorting = sortingState.filter(sort =>
26
- instance.getColumnCanSort(sort.id)
27
- )
28
-
29
- const columnInfoById: Record<
30
- string,
31
- {
32
- sortUndefined?: false | -1 | 1
33
- invertSorting?: boolean
34
- sortingFn: SortingFn<
35
- TData,
36
- TValue,
37
- TFilterFns,
38
- TSortingFns,
39
- TAggregationFns
40
- >
41
- }
42
- > = {}
43
-
44
- availableSorting.forEach(sortEntry => {
45
- const column = instance.getColumn(sortEntry.id)!
46
-
47
- columnInfoById[sortEntry.id] = {
48
- sortUndefined: column.sortUndefined,
49
- invertSorting: column.invertSorting,
50
- sortingFn: instance.getColumnSortingFn(sortEntry.id)!,
51
- }
52
- })
53
-
54
- const sortData = (
55
- rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[]
56
- ) => {
57
- // This will also perform a stable sorting using the row index
58
- // if needed.
59
- const sortedData = rows.slice()
60
-
61
- sortedData.sort((rowA, rowB) => {
62
- for (let i = 0; i < availableSorting.length; i += 1) {
63
- const sortEntry = availableSorting[i]!
64
- const columnInfo = columnInfoById[sortEntry.id]!
65
- const isDesc = sortEntry?.desc ?? false
66
-
67
- if (columnInfo.sortUndefined) {
68
- const aValue = rowA.values[sortEntry.id]
69
- const bValue = rowB.values[sortEntry.id]
70
-
71
- const aUndefined = typeof aValue === 'undefined'
72
- const bUndefined = typeof bValue === 'undefined'
73
-
74
- if (aUndefined || bUndefined) {
75
- return aUndefined && bUndefined ? 0 : aUndefined ? 1 : -1
76
- }
77
- }
78
-
79
- // This function should always return in ascending order
80
- let sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)
81
-
82
- if (sortInt !== 0) {
83
- if (isDesc) {
84
- sortInt *= -1
85
- }
86
-
87
- if (columnInfo.invertSorting) {
88
- sortInt *= -1
89
- }
90
-
91
- return sortInt
92
- }
93
- }
94
-
95
- return rowA.index - rowB.index
96
- })
97
-
98
- // If there are sub-rows, sort them
99
- sortedData.forEach(row => {
100
- sortedFlatRows.push(row)
101
- if (!row.subRows || row.subRows.length <= 1) {
102
- return
103
- }
104
- row.subRows = sortData(row.subRows)
105
- })
106
-
107
- return sortedData
108
- }
109
-
110
- return {
111
- rows: sortData(rowModel.rows),
112
- flatRows: sortedFlatRows,
113
- rowsById: rowModel.rowsById,
114
- }
115
- }
package/src/utils.tsx DELETED
@@ -1,195 +0,0 @@
1
- import React from 'react'
2
- import {
3
- Getter,
4
- NoInfer,
5
- PropGetterValue,
6
- Renderable,
7
- TableState,
8
- } from './types'
9
-
10
- export type IsAny<T> = 0 extends 1 & T ? true : false
11
- export type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
12
- export type RequiredKeys<T, K extends keyof T> = Omit<T, K> &
13
- Required<Pick<T, K>>
14
- export type Overwrite<T, U> = Omit<T, keyof U> & U
15
-
16
- export type DataUpdateFunction<TInput, TOutput> = (input: TInput) => TOutput
17
-
18
- export type Updater<TInput, TOutput> =
19
- | TOutput
20
- | DataUpdateFunction<TInput, TOutput>
21
-
22
- export function functionalUpdate<TInput, TOutput = TInput>(
23
- updater: Updater<TInput, TOutput>,
24
- input: TInput
25
- ): TOutput {
26
- return typeof updater === 'function'
27
- ? (updater as DataUpdateFunction<TInput, TOutput>)(input)
28
- : updater
29
- }
30
-
31
- export function noop() {
32
- //
33
- }
34
-
35
- export function makeStateUpdater(key: keyof TableState, instance: unknown) {
36
- return (updater: Updater<any, any>) => {
37
- ;(instance as any).setState(<TTableState,>(old: TTableState) => {
38
- return {
39
- ...old,
40
- [key]: functionalUpdate(updater, (old as any)[key]),
41
- }
42
- })
43
- }
44
- }
45
-
46
- type AnyFunction = (...args: any) => any
47
-
48
- export function isFunction<T extends AnyFunction>(d: any): d is T {
49
- return d instanceof Function
50
- }
51
-
52
- export function flattenBy<TNode>(
53
- arr: TNode[],
54
- getChildren: (item: TNode) => TNode[]
55
- ) {
56
- const flat: TNode[] = []
57
-
58
- const recurse = (subArr: TNode[]) => {
59
- subArr.forEach(item => {
60
- flat.push(item)
61
- const children = getChildren(item)
62
- if (children?.length) {
63
- recurse(children)
64
- }
65
- })
66
- }
67
-
68
- recurse(arr)
69
-
70
- return flat
71
- }
72
-
73
- type PropGetterImpl = <TBaseProps, TGetter extends Getter<TBaseProps>>(
74
- initial: TBaseProps,
75
- userProps?: TGetter
76
- ) => PropGetterValue<TBaseProps, TGetter>
77
-
78
- // @ts-ignore // Just rely on the type, not the implementation
79
- export const propGetter: PropGetterImpl = (initial, getter) => {
80
- if (isFunction(getter)) {
81
- return getter(initial)
82
- }
83
-
84
- return {
85
- ...initial,
86
- ...(getter ?? {}),
87
- }
88
- }
89
-
90
- export function memo<TDeps extends readonly any[], TResult>(
91
- getDeps: () => [...TDeps],
92
- fn: (...args: NoInfer<[...TDeps]>) => TResult,
93
- opts: {
94
- key: string
95
- debug?: boolean
96
- onChange?: (result: TResult, previousResult?: TResult) => void
97
- }
98
- ): () => TResult {
99
- let deps: any[] = []
100
- let result: TResult | undefined
101
-
102
- return () => {
103
- const newDeps = getDeps()
104
-
105
- const depsChanged =
106
- newDeps.length !== deps.length ||
107
- newDeps.some((dep: any, index: number) => deps[index] !== dep)
108
-
109
- if (depsChanged) {
110
- if (opts?.debug) {
111
- console.info(opts?.key, {
112
- length: `${deps.length} -> ${newDeps.length}`,
113
- ...newDeps
114
- .map((_, index) => {
115
- if (deps[index] !== newDeps[index]) {
116
- return [index, deps[index], newDeps[index]]
117
- }
118
-
119
- return false
120
- })
121
- .filter(Boolean)
122
- .reduce(
123
- (accu, curr: any) => ({
124
- ...accu,
125
- [curr[0]]: curr.slice(1),
126
- }),
127
- {}
128
- ),
129
- parent,
130
- })
131
- }
132
-
133
- let oldResult = result
134
- result = fn(...newDeps)
135
- deps = newDeps
136
- opts?.onChange?.(result, oldResult)
137
-
138
- oldResult = undefined
139
- }
140
-
141
- return result!
142
- }
143
- }
144
-
145
- export type Render = typeof flexRender
146
-
147
- export function flexRender<TProps extends {}>(
148
- Comp: Renderable<TProps>,
149
- props: TProps
150
- ): React.ReactNode {
151
- return !Comp ? null : isReactComponent(Comp) ? <Comp {...props} /> : Comp
152
- }
153
-
154
- function isReactComponent(component: unknown): component is React.FC {
155
- return (
156
- isClassComponent(component) ||
157
- typeof component === 'function' ||
158
- isExoticComponent(component)
159
- )
160
- }
161
-
162
- function isClassComponent(component: any) {
163
- return (
164
- typeof component === 'function' &&
165
- (() => {
166
- const proto = Object.getPrototypeOf(component)
167
- return proto.prototype && proto.prototype.isReactComponent
168
- })()
169
- )
170
- }
171
-
172
- function isExoticComponent(component: any) {
173
- return (
174
- typeof component === 'object' &&
175
- typeof component.$$typeof === 'symbol' &&
176
- ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)
177
- )
178
- }
179
-
180
- // export function hashString(str: string, seed = 0): string {
181
- // let h1 = 0xdeadbeef ^ seed,
182
- // h2 = 0x41c6ce57 ^ seed
183
- // for (let i = 0, ch; i < str.length; i++) {
184
- // ch = str.charCodeAt(i)
185
- // h1 = Math.imul(h1 ^ ch, 2654435761)
186
- // h2 = Math.imul(h2 ^ ch, 1597334677)
187
- // }
188
- // h1 =
189
- // Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^
190
- // Math.imul(h2 ^ (h2 >>> 13), 3266489909)
191
- // h2 =
192
- // Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^
193
- // Math.imul(h1 ^ (h1 >>> 13), 3266489909)
194
- // return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString()
195
- // }