@ts-charts/array 0.1.0

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 (65) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +153 -0
  3. package/dist/array.d.ts +2 -0
  4. package/dist/ascending.d.ts +1 -0
  5. package/dist/bin.d.ts +14 -0
  6. package/dist/bisect.d.ts +4 -0
  7. package/dist/bisector.d.ts +6 -0
  8. package/dist/blur.d.ts +5 -0
  9. package/dist/constant.d.ts +1 -0
  10. package/dist/count.d.ts +1 -0
  11. package/dist/cross.d.ts +1 -0
  12. package/dist/cumsum.d.ts +1 -0
  13. package/dist/descending.d.ts +1 -0
  14. package/dist/deviation.d.ts +1 -0
  15. package/dist/difference.d.ts +2 -0
  16. package/dist/disjoint.d.ts +1 -0
  17. package/dist/every.d.ts +1 -0
  18. package/dist/extent.d.ts +1 -0
  19. package/dist/filter.d.ts +1 -0
  20. package/dist/fsum.d.ts +10 -0
  21. package/dist/greatest.d.ts +1 -0
  22. package/dist/greatestIndex.d.ts +1 -0
  23. package/dist/group.d.ts +9 -0
  24. package/dist/groupSort.d.ts +1 -0
  25. package/dist/identity.d.ts +1 -0
  26. package/dist/index.d.ts +57 -0
  27. package/dist/index.js +1 -0
  28. package/dist/intersection.d.ts +2 -0
  29. package/dist/least.d.ts +1 -0
  30. package/dist/leastIndex.d.ts +1 -0
  31. package/dist/map.d.ts +1 -0
  32. package/dist/max.d.ts +1 -0
  33. package/dist/maxIndex.d.ts +1 -0
  34. package/dist/mean.d.ts +1 -0
  35. package/dist/median.d.ts +2 -0
  36. package/dist/merge.d.ts +1 -0
  37. package/dist/min.d.ts +1 -0
  38. package/dist/minIndex.d.ts +1 -0
  39. package/dist/mode.d.ts +1 -0
  40. package/dist/nice.d.ts +1 -0
  41. package/dist/number.d.ts +2 -0
  42. package/dist/pairs.d.ts +2 -0
  43. package/dist/permute.d.ts +1 -0
  44. package/dist/quantile.d.ts +4 -0
  45. package/dist/quickselect.d.ts +3 -0
  46. package/dist/range.d.ts +1 -0
  47. package/dist/rank.d.ts +1 -0
  48. package/dist/reduce.d.ts +1 -0
  49. package/dist/reverse.d.ts +1 -0
  50. package/dist/scan.d.ts +1 -0
  51. package/dist/shuffle.d.ts +2 -0
  52. package/dist/some.d.ts +1 -0
  53. package/dist/sort.d.ts +3 -0
  54. package/dist/subset.d.ts +1 -0
  55. package/dist/sum.d.ts +1 -0
  56. package/dist/superset.d.ts +1 -0
  57. package/dist/threshold/freedmanDiaconis.d.ts +1 -0
  58. package/dist/threshold/scott.d.ts +1 -0
  59. package/dist/threshold/sturges.d.ts +1 -0
  60. package/dist/ticks.d.ts +3 -0
  61. package/dist/transpose.d.ts +1 -0
  62. package/dist/union.d.ts +2 -0
  63. package/dist/variance.d.ts +1 -0
  64. package/dist/zip.d.ts +1 -0
  65. package/package.json +25 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 Open Web Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ <p align="center"><img src=".github/art/cover.jpg" alt="Social Card of this repo"></p>
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![GitHub Actions][github-actions-src]][github-actions-href]
5
+ [![Commitizen friendly][commitizen-src]][commitizen-href]
6
+ <!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
7
+ <!-- [![Codecov][codecov-src]][codecov-href] -->
8
+
9
+ # ts-charts
10
+
11
+ > A complete TypeScript rewrite of D3.js — fully typed, zero dependencies, Bun-first.
12
+
13
+ All 30 D3.js packages, rewritten from the ground up in TypeScript with `isolatedDeclarations` support. Ships as a single umbrella package or 30+ individually installable sub-packages.
14
+
15
+ ## Features
16
+
17
+ - 🔷 **Fully Typed** — strict TypeScript with `isolatedDeclarations: true`, no `any` leaks
18
+ - 📦 **Zero Dependencies** — no external runtime dependencies, everything inlined
19
+ - ⚡ **Bun-First** — optimized for Bun, works in all modern browsers
20
+ - 🌳 **Tree-Shakeable** — ESM-only, import only what you need
21
+ - 🧪 **3,500+ Tests** — comprehensive test suite ported from D3, all passing
22
+ - 🎯 **D3 API Compatible** — drop-in replacement for D3.js
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ # install the umbrella package (everything)
28
+ bun add ts-charts
29
+
30
+ # or install individual packages
31
+ bun add @ts-charts/scale
32
+ bun add @ts-charts/selection
33
+ bun add @ts-charts/shape
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```ts
39
+ // import everything
40
+ import { scaleLinear, line, select } from 'ts-charts'
41
+
42
+ // or import from individual packages
43
+ import { scaleLinear } from '@ts-charts/scale'
44
+ import { line } from '@ts-charts/shape'
45
+ import { select } from '@ts-charts/selection'
46
+
47
+ // create a linear scale
48
+ const x = scaleLinear()
49
+ .domain([0, 100])
50
+ .range([0, 960])
51
+
52
+ // create a line generator
53
+ const myLine = line()
54
+ .x((d: [number, number]) => x(d[0]))
55
+ .y((d: [number, number]) => d[1])
56
+ ```
57
+
58
+ ## Packages
59
+
60
+ | Package | Description |
61
+ |---------|-------------|
62
+ | `@ts-charts/array` | Array manipulation, statistics, histograms, bisection |
63
+ | `@ts-charts/axis` | SVG axis generators for scales |
64
+ | `@ts-charts/brush` | 1D and 2D brush selections |
65
+ | `@ts-charts/chord` | Chord diagram layout and ribbon generator |
66
+ | `@ts-charts/color` | Color spaces: RGB, HSL, Lab, HCL, Cubehelix |
67
+ | `@ts-charts/contour` | Contour polygons and density estimation |
68
+ | `@ts-charts/delaunay` | Delaunay triangulation and Voronoi diagrams |
69
+ | `@ts-charts/dispatch` | Named event dispatching |
70
+ | `@ts-charts/drag` | Drag-and-drop interaction |
71
+ | `@ts-charts/dsv` | CSV and TSV parsing and formatting |
72
+ | `@ts-charts/ease` | Easing functions for transitions |
73
+ | `@ts-charts/fetch` | Convenience wrappers for the Fetch API |
74
+ | `@ts-charts/force` | Force-directed graph layout |
75
+ | `@ts-charts/format` | Number formatting (SI, fixed, currency, etc.) |
76
+ | `@ts-charts/geo` | Geographic projections and path generators |
77
+ | `@ts-charts/hierarchy` | Tree, treemap, pack, and partition layouts |
78
+ | `@ts-charts/interpolate` | Value interpolation for animations |
79
+ | `@ts-charts/path` | SVG path serialization |
80
+ | `@ts-charts/polygon` | Polygon area, centroid, convex hull |
81
+ | `@ts-charts/quadtree` | 2D spatial indexing |
82
+ | `@ts-charts/random` | Random number generators for various distributions |
83
+ | `@ts-charts/scale` | Scales: linear, log, ordinal, time, etc. |
84
+ | `@ts-charts/scale-chromatic` | Color schemes: sequential, diverging, categorical |
85
+ | `@ts-charts/selection` | DOM selection and manipulation |
86
+ | `@ts-charts/shape` | Shape generators: line, area, arc, pie, stack |
87
+ | `@ts-charts/time` | Time intervals and rounding |
88
+ | `@ts-charts/time-format` | Date/time parsing and formatting |
89
+ | `@ts-charts/timer` | Efficient animation scheduling via `requestAnimationFrame` |
90
+ | `@ts-charts/transition` | Animated transitions on selections |
91
+ | `@ts-charts/zoom` | Pan and zoom interaction |
92
+
93
+ ## Testing
94
+
95
+ ```bash
96
+ bun test
97
+ ```
98
+
99
+ ## Changelog
100
+
101
+ Please see our [releases][releases-href] page for more information on what has changed recently.
102
+
103
+ ## Contributing
104
+
105
+ Please see [CONTRIBUTING][contributing-href] for details.
106
+
107
+ ## Community
108
+
109
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
110
+
111
+ [Discussions on GitHub][discussions-href]
112
+
113
+ For casual chit-chat with others using this package:
114
+
115
+ [Join the Stacks Discord Server][discord-href]
116
+
117
+ ## Postcardware
118
+
119
+ "Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
120
+
121
+ Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
122
+
123
+ ## Sponsors
124
+
125
+ We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
126
+
127
+ - [JetBrains][jetbrains-href]
128
+ - [The Solana Foundation][solana-href]
129
+
130
+ ## License
131
+
132
+ The MIT License (MIT). Please see [LICENSE][license-href] for more information.
133
+
134
+ Made with 💙
135
+
136
+ <!-- Badges -->
137
+ [npm-version-src]: https://img.shields.io/npm/v/ts-charts?style=flat-square
138
+ [npm-version-href]: https://npmjs.com/package/ts-charts
139
+ [github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/ts-charts/ci.yml?style=flat-square&branch=main
140
+ [github-actions-href]: https://github.com/stacksjs/ts-charts/actions?query=workflow%3Aci
141
+
142
+ [commitizen-src]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
143
+ [commitizen-href]: http://commitizen.github.io/cz-cli/
144
+ [releases-href]: https://github.com/stacksjs/ts-charts/releases
145
+ [contributing-href]: .github/CONTRIBUTING.md
146
+ [discussions-href]: https://github.com/stacksjs/ts-charts/discussions
147
+ [discord-href]: https://discord.gg/stacksjs
148
+ [jetbrains-href]: https://www.jetbrains.com/
149
+ [solana-href]: https://solana.com/
150
+ [license-href]: LICENSE.md
151
+
152
+ <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/ts-charts/main?style=flat-square
153
+ [codecov-href]: https://codecov.io/gh/stacksjs/ts-charts -->
@@ -0,0 +1,2 @@
1
+ export declare const slice: <T>(this: T[], start?: number, end?: number) => T[];
2
+ export declare const map: <T, U>(this: T[], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: unknown) => U[];
@@ -0,0 +1 @@
1
+ export declare function ascending(a: any, b: any): number;
package/dist/bin.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export declare function bin(): BinGenerator<any>;
2
+ export declare interface Bin<T> extends Array<T> {
3
+ x0: number
4
+ x1: number
5
+ }
6
+ export declare interface BinGenerator<T> {
7
+ (data: Iterable<T>): Bin<T>[]
8
+ value(): (d: T, i: number, data: T[]) => number
9
+ value(value: number | ((d: T, i: number, data: T[]) => number)): BinGenerator<T>
10
+ domain(): (values: number[]) => [number, number]
11
+ domain(domain: [number, number] | ((values: number[]) => [number, number])): BinGenerator<T>
12
+ thresholds(): (values: number[], x0: number, x1: number) => number[] | number
13
+ thresholds(thresholds: number | number[] | ((values: number[], x0: number, x1: number) => number[] | number)): BinGenerator<T>
14
+ }
@@ -0,0 +1,4 @@
1
+ export declare const bisectRight: (a: ArrayLike<any>, x: any, lo?: number, hi?: number) => number;
2
+ export declare const bisectLeft: (a: ArrayLike<any>, x: any, lo?: number, hi?: number) => number;
3
+ export declare const bisectCenter: (a: ArrayLike<any>, x: any, lo?: number, hi?: number) => number;
4
+ export default bisectRight;
@@ -0,0 +1,6 @@
1
+ export declare function bisector<T, U>(f: ((a: T, b: U) => number) | ((d: T) => U)): BisectorResult<T, U>;
2
+ export declare interface BisectorResult<T, U> {
3
+ left: (a: ArrayLike<T>, x: U, lo?: number, hi?: number) => number
4
+ center: (a: ArrayLike<T>, x: U, lo?: number, hi?: number) => number
5
+ right: (a: ArrayLike<T>, x: U, lo?: number, hi?: number) => number
6
+ }
package/dist/blur.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare function blur(values: number[], r: number): number[];
2
+ export declare const blur2: (data: { data: number[], width: number, height?: number }, rx: number, ry?: number) => { data: number[], width: number, height?: number };
3
+ export declare const blurImage: (data: { data: number[], width: number, height?: number }, rx: number, ry?: number) => { data: number[], width: number, height?: number };
4
+ // eslint-disable-next-line pickier/no-unused-vars
5
+ declare type BlurFn = (T: number[], S: number[], start: number, stop: number, step: number) => void
@@ -0,0 +1 @@
1
+ export declare function constant<T>(x: T): () => T;
@@ -0,0 +1 @@
1
+ export declare function count(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number;
@@ -0,0 +1 @@
1
+ export declare function cross(...values: any[]): any[];
@@ -0,0 +1 @@
1
+ export declare function cumsum(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): Float64Array;
@@ -0,0 +1 @@
1
+ export declare function descending(a: any, b: any): number;
@@ -0,0 +1 @@
1
+ export declare function deviation(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number | undefined;
@@ -0,0 +1,2 @@
1
+ import { InternSet } from '@ts-charts/internmap';
2
+ export declare function difference(values: Iterable<any>, ...others: Iterable<any>[]): InternSet;
@@ -0,0 +1 @@
1
+ export declare function disjoint(values: Iterable<any>, other: Iterable<any>): boolean;
@@ -0,0 +1 @@
1
+ export declare function every(values: Iterable<any>, test: (value: any, index: number, values: Iterable<any>) => boolean): boolean;
@@ -0,0 +1 @@
1
+ export declare function extent(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): [any, any];
@@ -0,0 +1 @@
1
+ export declare function filter(values: Iterable<any>, test: (value: any, index: number, values: Iterable<any>) => boolean): any[];
package/dist/fsum.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export declare function fsum(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number;
2
+ export declare function fcumsum(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): Float64Array;
3
+ // https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423
4
+ export declare class Adder {
5
+ _partials: Float64Array;
6
+ _n: number;
7
+ constructor();
8
+ add(x: number): this;
9
+ valueOf(): number;
10
+ }
@@ -0,0 +1 @@
1
+ export declare function greatest(values: Iterable<any>, compare?: any): any;
@@ -0,0 +1 @@
1
+ export declare function greatestIndex(values: Iterable<any>, compare?: any): number;
@@ -0,0 +1,9 @@
1
+ import { InternMap } from '@ts-charts/internmap';
2
+ export declare function group(values: Iterable<any>, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): InternMap;
3
+ export declare function groups(values: Iterable<any>, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): any[];
4
+ export declare function flatGroup(values: Iterable<any>, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): any[];
5
+ export declare function flatRollup(values: Iterable<any>, reduce: (values: any[]) => any, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): any[];
6
+ export declare function rollup(values: Iterable<any>, reduce: (values: any[]) => any, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): InternMap;
7
+ export declare function rollups(values: Iterable<any>, reduce: (values: any[]) => any, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): any[];
8
+ export declare function index(values: Iterable<any>, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): InternMap;
9
+ export declare function indexes(values: Iterable<any>, ...keys: Array<(value: any, index: number, values: Iterable<any>) => any>): any[];
@@ -0,0 +1 @@
1
+ export declare function groupSort(values: Iterable<any>, reduce: any, key: (value: any, index: number, values: Iterable<any>) => any): any[];
@@ -0,0 +1 @@
1
+ export declare function identity<T>(x: T): T;
@@ -0,0 +1,57 @@
1
+ export { default as bisect, bisectRight, bisectLeft, bisectCenter } from './bisect.ts';
2
+ export { default as ascending } from './ascending.ts';
3
+ export { default as bisector } from './bisector.ts';
4
+ export { blur, blur2, blurImage } from './blur.ts';
5
+ export { default as count } from './count.ts';
6
+ export { default as cross } from './cross.ts';
7
+ export { default as cumsum } from './cumsum.ts';
8
+ export { default as descending } from './descending.ts';
9
+ export { default as deviation } from './deviation.ts';
10
+ export { default as extent } from './extent.ts';
11
+ export { Adder, fsum, fcumsum } from './fsum.ts';
12
+ export { default as group, flatGroup, flatRollup, groups, index, indexes, rollup, rollups } from './group.ts';
13
+ export { default as groupSort } from './groupSort.ts';
14
+ export { default as bin, default as histogram } from './bin.ts';
15
+ export { default as thresholdFreedmanDiaconis } from './threshold/freedmanDiaconis.ts';
16
+ export { default as thresholdScott } from './threshold/scott.ts';
17
+ export { default as thresholdSturges } from './threshold/sturges.ts';
18
+ export { default as max } from './max.ts';
19
+ export { default as maxIndex } from './maxIndex.ts';
20
+ export { default as mean } from './mean.ts';
21
+ export { default as median, medianIndex } from './median.ts';
22
+ export { default as merge } from './merge.ts';
23
+ export { default as min } from './min.ts';
24
+ export { default as minIndex } from './minIndex.ts';
25
+ export { default as mode } from './mode.ts';
26
+ export { default as nice } from './nice.ts';
27
+ export { default as pairs } from './pairs.ts';
28
+ export { default as permute } from './permute.ts';
29
+ export { default as quantile, quantileIndex, quantileSorted } from './quantile.ts';
30
+ export { default as quickselect } from './quickselect.ts';
31
+ export { default as range } from './range.ts';
32
+ export { default as rank } from './rank.ts';
33
+ export { default as least } from './least.ts';
34
+ export { default as leastIndex } from './leastIndex.ts';
35
+ export { default as greatest } from './greatest.ts';
36
+ export { default as greatestIndex } from './greatestIndex.ts';
37
+ export { default as scan } from './scan.ts';
38
+ export { default as shuffle, shuffler } from './shuffle.ts';
39
+ export { default as sum } from './sum.ts';
40
+ export { default as ticks, tickIncrement, tickStep } from './ticks.ts';
41
+ export { default as transpose } from './transpose.ts';
42
+ export { default as variance } from './variance.ts';
43
+ export { default as zip } from './zip.ts';
44
+ export { default as every } from './every.ts';
45
+ export { default as some } from './some.ts';
46
+ export { default as filter } from './filter.ts';
47
+ export { default as map } from './map.ts';
48
+ export { default as reduce } from './reduce.ts';
49
+ export { default as reverse } from './reverse.ts';
50
+ export { default as sort } from './sort.ts';
51
+ export { default as difference } from './difference.ts';
52
+ export { default as disjoint } from './disjoint.ts';
53
+ export { default as intersection } from './intersection.ts';
54
+ export { default as subset } from './subset.ts';
55
+ export { default as superset } from './superset.ts';
56
+ export { default as union } from './union.ts';
57
+ export { InternMap, InternSet } from '@ts-charts/internmap';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ function b(n,e){return n==null||e==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function $(n,e){return n==null||e==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function H(n){let e,r,t;if(n.length!==2)e=b,r=(a,y)=>b(n(a),y),t=(a,y)=>n(a)-y;else e=n===b||n===$?n:ee,r=n,t=n;function o(a,y,l=0,i=a.length){if(l<i){if(e(y,y)!==0)return i;do{let m=l+i>>>1;if(r(a[m],y)<0)l=m+1;else i=m}while(l<i)}return l}function f(a,y,l=0,i=a.length){if(l<i){if(e(y,y)!==0)return i;do{let m=l+i>>>1;if(r(a[m],y)<=0)l=m+1;else i=m}while(l<i)}return l}function u(a,y,l=0,i=a.length){let m=o(a,y,l,i-1);return m>l&&t(a[m-1],y)>-t(a[m],y)?m-1:m}return{left:o,center:u,right:f}}function ee(){return 0}function T(n){return n===null?NaN:+n}function*cn(n,e){if(e===void 0){for(let r of n)if(r!=null&&(r=+r)>=r)yield r}else{let r=-1;for(let t of n)if((t=e(t,++r,n))!=null&&(t=+t)>=t)yield t}}var bn=H(b),dn=bn.right,re=bn.left,te=H(T).center,fn=dn;function oe(n,e){if(!((e=+e)>=0))throw RangeError("invalid r");let r=n.length;if(!((r=Math.floor(r))>=0))throw RangeError("invalid length");if(!r||!e)return n;let t=un(e),o=n.slice();return t(n,o,0,r,1),t(o,n,0,r,1),t(n,o,0,r,1),n}var fe=In(un),ue=In(ae);function In(n){return function(e,r,t=r){if(!((r=+r)>=0))throw RangeError("invalid rx");if(!((t=+t)>=0))throw RangeError("invalid ry");let{data:o,width:f,height:u}=e;if(!((f=Math.floor(f))>=0))throw RangeError("invalid width");if(!((u=Math.floor(u!==void 0?u:o.length/f))>=0))throw RangeError("invalid height");if(!f||!u||!r&&!t)return e;let a=r&&n(r),y=t&&n(t),l=o.slice();if(a&&y)q(a,l,o,f,u),q(a,o,l,f,u),q(a,l,o,f,u),K(y,o,l,f,u),K(y,l,o,f,u),K(y,o,l,f,u);else if(a)q(a,o,l,f,u),q(a,l,o,f,u),q(a,o,l,f,u);else if(y)K(y,o,l,f,u),K(y,l,o,f,u),K(y,o,l,f,u);return e}}function q(n,e,r,t,o){for(let f=0,u=t*o;f<u;)n(e,r,f,f+=t,1)}function K(n,e,r,t,o){for(let f=0,u=t*o;f<t;++f)n(e,r,f,f+u,t)}function ae(n){let e=un(n);return(r,t,o,f,u)=>{o<<=2,f<<=2,u<<=2,e(r,t,o+0,f+0,u),e(r,t,o+1,f+1,u),e(r,t,o+2,f+2,u),e(r,t,o+3,f+3,u)}}function un(n){let e=Math.floor(n);if(e===n)return le(n);let r=n-e,t=2*n+1;return(o,f,u,a,y)=>{if(!((a-=y)>=u))return;let l=e*f[u],i=y*e,m=i+y;for(let c=u,d=u+i;c<d;c+=y)l+=f[Math.min(a,c)];for(let c=u,d=a;c<=d;c+=y)l+=f[Math.min(a,c+i)],o[c]=(l+r*(f[Math.max(u,c-m)]+f[Math.min(a,c+m)]))/t,l-=f[Math.max(u,c-i)]}}function le(n){let e=2*n+1;return(r,t,o,f,u)=>{if(!((f-=u)>=o))return;let a=n*t[o],y=u*n;for(let l=o,i=o+y;l<i;l+=u)a+=t[Math.min(f,l)];for(let l=o,i=f;l<=i;l+=u)a+=t[Math.min(f,l+y)],r[l]=a/e,a-=t[Math.max(o,l-y)]}}function w(n,e){let r=0;if(e===void 0){for(let t of n)if(t!=null&&(t=+t)>=t)++r}else{let t=-1;for(let o of n)if((o=e(o,++t,n))!=null&&(o=+o)>=o)++r}return r}function ye(n){return n.length|0}function me(n){return!(n>0)}function ie(n){return typeof n!=="object"||"length"in n?n:Array.from(n)}function ce(n){return(e)=>n(...e)}function pn(...n){let e=typeof n[n.length-1]==="function"&&ce(n.pop());n=n.map(ie);let r=n.map(ye),t=n.length-1,o=Array(t+1).fill(0),f=[];if(t<0||r.some(me))return f;while(!0){f.push(o.map((a,y)=>n[y][a]));let u=t;while(++o[u]===r[u]){if(u===0)return e?f.map(e):f;o[u--]=0}}}function xn(n,e){let r=0,t=0;return Float64Array.from(n,e===void 0?(o)=>r+=+o||0:(o)=>r+=+e(o,t++,n)||0)}function B(n,e){let r=0,t,o=0,f=0;if(e===void 0){for(let u of n)if(u!=null&&(u=+u)>=u)t=u-o,o+=t/++r,f+=t*(u-o)}else{let u=-1;for(let a of n)if((a=e(a,++u,n))!=null&&(a=+a)>=a)t=a-o,o+=t/++r,f+=t*(a-o)}if(r>1)return f/(r-1)}function R(n,e){let r=B(n,e);return r?Math.sqrt(r):r}function E(n,e){let r,t;if(e===void 0){for(let o of n)if(o!=null)if(r===void 0){if(o>=o)r=t=o}else{if(r>o)r=o;if(t<o)t=o}}else{let o=-1;for(let f of n)if((f=e(f,++o,n))!=null)if(r===void 0){if(f>=f)r=t=f}else{if(r>f)r=f;if(t<f)t=f}}return[r,t]}class S{_partials;_n;constructor(){this._partials=new Float64Array(32),this._n=0}add(n){let e=this._partials,r=0;for(let t=0;t<this._n&&t<32;t++){let o=e[t],f=n+o,u=Math.abs(n)<Math.abs(o)?n-(f-o):o-(f-n);if(u)e[r++]=u;n=f}return e[r]=n,this._n=r+1,this}valueOf(){let n=this._partials,e=this._n,r,t,o,f=0;if(e>0){f=n[--e];while(e>0)if(r=f,t=n[--e],f=r+t,o=t-(f-r),o)break;if(e>0&&(o<0&&n[e-1]<0||o>0&&n[e-1]>0)){if(t=o*2,r=f+t,t==r-f)f=r}}return f}}function be(n,e){let r=new S;if(e===void 0){for(let t of n)if(t=+t)r.add(t)}else{let t=-1;for(let o of n)if(o=+e(o,++t,n))r.add(o)}return+r}function de(n,e){let r=new S,t=-1;return Float64Array.from(n,e===void 0?(o)=>+r.add(+o||0):(o)=>+r.add(+e(o,++t,n)||0))}function sn(n){return n!==null&&typeof n==="object"?n.valueOf():n}function an({_intern:n,_key:e},r){let t=e(r);return n.has(t)?n.get(t):r}function wn({_intern:n,_key:e},r){let t=e(r);if(n.has(t))return n.get(t);return n.set(t,r),r}function kn({_intern:n,_key:e},r){let t=e(r);if(n.has(t))r=n.get(t),n.delete(t);return r}class O extends Map{_intern;_key;constructor(n,e=sn){super();if(this._intern=new Map,this._key=e,n!=null)for(let[r,t]of n)this.set(r,t)}get(n){return super.get(an(this,n))}has(n){return super.has(an(this,n))}set(n,e){return super.set(wn(this,n),e)}delete(n){return super.delete(kn(this,n))}}class I extends Set{_intern;_key;constructor(n,e=sn){super();if(this._intern=new Map,this._key=e,n!=null)for(let r of n)this.add(r)}has(n){return super.has(an(this,n))}add(n){return super.add(wn(this,n))}delete(n){return super.delete(kn(this,n))}}function x(n){return n}function F(n,...e){return U(n,x,x,e)}function Mn(n,...e){return U(n,Array.from,x,e)}function An(n,e){for(let r=1,t=e.length;r<t;++r)n=n.flatMap((o)=>o.pop().map(([f,u])=>[...o,f,u]));return n}function Ie(n,...e){return An(Mn(n,...e),e)}function pe(n,e,...r){return An(Tn(n,e,...r),r)}function ln(n,e,...r){return U(n,x,e,r)}function Tn(n,e,...r){return U(n,Array.from,e,r)}function xe(n,...e){return U(n,x,Ln,e)}function se(n,...e){return U(n,Array.from,Ln,e)}function Ln(n){if(n.length!==1)throw Error("duplicate key");return n[0]}function U(n,e,r,t){return function o(f,u){if(u>=t.length)return r(f);let a=new O,y=t[u++],l=-1;for(let i of f){let m=y(i,++l,f),c=a.get(m);if(c)c.push(i);else a.set(m,[i])}for(let[i,m]of a)a.set(i,o(m,u));return e(a)}(n,0)}function _(n,e){return Array.from(e,(r)=>n[r])}function J(n,...e){if(typeof n[Symbol.iterator]!=="function")throw TypeError("values is not iterable");n=Array.from(n);let[r]=e;if(r&&r.length!==2||e.length>1){let t=Uint32Array.from(n,(o,f)=>f);if(e.length>1)e=e.map((o)=>n.map(o)),t.sort((o,f)=>{for(let u of e){let a=s(u[o],u[f]);if(a)return a}return 0});else r=n.map(r),t.sort((o,f)=>s(r[o],r[f]));return _(n,t)}return n.sort(P(r))}function P(n=b){if(n===b)return s;if(typeof n!=="function")throw TypeError("compare is not a function");return(e,r)=>{let t=n(e,r);if(t||t===0)return t;return(n(r,r)===0?1:0)-(n(e,e)===0?1:0)}}function s(n,e){return(n==null||!(n>=n)?1:0)-(e==null||!(e>=e)?1:0)||(n<e?-1:n>e?1:0)}function Nn(n,e,r){return(e.length!==2?J(ln(n,e,r),([t,o],[f,u])=>b(o,u)||b(t,f)):J(F(n,r),([t,o],[f,u])=>e(o,u)||b(t,f))).map(([t])=>t)}var qn=Array.prototype,Kn=qn.slice,yr=qn.map;function Q(n){return()=>n}var we=Math.sqrt(50),ke=Math.sqrt(10),Me=Math.sqrt(2);function h(n,e,r){let t=(e-n)/Math.max(0,r),o=Math.floor(Math.log10(t)),f=t/Math.pow(10,o),u=f>=we?10:f>=ke?5:f>=Me?2:1,a,y,l;if(o<0){if(l=Math.pow(10,-o)/u,a=Math.round(n*l),y=Math.round(e*l),a/l<n)++a;if(y/l>e)--y;l=-l}else{if(l=Math.pow(10,o)*u,a=Math.round(n/l),y=Math.round(e/l),a*l<n)++a;if(y*l>e)--y}if(y<a&&0.5<=r&&r<2)return h(n,e,r*2);return[a,y,l]}function z(n,e,r){if(e=+e,n=+n,r=+r,!(r>0))return[];if(n===e)return[n];let t=e<n,[o,f,u]=t?h(e,n,r):h(n,e,r);if(!(f>=o))return[];let a=f-o+1,y=Array(a);if(t)if(u<0)for(let l=0;l<a;++l)y[l]=(f-l)/-u;else for(let l=0;l<a;++l)y[l]=(f-l)*u;else if(u<0)for(let l=0;l<a;++l)y[l]=(o+l)/-u;else for(let l=0;l<a;++l)y[l]=(o+l)*u;return y}function k(n,e,r){return e=+e,n=+n,r=+r,h(n,e,r)[2]}function Ae(n,e,r){e=+e,n=+n,r=+r;let t=e<n,o=t?k(e,n,r):k(n,e,r);return(t?-1:1)*(o<0?1/-o:o)}function j(n,e,r){let t;while(!0){let o=k(n,e,r);if(o===t||o===0||!isFinite(o))return[n,e];else if(o>0)n=Math.floor(n/o)*o,e=Math.ceil(e/o)*o;else if(o<0)n=Math.ceil(n*o)/o,e=Math.floor(e*o)/o;t=o}}function v(n){return Math.max(1,Math.ceil(Math.log(w(n))/Math.LN2)+1)}function yn(){let n=x,e=E,r=v;function t(o){if(!Array.isArray(o))o=Array.from(o);let f,u=o.length,a,y,l=Array(u);for(f=0;f<u;++f)l[f]=n(o[f],f,o);let i=e(l),m=i[0],c=i[1],d=r(l,m,c);if(!Array.isArray(d)){let Y=c,Z=+d;if(e===E)[m,c]=j(m,c,Z);if(d=z(m,c,Z),d[0]<=m)y=k(m,c,Z);if(d[d.length-1]>=c)if(Y>=c&&e===E){let A=k(m,c,Z);if(isFinite(A)){if(A>0)c=(Math.floor(c/A)+1)*A;else if(A<0)c=(Math.ceil(c*-A)+1)/-A}}else d.pop()}let p=d.length,M=0,V=p;while(d[M]<=m)++M;while(d[V-1]>c)--V;if(M||V<p)d=d.slice(M,V),p=V-M;let g=Array(p+1),on;for(f=0;f<=p;++f)on=g[f]=[],on.x0=f>0?d[f-1]:m,on.x1=f<p?d[f]:c;if(isFinite(y)){if(y>0){for(f=0;f<u;++f)if((a=l[f])!=null&&m<=a&&a<=c)g[Math.min(p,Math.floor((a-m)/y))].push(o[f])}else if(y<0){for(f=0;f<u;++f)if((a=l[f])!=null&&m<=a&&a<=c){let Y=Math.floor((m-a)*y);g[Math.min(p,Y+(d[Y]<=a?1:0))].push(o[f])}}}else for(f=0;f<u;++f)if((a=l[f])!=null&&m<=a&&a<=c)g[fn(d,a,0,p)].push(o[f]);return g}return t.value=function(o){return arguments.length?(n=typeof o==="function"?o:Q(o),t):n},t.domain=function(o){return arguments.length?(e=typeof o==="function"?o:Q([o[0],o[1]]),t):e},t.thresholds=function(o){return arguments.length?(r=typeof o==="function"?o:Q(Array.isArray(o)?Kn.call(o):o),t):r},t}function W(n,e){let r;if(e===void 0){for(let t of n)if(t!=null&&(r<t||r===void 0&&t>=t))r=t}else{let t=-1;for(let o of n)if((o=e(o,++t,n))!=null&&(r<o||r===void 0&&o>=o))r=o}return r}function G(n,e){let r,t=-1,o=-1;if(e===void 0){for(let f of n)if(++o,f!=null&&(r<f||r===void 0&&f>=f))r=f,t=o}else for(let f of n)if((f=e(f,++o,n))!=null&&(r<f||r===void 0&&f>=f))r=f,t=o;return t}function L(n,e){let r;if(e===void 0){for(let t of n)if(t!=null&&(r>t||r===void 0&&t>=t))r=t}else{let t=-1;for(let o of n)if((o=e(o,++t,n))!=null&&(r>o||r===void 0&&o>=o))r=o}return r}function C(n,e){let r,t=-1,o=-1;if(e===void 0){for(let f of n)if(++o,f!=null&&(r>f||r===void 0&&f>=f))r=f,t=o}else for(let f of n)if((f=e(f,++o,n))!=null&&(r>f||r===void 0&&f>=f))r=f,t=o;return t}function D(n,e,r=0,t=1/0,o){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),t=Math.floor(Math.min(n.length-1,t)),!(r<=e&&e<=t))return n;let f=o===void 0?s:P(o);while(t>r){if(t-r>600){let l=t-r+1,i=e-r+1,m=Math.log(l),c=0.5*Math.exp(2*m/3),d=0.5*Math.sqrt(m*c*(l-c)/l)*(i-l/2<0?-1:1),p=Math.max(r,Math.floor(e-i*c/l+d)),M=Math.min(t,Math.floor(e+(l-i)*c/l+d));D(n,e,p,M,o)}let u=n[e],a=r,y=t;if(X(n,r,e),f(n[t],u)>0)X(n,r,t);while(a<y){X(n,a,y),++a,--y;while(f(n[a],u)<0)++a;while(f(n[y],u)>0)--y}if(f(n[r],u)===0)X(n,r,y);else++y,X(n,y,t);if(y<=e)r=y+1;if(e<=y)t=y-1}return n}function X(n,e,r){let t=n[e];n[e]=n[r],n[r]=t}function nn(n,e=b){let r,t=!1;if(e.length===1){let o;for(let f of n){let u=e(f);if(t?b(u,o)>0:b(u,u)===0)r=f,o=u,t=!0}}else for(let o of n)if(t?e(o,r)>0:e(o,o)===0)r=o,t=!0;return r}function N(n,e,r){let t=Float64Array.from(cn(n,r)),o=t.length;if(!o||isNaN(e=+e))return;if(e<=0||o<2)return L(t);if(e>=1)return W(t);let f=(o-1)*e,u=Math.floor(f),a=Array.from(t),y=W(D(a,u).slice(0,u+1)),l=L(a.slice(u+1));return y+(l-y)*(f-u)}function Te(n,e,r=T){let t=n.length;if(!t||isNaN(e=+e))return;if(e<=0||t<2)return+r(n[0],0,n);if(e>=1)return+r(n[t-1],t-1,n);let o=(t-1)*e,f=Math.floor(o),u=+r(n[f],f,n),a=+r(n[f+1],f+1,n);return u+(a-u)*(o-f)}function mn(n,e,r=T){if(isNaN(e=+e))return-1;let t=Float64Array.from(n,(a,y)=>T(r(n[y],y,n)));if(e<=0)return C(t);if(e>=1)return G(t);let o=Array.from(Uint32Array.from(n,(a,y)=>y)),f=t.length-1,u=Math.floor(f*e);return D(o,u,0,f,(a,y)=>s(t[a],t[y])),u=nn(o.slice(0,u+1),(a)=>t[a]),u>=0?u:-1}function En(n,e,r){let t=w(n),o=N(n,0.75)-N(n,0.25);return t&&o?Math.ceil((r-e)/(2*o*Math.pow(t,-0.3333333333333333))):1}function On(n,e,r){let t=w(n),o=R(n);return t&&o?Math.ceil((r-e)*Math.cbrt(t)/(3.49*o)):1}function Un(n,e){let r=0,t=0;if(e===void 0){for(let o of n)if(o!=null&&(o=+o)>=o)++r,t+=o}else{let o=-1;for(let f of n)if((f=e(f,++o,n))!=null&&(f=+f)>=f)++r,t+=f}if(r)return t/r}function Gn(n,e){return N(n,0.5,e)}function Le(n,e){return mn(n,0.5,e)}function*Ne(n){for(let e of n)yield*e}function Cn(n){return Array.from(Ne(n))}function Dn(n,e){let r=new O;if(e===void 0){for(let f of n)if(f!=null&&f>=f)r.set(f,(r.get(f)||0)+1)}else{let f=-1;for(let u of n)if((u=e(u,++f,n))!=null&&u>=u)r.set(u,(r.get(u)||0)+1)}let t,o=0;for(let[f,u]of r)if(u>o)o=u,t=f;return t}function Vn(n,e=qe){let r=[],t,o=!1;for(let f of n){if(o)r.push(e(t,f));t=f,o=!0}return r}function qe(n,e){return[n,e]}function gn(n,e,r){n=+n;let t=arguments.length;if(t<2)e=n,n=0,r=1;else e=+e,r=t<3?1:+r;let o=-1,f=Math.max(0,Math.ceil((e-n)/r))|0,u=Array(f);while(++o<f)u[o]=n+o*r;return u}function Hn(n,e=b){if(typeof n[Symbol.iterator]!=="function")throw TypeError("values is not iterable");let r=Array.from(n),t=new Float64Array(r.length);if(e.length!==2)r=r.map(e),e=b;let o=(y,l)=>e(r[y],r[l]),f,u,a=Uint32Array.from(r,(y,l)=>l);return a.sort(e===b?(y,l)=>s(r[y],r[l]):P(o)),a.forEach((y,l)=>{let i=o(y,f===void 0?y:f);if(i>=0){if(f===void 0||i>0)f=y,u=l;t[y]=u}else t[y]=NaN}),t}function Jn(n,e=b){let r,t=!1;if(e.length===1){let o;for(let f of n){let u=e(f);if(t?b(u,o)<0:b(u,u)===0)r=f,o=u,t=!0}}else for(let o of n)if(t?e(o,r)<0:e(o,o)===0)r=o,t=!0;return r}function en(n,e=b){if(e.length===1)return C(n,e);let r,t=-1,o=-1;for(let f of n)if(++o,t<0?e(f,f)===0:e(f,r)<0)r=f,t=o;return t}function Pn(n,e=b){if(e.length===1)return G(n,e);let r,t=-1,o=-1;for(let f of n)if(++o,t<0?e(f,f)===0:e(f,r)>0)r=f,t=o;return t}function Qn(n,e){let r=en(n,e);return r<0?void 0:r}function Wn(n){return function(r,t=0,o=r.length){let f=o-(t=+t);while(f){let u=n()*f--|0,a=r[f+t];r[f+t]=r[u+t],r[u+t]=a}return r}}var Ke=Wn(Math.random),Ee=Ke;function Xn(n,e){let r=0;if(e===void 0){for(let t of n)if(t=+t)r+=t}else{let t=-1;for(let o of n)if(o=+e(o,++t,n))r+=o}return r}function rn(n){let e=n.length;if(!e)return[];let r=L(Array.from(n),Oe),t=Array(r);for(let o=0;o<r;++o){let f=t[o]=Array(e);for(let u=0;u<e;++u)f[u]=n[u][o]}return t}function Oe(n){return n.length}function Yn(...n){return rn(n)}function Zn(n,e){if(typeof e!=="function")throw TypeError("test is not a function");let r=-1;for(let t of n)if(!e(t,++r,n))return!1;return!0}function $n(n,e){if(typeof e!=="function")throw TypeError("test is not a function");let r=-1;for(let t of n)if(e(t,++r,n))return!0;return!1}function Bn(n,e){if(typeof e!=="function")throw TypeError("test is not a function");let r=[],t=-1;for(let o of n)if(e(o,++t,n))r.push(o);return r}function Rn(n,e){if(typeof n[Symbol.iterator]!=="function")throw TypeError("values is not iterable");if(typeof e!=="function")throw TypeError("mapper is not a function");return Array.from(n,(r,t)=>e(r,t,n))}function Sn(n,e,r){if(typeof e!=="function")throw TypeError("reducer is not a function");let t=n[Symbol.iterator](),o,f,u=-1;if(arguments.length<3){if({done:o,value:r}=t.next(),o)return;++u}while({done:o,value:f}=t.next(),!o)r=e(r,f,++u,n);return r}function Fn(n){if(typeof n[Symbol.iterator]!=="function")throw TypeError("values is not iterable");return Array.from(n).reverse()}function _n(n,...e){let r=new I(n);for(let t of e)for(let o of t)r.delete(o);return r}function hn(n,e){let r=e[Symbol.iterator](),t=new I;for(let o of n){if(t.has(o))return!1;let f,u;while({value:f,done:u}=r.next()){if(u)break;if(Object.is(o,f))return!1;t.add(f)}}return!0}function zn(n,...e){let r=new I(n),t=e.map(Ue);n:for(let o of r)for(let f of t)if(!f.has(o)){r.delete(o);continue n}return r}function Ue(n){return n instanceof I?n:new I(n)}function tn(n,e){let r=n[Symbol.iterator](),t=new Set;for(let o of e){let f=jn(o);if(t.has(f))continue;let u,a;while({value:u,done:a}=r.next()){if(a)return!1;let y=jn(u);if(t.add(y),Object.is(f,y))break}}return!0}function jn(n){return n!==null&&typeof n==="object"?n.valueOf():n}function vn(n,e){return tn(e,n)}function ne(...n){let e=new I;for(let r of n)for(let t of r)e.add(t);return e}export{Yn as zip,B as variance,ne as union,rn as transpose,z as ticks,Ae as tickStep,k as tickIncrement,v as thresholdSturges,On as thresholdScott,En as thresholdFreedmanDiaconis,tn as superset,Xn as sum,vn as subset,J as sort,$n as some,Wn as shuffler,Ee as shuffle,Qn as scan,Tn as rollups,ln as rollup,Fn as reverse,Sn as reduce,Hn as rank,gn as range,D as quickselect,Te as quantileSorted,mn as quantileIndex,N as quantile,_ as permute,Vn as pairs,j as nice,Dn as mode,C as minIndex,L as min,Cn as merge,Le as medianIndex,Gn as median,Un as mean,G as maxIndex,W as max,Rn as map,en as leastIndex,Jn as least,zn as intersection,se as indexes,xe as index,yn as histogram,Mn as groups,Nn as groupSort,F as group,Pn as greatestIndex,nn as greatest,be as fsum,pe as flatRollup,Ie as flatGroup,Bn as filter,de as fcumsum,E as extent,Zn as every,hn as disjoint,_n as difference,R as deviation,$ as descending,xn as cumsum,pn as cross,w as count,ue as blurImage,fe as blur2,oe as blur,H as bisector,dn as bisectRight,re as bisectLeft,te as bisectCenter,fn as bisect,yn as bin,b as ascending,I as InternSet,O as InternMap,S as Adder};
@@ -0,0 +1,2 @@
1
+ import { InternSet } from '@ts-charts/internmap';
2
+ export declare function intersection(values: Iterable<any>, ...others: Iterable<any>[]): InternSet;
@@ -0,0 +1 @@
1
+ export declare function least(values: Iterable<any>, compare?: any): any;
@@ -0,0 +1 @@
1
+ export declare function leastIndex(values: Iterable<any>, compare?: any): number;
package/dist/map.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function map(values: Iterable<any>, mapper: (value: any, index: number, values: Iterable<any>) => any): any[];
package/dist/max.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function max(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): any;
@@ -0,0 +1 @@
1
+ export declare function maxIndex(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number;
package/dist/mean.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function mean(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number | undefined;
@@ -0,0 +1,2 @@
1
+ export declare function median(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number | undefined;
2
+ export declare function medianIndex(values: ArrayLike<any>, valueof?: (value: any, index: number, values: ArrayLike<any>) => number): number;
@@ -0,0 +1 @@
1
+ export declare function merge(arrays: Iterable<Iterable<any>>): any[];
package/dist/min.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function min(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): any;
@@ -0,0 +1 @@
1
+ export declare function minIndex(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number;
package/dist/mode.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function mode(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): any;
package/dist/nice.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function nice(start: number, stop: number, count: number): [number, number];
@@ -0,0 +1,2 @@
1
+ export declare function number(x: any): number;
2
+ export declare function numbers(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): Generator<number>;
@@ -0,0 +1,2 @@
1
+ export declare function pairs(values: Iterable<any>, pairof?: (a: any, b: any) => any): any[];
2
+ export declare function pair(a: any, b: any): [any, any];
@@ -0,0 +1 @@
1
+ export declare function permute<T>(source: ArrayLike<T>, keys: Iterable<number>): T[];
@@ -0,0 +1,4 @@
1
+ import number from './number.ts';
2
+ export declare function quantile(values: Iterable<any>, p: number, valueof?: (value: any, index: number, values: Iterable<any>) => any): number | undefined;
3
+ export declare function quantileSorted(values: ArrayLike<any>, p: number, valueof?: (value: any, index: number, values: ArrayLike<any>) => number): number | undefined;
4
+ export declare function quantileIndex(values: ArrayLike<any>, p: number, valueof?: (value: any, index: number, values: ArrayLike<any>) => number): number;
@@ -0,0 +1,3 @@
1
+ // Based on https://github.com/mourner/quickselect
2
+ // ISC license, Copyright 2018 Vladimir Agafonkin.
3
+ export declare function quickselect<T>(array: T[], k: number, left?: number, right?: number, compare?: (a: T, b: T) => number): T[];
@@ -0,0 +1 @@
1
+ export declare function range(start: number, stop?: number, step?: number): number[];
package/dist/rank.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function rank(values: Iterable<any>, valueof?: any): Float64Array;
@@ -0,0 +1 @@
1
+ export declare function reduce(values: Iterable<any>, reducer: (accumulator: any, value: any, index: number, values: Iterable<any>) => any, value?: any): any;
@@ -0,0 +1 @@
1
+ export declare function reverse(values: Iterable<any>): any[];
package/dist/scan.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function scan(values: Iterable<any>, compare?: (a: any, b: any) => number): number | undefined;
@@ -0,0 +1,2 @@
1
+ export declare function shuffler(random: () => number): <T>(array: T[], i0?: number, i1?: number) => T[];
2
+ export default shuffle;
package/dist/some.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function some(values: Iterable<any>, test: (value: any, index: number, values: Iterable<any>) => boolean): boolean;
package/dist/sort.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function sort(values: Iterable<any>, ...F: any[]): any[];
2
+ export declare function compareDefined(compare?: (a: any, b: any) => number): (a: any, b: any) => number;
3
+ export declare function ascendingDefined(a: any, b: any): number;
@@ -0,0 +1 @@
1
+ export declare function subset(values: Iterable<any>, other: Iterable<any>): boolean;
package/dist/sum.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function sum(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number;
@@ -0,0 +1 @@
1
+ export declare function superset(values: Iterable<any>, other: Iterable<any>): boolean;
@@ -0,0 +1 @@
1
+ export declare function thresholdFreedmanDiaconis(values: ArrayLike<number>, min: number, max: number): number;
@@ -0,0 +1 @@
1
+ export declare function thresholdScott(values: ArrayLike<number>, min: number, max: number): number;
@@ -0,0 +1 @@
1
+ export declare function thresholdSturges(values: ArrayLike<number>): number;
@@ -0,0 +1,3 @@
1
+ export declare function ticks(start: number, stop: number, count: number): number[];
2
+ export declare function tickIncrement(start: number, stop: number, count: number): number;
3
+ export declare function tickStep(start: number, stop: number, count: number): number;
@@ -0,0 +1 @@
1
+ export declare function transpose(matrix: ArrayLike<ArrayLike<any>>): any[][];
@@ -0,0 +1,2 @@
1
+ import { InternSet } from '@ts-charts/internmap';
2
+ export declare function union(...others: Iterable<any>[]): InternSet;
@@ -0,0 +1 @@
1
+ export declare function variance(values: Iterable<any>, valueof?: (value: any, index: number, values: Iterable<any>) => any): number | undefined;
package/dist/zip.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function zip(...arrays: any[][]): any[][];
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@ts-charts/array",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Array manipulation, ordering, searching, summarizing, etc.",
6
+ "dependencies": {
7
+ "@ts-charts/internmap": "0.1.0"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./src/index.ts"
13
+ }
14
+ },
15
+ "module": "./src/index.ts",
16
+ "types": "./dist/index.d.ts",
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "build": "bun --bun build.ts",
22
+ "prepublishOnly": "bun --bun run build",
23
+ "test": "bun test"
24
+ }
25
+ }