pax_global_header00006660000000000000000000000064141262200630014506gustar00rootroot0000000000000052 comment=894a718fa126ad530a8523b4d12f2656d8fbb44e d3-array-3.1.1/000077500000000000000000000000001412622006300131325ustar00rootroot00000000000000d3-array-3.1.1/.eslintrc.json000066400000000000000000000003331412622006300157250ustar00rootroot00000000000000{ "extends": "eslint:recommended", "parserOptions": { "sourceType": "module", "ecmaVersion": 8 }, "env": { "es6": true }, "rules": { "no-cond-assign": 0, "no-constant-condition": 0 } } d3-array-3.1.1/.github/000077500000000000000000000000001412622006300144725ustar00rootroot00000000000000d3-array-3.1.1/.github/eslint.json000066400000000000000000000005571412622006300166720ustar00rootroot00000000000000{ "problemMatcher": [ { "owner": "eslint-compact", "pattern": [ { "regexp": "^(.+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5, "code": 6 } ] } ] } d3-array-3.1.1/.github/workflows/000077500000000000000000000000001412622006300165275ustar00rootroot00000000000000d3-array-3.1.1/.github/workflows/node.js.yml000066400000000000000000000012101412622006300206040ustar00rootroot00000000000000# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions name: Node.js CI on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [14.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - run: yarn --frozen-lockfile - run: | echo ::add-matcher::.github/eslint.json yarn run eslint src test --format=compact - run: yarn test d3-array-3.1.1/.gitignore000066400000000000000000000000771412622006300151260ustar00rootroot00000000000000*.sublime-workspace .DS_Store dist/ node_modules npm-debug.log d3-array-3.1.1/LICENSE000066400000000000000000000013331412622006300141370ustar00rootroot00000000000000Copyright 2010-2021 Mike Bostock Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. d3-array-3.1.1/README.md000066400000000000000000001663351412622006300144270ustar00rootroot00000000000000# d3-array Data in JavaScript is often represented by an iterable (such as an [array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array), [set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set) or [generator](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Generator)), and so iterable manipulation is a common task when analyzing or visualizing data. For example, you might take a contiguous slice (subset) of an array, filter an array using a predicate function, or map an array to a parallel set of values using a transform function. Before looking at the methods that d3-array provides, familiarize yourself with the powerful [array methods built-in to JavaScript](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array). JavaScript includes **mutation methods** that modify the array: * [*array*.pop](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) - Remove the last element from the array. * [*array*.push](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/push) - Add one or more elements to the end of the array. * [*array*.reverse](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) - Reverse the order of the elements of the array. * [*array*.shift](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) - Remove the first element from the array. * [*array*.sort](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) - Sort the elements of the array. * [*array*.splice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) - Add or remove elements from the array. * [*array*.unshift](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) - Add one or more elements to the front of the array. There are also **access methods** that return some representation of the array: * [*array*.concat](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) - Join the array with other array(s) or value(s). * [*array*.join](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/join) - Join all elements of the array into a string. * [*array*.slice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) - Extract a section of the array. * [*array*.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) - Find the first occurrence of a value within the array. * [*array*.lastIndexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf) - Find the last occurrence of a value within the array. And finally **iteration methods** that apply functions to elements in the array: * [*array*.filter](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) - Create a new array with only the elements for which a predicate is true. * [*array*.forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) - Call a function for each element in the array. * [*array*.every](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/every) - See if every element in the array satisfies a predicate. * [*array*.map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map) - Create a new array with the result of calling a function on every element in the array. * [*array*.some](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/some) - See if at least one element in the array satisfies a predicate. * [*array*.reduce](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) - Apply a function to reduce the array to a single value (from left-to-right). * [*array*.reduceRight](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight) - Apply a function to reduce the array to a single value (from right-to-left). ## Installing If you use npm, `npm install d3-array`. You can also download the [latest release on GitHub](https://github.com/d3/d3-array/releases/latest). For vanilla HTML in modern browsers, import d3-array from Skypack: ```html ``` For legacy environments, you can load d3-array’s UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported: ```html ``` ## API Reference * [Statistics](#statistics) * [Search](#search) * [Transformations](#transformations) * [Iterables](#iterables) * [Sets](#sets) * [Bins](#bins) * [Interning](#interning) ### Statistics Methods for computing basic summary statistics. # d3.min(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/min.js), [Examples](https://observablehq.com/@d3/d3-extent) Returns the minimum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the minimum value. Unlike the built-in [Math.min](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the minimum of the strings [“20”, “3”] is “20”, while the minimum of the numbers [20, 3] is 3. See also [extent](#extent). # d3.minIndex(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/minIndex.js), [Examples](https://observablehq.com/@d3/d3-extent) Returns the index of the minimum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns -1. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the minimum value. Unlike the built-in [Math.min](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the minimum of the strings [“20”, “3”] is “20”, while the minimum of the numbers [20, 3] is 3. # d3.max(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/max.js), [Examples](https://observablehq.com/@d3/d3-extent) Returns the maximum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the maximum value. Unlike the built-in [Math.max](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the maximum of the strings [“20”, “3”] is “3”, while the maximum of the numbers [20, 3] is 20. See also [extent](#extent). # d3.maxIndex(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/maxIndex.js), [Examples](https://observablehq.com/@d3/d3-extent) Returns the index of the maximum value in the given *iterable* using natural order. If the iterable contains no comparable values, returns -1. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the maximum value. Unlike the built-in [Math.max](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the maximum of the strings [“20”, “3”] is “3”, while the maximum of the numbers [20, 3] is 20. # d3.extent(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/extent.js), [Examples](https://observablehq.com/@d3/d3-extent) Returns the [minimum](#min) and [maximum](#max) value in the given *iterable* using natural order. If the iterable contains no comparable values, returns [undefined, undefined]. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the extent. # d3.mode(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/mode.js), [Examples](https://observablehq.com/@d3/d3-mode) Returns the mode of the given *iterable*, *i.e.* the value which appears the most often. In case of equality, returns the first of the relevant values. If the iterable contains no comparable values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the mode. This method ignores undefined, null and NaN values; this is useful for ignoring missing data. # d3.sum(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/sum.js), [Examples](https://observablehq.com/@d3/d3-sum) Returns the sum of the given *iterable* of numbers. If the iterable contains no numbers, returns 0. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the sum. This method ignores undefined and NaN values; this is useful for ignoring missing data. # d3.mean(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/mean.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) Returns the mean of the given *iterable* of numbers. If the iterable contains no numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the mean. This method ignores undefined and NaN values; this is useful for ignoring missing data. # d3.median(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/median.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) Returns the median of the given *iterable* of numbers using the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample). If the iterable contains no numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the median. This method ignores undefined and NaN values; this is useful for ignoring missing data. # d3.cumsum(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/cumsum.js), [Examples](https://observablehq.com/@d3/d3-cumsum) Returns the cumulative sum of the given *iterable* of numbers, as a Float64Array of the same length. If the iterable contains no numbers, returns zeros. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the cumulative sum. This method ignores undefined and NaN values; this is useful for ignoring missing data. # d3.quantile(iterable, p[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/quantile.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) Returns the *p*-quantile of the given *iterable* of numbers, where *p* is a number in the range [0, 1]. For example, the median can be computed using *p* = 0.5, the first quartile at *p* = 0.25, and the third quartile at *p* = 0.75. This particular implementation uses the [R-7 method](http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population), which is the default for the R programming language and Excel. For example: ```js var a = [0, 10, 30]; d3.quantile(a, 0); // 0 d3.quantile(a, 0.5); // 10 d3.quantile(a, 1); // 30 d3.quantile(a, 0.25); // 5 d3.quantile(a, 0.75); // 20 d3.quantile(a, 0.1); // 2 ``` An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the quantile. # d3.quantileSorted(array, p[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/quantile.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) Similar to *quantile*, but expects the input to be a **sorted** *array* of values. In contrast with *quantile*, the accessor is only called on the elements needed to compute the quantile. # d3.rank(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/main/src/rank.js), [Examples](https://observablehq.com/@d3/rank)
# d3.rank(iterable[, accessor]) Returns an array with the rank of each value in the *iterable*, *i.e.* the zero-based index of the value when the iterable is sorted. Nullish values are sorted to the end and ranked NaN. An optional *comparator* or *accessor* function may be specified; the latter is equivalent to calling *array*.map(*accessor*) before computing the ranks. If *comparator* is not specified, it defaults to [ascending](#ascending). Ties (equivalent values) all get the same rank, defined as the first time the value is found. ```js d3.rank([{x: 1}, {}, {x: 2}, {x: 0}], d => d.x); // [1, NaN, 2, 0] d3.rank(["b", "c", "b", "a"]); // [1, 3, 1, 0] d3.rank([1, 2, 3], d3.descending); // [2, 1, 0] ``` # d3.variance(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/variance.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) Returns an [unbiased estimator of the population variance](http://mathworld.wolfram.com/SampleVariance.html) of the given *iterable* of numbers using [Welford’s algorithm](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm). If the iterable has fewer than two numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data. # d3.deviation(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/deviation.js), [Examples](https://observablehq.com/@d3/d3-mean-d3-median-and-friends) Returns the standard deviation, defined as the square root of the [bias-corrected variance](#variance), of the given *iterable* of numbers. If the iterable has fewer than two numbers, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the standard deviation. This method ignores undefined and NaN values; this is useful for ignoring missing data. # d3.fsum([values][, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/fsum.js), [Examples](https://observablehq.com/@d3/d3-fsum) Returns a full precision summation of the given *values*. ```js d3.fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]); // 1 d3.sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]); // 0.9999999999999999 ``` Although slower, d3.fsum can replace d3.sum wherever greater precision is needed. Uses d3.Adder. # d3.fcumsum([values][, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/fsum.js), [Examples](https://observablehq.com/@d3/d3-fcumsum) Returns a full precision cumulative sum of the given *values*. ```js d3.fcumsum([1, 1e-14, -1]); // [1, 1.00000000000001, 1e-14] d3.cumsum([1, 1e-14, -1]); // [1, 1.00000000000001, 9.992e-15] ``` Although slower, d3.fcumsum can replace d3.cumsum when greater precision is needed. Uses d3.Adder. # new d3.Adder() Creates a full precision adder for [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) floating point numbers, setting its initial value to 0. # *adder*.add(number) Adds the specified *number* to the adder’s current value and returns the adder. # *adder*.valueOf() Returns the IEEE 754 double precision representation of the adder’s current value. Most useful as the short-hand notation `+adder`. ### Search Methods for searching arrays for a specific element. # d3.least(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/main/src/least.js), [Examples](https://observablehq.com/@d3/d3-least)
# d3.least(iterable[, accessor]) Returns the least element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns undefined. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: ```js const array = [{foo: 42}, {foo: 91}]; d3.least(array, (a, b) => a.foo - b.foo); // {foo: 42} d3.least(array, (a, b) => b.foo - a.foo); // {foo: 91} d3.least(array, a => a.foo); // {foo: 42} ``` This function is similar to [min](#min), except it allows the use of a comparator rather than an accessor. # d3.leastIndex(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/main/src/leastIndex.js), [Examples](https://observablehq.com/@d3/d3-least)
# d3.leastIndex(iterable[, accessor]) Returns the index of the least element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns -1. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: ```js const array = [{foo: 42}, {foo: 91}]; d3.leastIndex(array, (a, b) => a.foo - b.foo); // 0 d3.leastIndex(array, (a, b) => b.foo - a.foo); // 1 d3.leastIndex(array, a => a.foo); // 0 ``` This function is similar to [minIndex](#minIndex), except it allows the use of a comparator rather than an accessor. # d3.greatest(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/main/src/greatest.js), [Examples](https://observablehq.com/@d3/d3-least)
# d3.greatest(iterable[, accessor]) Returns the greatest element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns undefined. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: ```js const array = [{foo: 42}, {foo: 91}]; d3.greatest(array, (a, b) => a.foo - b.foo); // {foo: 91} d3.greatest(array, (a, b) => b.foo - a.foo); // {foo: 42} d3.greatest(array, a => a.foo); // {foo: 91} ``` This function is similar to [max](#max), except it allows the use of a comparator rather than an accessor. # d3.greatestIndex(iterable[, comparator]) · [Source](https://github.com/d3/d3-array/blob/main/src/greatestIndex.js), [Examples](https://observablehq.com/@d3/d3-least)
# d3.greatestIndex(iterable[, accessor]) Returns the index of the greatest element of the specified *iterable* according to the specified *comparator* or *accessor*. If the given *iterable* contains no comparable elements (*i.e.*, the comparator returns NaN when comparing each element to itself), returns -1. If *comparator* is not specified, it defaults to [ascending](#ascending). For example: ```js const array = [{foo: 42}, {foo: 91}]; d3.greatestIndex(array, (a, b) => a.foo - b.foo); // 1 d3.greatestIndex(array, (a, b) => b.foo - a.foo); // 0 d3.greatestIndex(array, a => a.foo); // 1 ``` This function is similar to [maxIndex](#maxIndex), except it allows the use of a comparator rather than an accessor. # d3.bisectLeft(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/main/src/bisect.js) Returns the insertion point for *x* in *array* to maintain sorted order. The arguments *lo* and *hi* may be used to specify a subset of the array which should be considered; by default the entire array is used. If *x* is already present in *array*, the insertion point will be before (to the left of) any existing entries. The return value is suitable for use as the first argument to [splice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) assuming that *array* is already sorted. The returned insertion point *i* partitions the *array* into two halves so that all *v* < *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* >= *x* for *v* in *array*.slice(*i*, *hi*) for the right side. # d3.bisect(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/main/src/bisect.js), [Examples](https://observablehq.com/@d3/d3-bisect)
# d3.bisectRight(array, x[, lo[, hi]]) Similar to [bisectLeft](#bisectLeft), but returns an insertion point which comes after (to the right of) any existing entries of *x* in *array*. The returned insertion point *i* partitions the *array* into two halves so that all *v* <= *x* for *v* in *array*.slice(*lo*, *i*) for the left side and all *v* > *x* for *v* in *array*.slice(*i*, *hi*) for the right side. # d3.bisectCenter(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/main/src/bisect.js), [Examples](https://observablehq.com/@d3/multi-line-chart) Returns the index of the value closest to *x* in the given *array* of numbers. The arguments *lo* (inclusive) and *hi* (exclusive) may be used to specify a subset of the array which should be considered; by default the entire array is used. See [*bisector*.center](#bisector_center). # d3.bisector(accessor) · [Source](https://github.com/d3/d3-array/blob/main/src/bisector.js)
# d3.bisector(comparator) Returns a new bisector using the specified *accessor* or *comparator* function. This method can be used to bisect arrays of objects instead of being limited to simple arrays of primitives. For example, given the following array of objects: ```js var data = [ {date: new Date(2011, 1, 1), value: 0.5}, {date: new Date(2011, 2, 1), value: 0.6}, {date: new Date(2011, 3, 1), value: 0.7}, {date: new Date(2011, 4, 1), value: 0.8} ]; ``` A suitable bisect function could be constructed as: ```js var bisectDate = d3.bisector(function(d) { return d.date; }).right; ``` This is equivalent to specifying a comparator: ```js var bisectDate = d3.bisector(function(d, x) { return d.date - x; }).right; ``` And then applied as *bisectDate*(*array*, *date*), returning an index. Note that the comparator is always passed the search value *x* as the second argument. Use a comparator rather than an accessor if you want values to be sorted in an order different than natural order, such as in descending rather than ascending order. # bisector.left(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/main/src/bisector.js) Equivalent to [bisectLeft](#bisectLeft), but uses this bisector’s associated comparator. # bisector.right(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/main/src/bisector.js) Equivalent to [bisectRight](#bisectRight), but uses this bisector’s associated comparator. # bisector.center(array, x[, lo[, hi]]) · [Source](https://github.com/d3/d3-array/blob/main/src/bisector.js) Returns the index of the closest value to *x* in the given sorted *array*. This expects that the bisector’s associated accessor returns a quantitative value, or that the bisector’s associated comparator returns a signed distance; otherwise, this method is equivalent to *bisector*.left. # d3.quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) · [Source](https://github.com/d3/d3-array/blob/main/src/quickselect.js), [Examples](https://observablehq.com/@d3/d3-quickselect) See [mourner/quickselect](https://github.com/mourner/quickselect/blob/main/README.md). # d3.ascending(a, b) · [Source](https://github.com/d3/d3-array/blob/main/src/ascending.js), [Examples](https://observablehq.com/@d3/d3-ascending) Returns -1 if *a* is less than *b*, or 1 if *a* is greater than *b*, or 0. This is the comparator function for natural order, and can be used in conjunction with the built-in [*array*.sort](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) method to arrange elements in ascending order. It is implemented as: ```js function ascending(a, b) { return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } ``` Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. # d3.descending(a, b) · [Source](https://github.com/d3/d3-array/blob/main/src/descending.js), [Examples](https://observablehq.com/@d3/d3-ascending) Returns -1 if *a* is greater than *b*, or 1 if *a* is less than *b*, or 0. This is the comparator function for reverse natural order, and can be used in conjunction with the built-in array sort method to arrange elements in descending order. It is implemented as: ```js function descending(a, b) { return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; } ``` Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic (alphabetical), not natural! This can lead to surprising behavior when sorting an array of numbers. ### Transformations Methods for transforming arrays and for generating new arrays. # d3.group(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) Groups the specified *iterable* of values into an [InternMap](#InternMap) from *key* to array of value. For example, given some data: ```js data = [ {name: "jim", amount: "34.0", date: "11/12/2015"}, {name: "carl", amount: "120.11", date: "11/12/2015"}, {name: "stacy", amount: "12.01", date: "01/04/2016"}, {name: "stacy", amount: "34.05", date: "01/04/2016"} ] ``` To group the data by name: ```js d3.group(data, d => d.name) ``` This produces: ```js Map(3) { "jim" => Array(1) "carl" => Array(1) "stacy" => Array(2) } ``` If more than one *key* is specified, a nested InternMap is returned. For example: ```js d3.group(data, d => d.name, d => d.date) ``` This produces: ```js Map(3) { "jim" => Map(1) { "11/12/2015" => Array(1) } "carl" => Map(1) { "11/12/2015" => Array(1) } "stacy" => Map(1) { "01/04/2016" => Array(2) } } ``` To convert a Map to an Array, use [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from). For example: ```js Array.from(d3.group(data, d => d.name)) ``` This produces: ```js [ ["jim", Array(1)], ["carl", Array(1)], ["stacy", Array(2)] ] ``` You can also simultaneously convert the [*key*, *value*] to some other representation by passing a map function to Array.from: ```js Array.from(d3.group(data, d => d.name), ([key, value]) => ({key, value})) ``` This produces: ```js [ {key: "jim", value: Array(1)}, {key: "carl", value: Array(1)}, {key: "stacy", value: Array(2)} ] ``` [*selection*.data](https://github.com/d3/d3-selection/blob/main/README.md#selection_data) accepts iterables directly, meaning that you can use a Map (or Set or other iterable) to perform a data join without first needing to convert to an array. # d3.groups(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) Equivalent to [group](#group), but returns nested arrays instead of nested maps. # d3.flatGroup(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-flatgroup) Equivalent to [group](#group), but returns a flat array of [*key0*, *key1*, …, *values*] instead of nested maps. # d3.index(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-group) Equivalent to [group](#group) but returns a unique value per compound key instead of an array, throwing if the key is not unique. For example, given the data defined above, ```js d3.index(data, d => d.amount) ``` returns ```js Map(4) { "34.0" => Object {name: "jim", amount: "34.0", date: "11/12/2015"} "120.11" => Object {name: "carl", amount: "120.11", date: "11/12/2015"} "12.01" => Object {name: "stacy", amount: "12.01", date: "01/04/2016"} "34.05" => Object {name: "stacy", amount: "34.05", date: "01/04/2016"} } ``` On the other hand, ```js d3.index(data, d => d.name) ``` throws an error because two objects share the same name. # d3.indexes(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-group) Equivalent to [index](#index), but returns nested arrays instead of nested maps. # d3.rollup(iterable, reduce, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) [Groups](#group) and reduces the specified *iterable* of values into an InternMap from *key* to value. For example, given some data: ```js data = [ {name: "jim", amount: "34.0", date: "11/12/2015"}, {name: "carl", amount: "120.11", date: "11/12/2015"}, {name: "stacy", amount: "12.01", date: "01/04/2016"}, {name: "stacy", amount: "34.05", date: "01/04/2016"} ] ``` To count the number of elements by name: ```js d3.rollup(data, v => v.length, d => d.name) ``` This produces: ```js Map(3) { "jim" => 1 "carl" => 1 "stacy" => 2 } ``` If more than one *key* is specified, a nested Map is returned. For example: ```js d3.rollup(data, v => v.length, d => d.name, d => d.date) ``` This produces: ```js Map(3) { "jim" => Map(1) { "11/12/2015" => 1 } "carl" => Map(1) { "11/12/2015" => 1 } "stacy" => Map(1) { "01/04/2016" => 2 } } ``` To convert a Map to an Array, use [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from). See [d3.group](#group) for examples. # d3.rollups(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-group-d3-rollup) Equivalent to [rollup](#rollup), but returns nested arrays instead of nested maps. # d3.flatRollup(iterable, ...keys) · [Source](https://github.com/d3/d3-array/blob/main/src/group.js), [Examples](https://observablehq.com/@d3/d3-flatgroup) Equivalent to [rollup](#rollup), but returns a flat array of [*key0*, *key1*, …, *value*] instead of nested maps. # d3.groupSort(iterable, comparator, key) · [Source](https://github.com/d3/d3-array/blob/main/src/groupSort.js), [Examples](https://observablehq.com/@d3/d3-groupsort)
# d3.groupSort(iterable, accessor, key) Groups the specified *iterable* of elements according to the specified *key* function, sorts the groups according to the specified *comparator*, and then returns an array of keys in sorted order. For example, if you had a table of barley yields for different varieties, sites, and years, to sort the barley varieties by ascending median yield: ```js d3.groupSort(barley, g => d3.median(g, d => d.yield), d => d.variety) ``` For descending order, negate the group value: ```js d3.groupSort(barley, g => -d3.median(g, d => d.yield), d => d.variety) ``` If a *comparator* is passed instead of an *accessor* (i.e., if the second argument is a function that takes exactly two arguments), it will be asked to compare two groups *a* and *b* and should return a negative value if *a* should be before *b*, a positive value if *a* should be after *b*, or zero for a partial ordering. # d3.count(iterable[, accessor]) · [Source](https://github.com/d3/d3-array/blob/main/src/count.js), [Examples](https://observablehq.com/@d3/d3-count) Returns the number of valid number values (*i.e.*, not null, NaN, or undefined) in the specified *iterable*; accepts an accessor. For example: ```js d3.count([{n: "Alice", age: NaN}, {n: "Bob", age: 18}, {n: "Other"}], d => d.age) // 1 ``` # d3.cross(...iterables[, reducer]) · [Source](https://github.com/d3/d3-array/blob/main/src/cross.js), [Examples](https://observablehq.com/@d3/d3-cross) Returns the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the specified *iterables*. For example, if two iterables *a* and *b* are specified, for each element *i* in the iterable *a* and each element *j* in the iterable *b*, in order, invokes the specified *reducer* function passing the element *i* and element *j*. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: ```js function pair(a, b) { return [a, b]; } ``` For example: ```js d3.cross([1, 2], ["x", "y"]); // returns [[1, "x"], [1, "y"], [2, "x"], [2, "y"]] d3.cross([1, 2], ["x", "y"], (a, b) => a + b); // returns ["1x", "1y", "2x", "2y"] ``` # d3.merge(iterables) · [Source](https://github.com/d3/d3-array/blob/main/src/merge.js), [Examples](https://observablehq.com/@d3/d3-merge) Merges the specified iterable of *iterables* into a single array. This method is similar to the built-in array concat method; the only difference is that it is more convenient when you have an array of arrays. ```js d3.merge([[1], [2, 3]]); // returns [1, 2, 3] ``` # d3.pairs(iterable[, reducer]) · [Source](https://github.com/d3/d3-array/blob/main/src/pairs.js), [Examples](https://observablehq.com/@d3/d3-pairs) For each adjacent pair of elements in the specified *iterable*, in order, invokes the specified *reducer* function passing the element *i* and element *i* - 1. If a *reducer* is not specified, it defaults to a function which creates a two-element array for each pair: ```js function pair(a, b) { return [a, b]; } ``` For example: ```js d3.pairs([1, 2, 3, 4]); // returns [[1, 2], [2, 3], [3, 4]] d3.pairs([1, 2, 3, 4], (a, b) => b - a); // returns [1, 1, 1]; ``` If the specified iterable has fewer than two elements, returns the empty array. # d3.permute(source, keys) · [Source](https://github.com/d3/d3-array/blob/main/src/permute.js), [Examples](https://observablehq.com/@d3/d3-permute) Returns a permutation of the specified *source* object (or array) using the specified iterable of *keys*. The returned array contains the corresponding property of the source object for each key in *keys*, in order. For example: ```js permute(["a", "b", "c"], [1, 2, 0]); // returns ["b", "c", "a"] ``` It is acceptable to have more keys than source elements, and for keys to be duplicated or omitted. This method can also be used to extract the values from an object into an array with a stable order. Extracting keyed values in order can be useful for generating data arrays in nested selections. For example: ```js let object = {yield: 27, variety: "Manchuria", year: 1931, site: "University Farm"}; let fields = ["site", "variety", "yield"]; d3.permute(object, fields); // returns ["University Farm", "Manchuria", 27] ``` # d3.shuffle(array[, start[, stop]]) · [Source](https://github.com/d3/d3-array/blob/main/src/shuffle.js), [Examples](https://observablehq.com/@d3/d3-shuffle) Randomizes the order of the specified *array* in-place using the [Fisher–Yates shuffle](https://bost.ocks.org/mike/shuffle/) and returns the *array*. If *start* is specified, it is the starting index (inclusive) of the *array* to shuffle; if *start* is not specified, it defaults to zero. If *stop* is specified, it is the ending index (exclusive) of the *array* to shuffle; if *stop* is not specified, it defaults to *array*.length. For example, to shuffle the first ten elements of the *array*: shuffle(*array*, 0, 10). # d3.shuffler(random) · [Source](https://github.com/d3/d3-array/blob/main/src/shuffle.js) Returns a [shuffle function](#shuffle) given the specified random source. For example, using [d3.randomLcg](https://github.com/d3/d3-random/blob/main/README.md#randomLcg): ```js const random = d3.randomLcg(0.9051667019185816); const shuffle = d3.shuffler(random); shuffle([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); // returns [7, 4, 5, 3, 9, 0, 6, 1, 2, 8] ``` # d3.ticks(start, stop, count) · [Source](https://github.com/d3/d3-array/blob/main/src/ticks.js), [Examples](https://observablehq.com/@d3/d3-ticks) Returns an array of approximately *count* + 1 uniformly-spaced, nicely-rounded values between *start* and *stop* (inclusive). Each value is a power of ten multiplied by 1, 2 or 5. See also [d3.tickIncrement](#tickIncrement), [d3.tickStep](#tickStep) and [*linear*.ticks](https://github.com/d3/d3-scale/blob/main/README.md#linear_ticks). Ticks are inclusive in the sense that they may include the specified *start* and *stop* values if (and only if) they are exact, nicely-rounded values consistent with the inferred [step](#tickStep). More formally, each returned tick *t* satisfies *start* ≤ *t* and *t* ≤ *stop*. # d3.tickIncrement(start, stop, count) · [Source](https://github.com/d3/d3-array/blob/main/src/ticks.js), [Examples](https://observablehq.com/@d3/d3-ticks) Like [d3.tickStep](#tickStep), except requires that *start* is always less than or equal to *stop*, and if the tick step for the given *start*, *stop* and *count* would be less than one, returns the negative inverse tick step instead. This method is always guaranteed to return an integer, and is used by [d3.ticks](#ticks) to guarantee that the returned tick values are represented as precisely as possible in IEEE 754 floating point. # d3.tickStep(start, stop, count) · [Source](https://github.com/d3/d3-array/blob/main/src/ticks.js), [Examples](https://observablehq.com/@d3/d3-ticks) Returns the difference between adjacent tick values if the same arguments were passed to [d3.ticks](#ticks): a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5. Note that due to the limited precision of IEEE 754 floating point, the returned value may not be exact decimals; use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption. # d3.nice(start, stop, count) · [Source](https://github.com/d3/d3-array/blob/main/src/nice.js) Returns a new interval [*niceStart*, *niceStop*] covering the given interval [*start*, *stop*] and where *niceStart* and *niceStop* are guaranteed to align with the corresponding [tick step](#tickStep). Like [d3.tickIncrement](#tickIncrement), this requires that *start* is less than or equal to *stop*. # d3.range([start, ]stop[, step]) · [Source](https://github.com/d3/d3-array/blob/main/src/range.js), [Examples](https://observablehq.com/@d3/d3-range) Returns an array containing an arithmetic progression, similar to the Python built-in [range](http://docs.python.org/library/functions.html#range). This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale. (See also [d3.ticks](#ticks) for nicely-rounded values.) If *step* is omitted, it defaults to 1. If *start* is omitted, it defaults to 0. The *stop* value is exclusive; it is not included in the result. If *step* is positive, the last element is the largest *start* + *i* \* *step* less than *stop*; if *step* is negative, the last element is the smallest *start* + *i* \* *step* greater than *stop*. If the returned array would contain an infinite number of values, an empty range is returned. The arguments are not required to be integers; however, the results are more predictable if they are. The values in the returned array are defined as *start* + *i* \* *step*, where *i* is an integer from zero to one minus the total number of elements in the returned array. For example: ```js d3.range(0, 1, 0.2) // [0, 0.2, 0.4, 0.6000000000000001, 0.8] ``` This unexpected behavior is due to IEEE 754 double-precision floating point, which defines 0.2 * 3 = 0.6000000000000001. Use [d3-format](https://github.com/d3/d3-format) to format numbers for human consumption with appropriate rounding; see also [linear.tickFormat](https://github.com/d3/d3-scale/blob/main/README.md#linear_tickFormat) in [d3-scale](https://github.com/d3/d3-scale). Likewise, if the returned array should have a specific length, consider using [array.map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on an integer range. For example: ```js d3.range(0, 1, 1 / 49); // BAD: returns 50 elements! d3.range(49).map(function(d) { return d / 49; }); // GOOD: returns 49 elements. ``` # d3.transpose(matrix) · [Source](https://github.com/d3/d3-array/blob/main/src/transpose.js), [Examples](https://observablehq.com/@d3/d3-transpose) Uses the [zip](#zip) operator as a two-dimensional [matrix transpose](http://en.wikipedia.org/wiki/Transpose). # d3.zip(arrays…) · [Source](https://github.com/d3/d3-array/blob/main/src/zip.js), [Examples](https://observablehq.com/@d3/d3-transpose) Returns an array of arrays, where the *i*th array contains the *i*th element from each of the argument *arrays*. The returned array is truncated in length to the shortest array in *arrays*. If *arrays* contains only a single array, the returned array contains one-element arrays. With no arguments, the returned array is empty. ```js d3.zip([1, 2], [3, 4]); // returns [[1, 3], [2, 4]] ``` ### Iterables These are equivalent to built-in array methods, but work with any iterable including Map, Set, and Generator. # d3.every(iterable, test) · [Source](https://github.com/d3/d3-array/blob/main/src/every.js) Returns true if the given *test* function returns true for every value in the given *iterable*. This method returns as soon as *test* returns a non-truthy value or all values are iterated over. Equivalent to [*array*.every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every): ```js d3.every(new Set([1, 3, 5, 7]), x => x & 1) // true ``` # d3.some(iterable, test) · [Source](https://github.com/d3/d3-array/blob/main/src/some.js) Returns true if the given *test* function returns true for any value in the given *iterable*. This method returns as soon as *test* returns a truthy value or all values are iterated over. Equivalent to [*array*.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some): ```js d3.some(new Set([0, 2, 3, 4]), x => x & 1) // true ``` # d3.filter(iterable, test) · [Source](https://github.com/d3/d3-array/blob/main/src/filter.js) Returns a new array containing the values from *iterable*, in order, for which the given *test* function returns true. Equivalent to [*array*.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter): ```js d3.filter(new Set([0, 2, 3, 4]), x => x & 1) // [3] ``` # d3.map(iterable, mapper) · [Source](https://github.com/d3/d3-array/blob/main/src/map.js) Returns a new array containing the mapped values from *iterable*, in order, as defined by given *mapper* function. Equivalent to [*array*.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) and [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from): ```js d3.map(new Set([0, 2, 3, 4]), x => x & 1) // [0, 0, 1, 0] ``` # d3.reduce(iterable, reducer[, initialValue]) · [Source](https://github.com/d3/d3-array/blob/main/src/reduce.js) Returns the reduced value defined by given *reducer* function, which is repeatedly invoked for each value in *iterable*, being passed the current reduced value and the next value. Equivalent to [*array*.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce): ```js d3.reduce(new Set([0, 2, 3, 4]), (p, v) => p + v, 0) // 9 ``` # d3.reverse(iterable) · [Source](https://github.com/d3/d3-array/blob/main/src/reverse.js) Returns an array containing the values in the given *iterable* in reverse order. Equivalent to [*array*.reverse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse), except that it does not mutate the given *iterable*: ```js d3.reverse(new Set([0, 2, 3, 1])) // [1, 3, 2, 0] ``` # d3.sort(iterable, comparator = d3.ascending) · [Source](https://github.com/d3/d3-array/blob/main/src/sort.js)
# d3.sort(iterable, ...accessors) Returns an array containing the values in the given *iterable* in the sorted order defined by the given *comparator* or *accessor* function. If *comparator* is not specified, it defaults to [d3.ascending](#ascending). Equivalent to [*array*.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort), except that it does not mutate the given *iterable*, and the comparator defaults to natural order instead of lexicographic order: ```js d3.sort(new Set([0, 2, 3, 1])) // [0, 1, 2, 3] ``` If an *accessor* (a function that does not take exactly two arguments) is specified, ```js d3.sort(data, d => d.value) ``` it is equivalent to a *comparator* using [natural order](#ascending): ```js d3.sort(data, (a, b) => d3.ascending(a.value, b.value)) ``` The *accessor* is only invoked once per element, and thus the returned sorted order is consistent even if the accessor is nondeterministic. Multiple accessors may be specified to break ties: ```js d3.sort(points, ({x}) => x, ({y}) => y) ``` This is equivalent to: ```js d3.sort(data, (a, b) => d3.ascending(a.x, b.x) || d3.ascending(a.y, b.y)) ``` ### Sets This methods implement basic set operations for any iterable. # d3.difference(iterable, ...others) · [Source](https://github.com/d3/d3-array/blob/main/src/difference.js) Returns a new InternSet containing every value in *iterable* that is not in any of the *others* iterables. ```js d3.difference([0, 1, 2, 0], [1]) // Set {0, 2} ``` # d3.union(...iterables) · [Source](https://github.com/d3/d3-array/blob/main/src/union.js) Returns a new InternSet containing every (distinct) value that appears in any of the given *iterables*. The order of values in the returned set is based on their first occurrence in the given *iterables*. ```js d3.union([0, 2, 1, 0], [1, 3]) // Set {0, 2, 1, 3} ``` # d3.intersection(...iterables) · [Source](https://github.com/d3/d3-array/blob/main/src/intersection.js) Returns a new InternSet containing every (distinct) value that appears in all of the given *iterables*. The order of values in the returned set is based on their first occurrence in the given *iterables*. ```js d3.intersection([0, 2, 1, 0], [1, 3]) // Set {1} ``` # d3.superset(a, b) · [Source](https://github.com/d3/d3-array/blob/main/src/superset.js) Returns true if *a* is a superset of *b*: if every value in the given iterable *b* is also in the given iterable *a*. ```js d3.superset([0, 2, 1, 3, 0], [1, 3]) // true ``` # d3.subset(a, b) · [Source](https://github.com/d3/d3-array/blob/main/src/subset.js) Returns true if *a* is a subset of *b*: if every value in the given iterable *a* is also in the given iterable *b*. ```js d3.subset([1, 3], [0, 2, 1, 3, 0]) // true ``` # d3.disjoint(a, b) · [Source](https://github.com/d3/d3-array/blob/main/src/disjoint.js) Returns true if *a* and *b* are disjoint: if *a* and *b* contain no shared value. ```js d3.disjoint([1, 3], [2, 4]) // true ``` ### Bins [Histogram](http://bl.ocks.org/mbostock/3048450) Binning groups discrete samples into a smaller number of consecutive, non-overlapping intervals. They are often used to visualize the distribution of numerical data as histograms. # d3.bin() · [Source](https://github.com/d3/d3-array/blob/main/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) Constructs a new bin generator with the default settings. # bin(data) · [Source](https://github.com/d3/d3-array/blob/main/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) Bins the given iterable of *data* samples. Returns an array of bins, where each bin is an array containing the associated elements from the input *data*. Thus, the `length` of the bin is the number of elements in that bin. Each bin has two additional attributes: * `x0` - the lower bound of the bin (inclusive). * `x1` - the upper bound of the bin (exclusive, except for the last bin). Any null or non-comparable values in the given *data*, or those outside the [domain](#bin_domain), are ignored. # bin.value([value]) · [Source](https://github.com/d3/d3-array/blob/main/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) If *value* is specified, sets the value accessor to the specified function or constant and returns this bin generator. If *value* is not specified, returns the current value accessor, which defaults to the identity function. When bins are [generated](#_bin), the value accessor will be invoked for each element in the input data array, being passed the element `d`, the index `i`, and the array `data` as three arguments. The default value accessor assumes that the input data are orderable (comparable), such as numbers or dates. If your data are not, then you should specify an accessor that returns the corresponding orderable value for a given datum. This is similar to mapping your data to values before invoking the bin generator, but has the benefit that the input data remains associated with the returned bins, thereby making it easier to access other fields of the data. # bin.domain([domain]) · [Source](https://github.com/d3/d3-array/blob/main/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin) If *domain* is specified, sets the domain accessor to the specified function or array and returns this bin generator. If *domain* is not specified, returns the current domain accessor, which defaults to [extent](#extent). The bin domain is defined as an array [*min*, *max*], where *min* is the minimum observable value and *max* is the maximum observable value; both values are inclusive. Any value outside of this domain will be ignored when the bins are [generated](#_bin). For example, if you are using the bin generator in conjunction with a [linear scale](https://github.com/d3/d3-scale/blob/main/README.md#linear-scales) `x`, you might say: ```js var bin = d3.bin() .domain(x.domain()) .thresholds(x.ticks(20)); ``` You can then compute the bins from an array of numbers like so: ```js var bins = bin(numbers); ``` If the default [extent](#extent) domain is used and the [thresholds](#bin_thresholds) are specified as a count (rather than explicit values), then the computed domain will be [niced](#nice) such that all bins are uniform width. Note that the domain accessor is invoked on the materialized array of [values](#bin_value), not on the input data array. # bin.thresholds([count]) · [Source](https://github.com/d3/d3-array/blob/main/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin)
# bin.thresholds([thresholds]) If *thresholds* is specified, sets the [threshold generator](#bin-thresholds) to the specified function or array and returns this bin generator. If *thresholds* is not specified, returns the current threshold generator, which by default implements [Sturges’ formula](#thresholdSturges). (Thus by default, the values to be binned must be numbers!) Thresholds are defined as an array of values [*x0*, *x1*, …]. Any value less than *x0* will be placed in the first bin; any value greater than or equal to *x0* but less than *x1* will be placed in the second bin; and so on. Thus, the [generated bins](#_bin) will have *thresholds*.length + 1 bins. See [bin thresholds](#bin-thresholds) for more information. Any threshold values outside the [domain](#bin_domain) are ignored. The first *bin*.x0 is always equal to the minimum domain value, and the last *bin*.x1 is always equal to the maximum domain value. If a *count* is specified instead of an array of *thresholds*, then the [domain](#bin_domain) will be uniformly divided into approximately *count* bins; see [ticks](#ticks). #### Bin Thresholds These functions are typically not used directly; instead, pass them to [*bin*.thresholds](#bin_thresholds). # d3.thresholdFreedmanDiaconis(values, min, max) · [Source](https://github.com/d3/d3-array/blob/main/src/threshold/freedmanDiaconis.js), [Examples](https://observablehq.com/@d3/d3-bin) Returns the number of bins according to the [Freedman–Diaconis rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. # d3.thresholdScott(values, min, max) · [Source](https://github.com/d3/d3-array/blob/main/src/threshold/scott.js), [Examples](https://observablehq.com/@d3/d3-bin) Returns the number of bins according to [Scott’s normal reference rule](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. # d3.thresholdSturges(values) · [Source](https://github.com/d3/d3-array/blob/main/src/threshold/sturges.js), [Examples](https://observablehq.com/@d3/d3-bin) Returns the number of bins according to [Sturges’ formula](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers. You may also implement your own threshold generator taking three arguments: the array of input [*values*](#bin_value) derived from the data, and the [observable domain](#bin_domain) represented as *min* and *max*. The generator may then return either the array of numeric thresholds or the *count* of bins; in the latter case the domain is divided uniformly into approximately *count* bins; see [ticks](#ticks). For instance, when binning date values, you might want to use the ticks from a time scale ([Example](https://observablehq.com/@d3/d3-bin-time-thresholds)). ### Interning # new d3.InternMap([iterable][, key]) · [Source](https://github.com/mbostock/internmap/blob/main/src/index.js), [Examples](https://observablehq.com/d/d4c5f6ad343866b9)
# new d3.InternSet([iterable][, key]) · [Source](https://github.com/mbostock/internmap/blob/main/src/index.js), [Examples](https://observablehq.com/d/d4c5f6ad343866b9) The [InternMap and InternSet](https://github.com/mbostock/internmap) classes extend the native JavaScript Map and Set classes, respectively, allowing Dates and other non-primitive keys by bypassing the [SameValueZero algorithm](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness) when determining key equality. d3.group, d3.rollup and d3.index use an InternMap rather than a native Map. These two classes are exported for convenience. d3-array-3.1.1/img/000077500000000000000000000000001412622006300137065ustar00rootroot00000000000000d3-array-3.1.1/img/histogram.png000066400000000000000000000235561412622006300164240ustar00rootroot00000000000000PNG  IHDR}^ iCCPICC ProfileHPSϽBc**!JbG\ *"TV",*X#}o{3ߜ||䜙 _fi,A=*: 8)a2AAw}l_%Nd!d!| _5VegyAg3-?ϽssBd 8~GlCF#lcsy["Jb"됑g0--} Ou8/drD<-s{p35vo PG$ ]ٳt?.0=,' }l S])X|[`Az>/u~C b,pNRXgs#.pfJwQ^ (}cZbo,ZYIa>=Da'xxp|~&?5hToQ>3;Tnr8X'H? VϞ+_#r-I3x,cCwn'}OKb.$Y15|bNrvpf%df:fi TFX_o+xP$ 2B٢QT"Jڀ*@PM.T&jEStG Rt ݋AOc(%Da8U|L1ӊ|b4냍&cbw`a!(v p@Ý>IxU9 sY s4AE'؄5]jB:a0M$adfb xD"H$.iBL!}&KX\K&'P(J %RO@yB$F3c6{#Nw_!#^,~Rk SbDD]IIdd+/pRRRl*TU'U>s/2tWz*KPSRQU M먇7? jj$jјT \٨@eu@OkJ[G;R{v 9NN#]nn-=^!A}XJ?ILl`m58d0d13V5"e5ӌsۍߘhĘ13njejZmL,׬읹9˼bE[KÖVV[zYX m4mlmJlshw} ?R^,Yzɨ#ӱq؉tiY͙\EÅRU57S7[۔znGǀgg/u/WׄZn eQϘ]G +{/ | %\,,d]H_(5tehC0]auÅ=SEQ&Q룮E+Ds;bp1151<_6k{g˯PXJ̕'0qq q_*d<#<~:zvac'8&%u}aM_pܫlҮ*>=}YuDuO?(|ׅ7(5jb 8dTLk.l-–?|߉'Ni*oAmk&ړڇ;;:};{Z132gv%;;s.d7yў=/D];pK^.x+Wm_oկmmw v -:{7/bܺv{;wݍ;|}od?~QcOT[OF_ױggU׿0qzk|岗c_!G7t"jb̻~34c驂O>~%u}h&mf0 81wP0Ql s9YP@&r -8k\la!(3|qO33uM033}hf[5}3?,l5iTXtXML:com.adobe.xmp 960 500 2IDATxl/R6 =Qy-k^<>~}088%F4h @@h02sv5U~ 4hp-flyٗrBޮVvY3<8q4@t=kChT}[֍/'wތʫ/?oɦ#e쾁S/͊M|_jj ⵱ă;J ʎ|4;+[wޱ51_/ ?R=_7܈__9ٿw%OlmzEOxžy 0uu ڗ{3fd%~d Qws8 &JY'p{e󿜪~/ųg~L;m\ 47%kbzݧw8MG;5\Mp& Se1k  @@ h @@ h @@ h @@ h @@ h @@ h @@ h @@ h @@ h `eUns 4h @@`$eE-5~K{/+/*3%g:.R|4+RӾK蚼d"<^K F0Y8n-W89Sw"q`/@2ҫ'߼?<$ϔct.(+]|ɓ۷Kn]W?/]yH&BO`d rZϚB*q`ϽC(|k(jz!䭯)++ DW#/ %ajƚ!|a3;?;o=~ԁ J판xunk'ߚ\>;۴ g;:fkg_ȨǛ7w''Ѐ~8 SO(yJf8~J03VA~,nI{uCpxuucթ}8_Q_S~3y~SIkk{ϛ=5ZǮt-YRٹ'O46*@@c=4-2:Nlsb]= @@ )OƷܽmDϝ:{e%68dRh \PV'koK9_K.{Ȓ>Bg2T?k734]n-gM whKv.yf8"c;0JrC DW#/ ghڜ˦N+n)/7oΚ¥TexU"Ƴt<s{+k7o/]3{yO´ygi0*@_lɋ]󿞓%^魂+B2%Οh⸎sS[fOMeeukML0)Fh`Ȏ?]ͳoNWj*Uwǟd |G?p#{:~~E%7Whjx*j;P`t4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h @@4h "ac=4TA9g4h0!p>熷Nvg88y (a]We&!obË 2NɌM8XK{M  07MMQz_XRjߺQ= +w57ߝrzs??݄8!)-&+3{,qX̜~qחƒ>f>h)gm}_z4ҢES:6 ӦY! {Oٗ;+7LOmm!]< !rǞylkN\Yk0hضz3h @@ xCe1k + @@ćHeNf> s^|YMcMKgμԫES:6\`qXJ^w]:?ۮTUO /n: ڵ?sK;oJm]<40k7o5W| 4hO|>ʳ;5U~0@ 4hS]XW}vfQ™TvMoɐU{~wn?mdﶿouO/Vwݕ{Y=ʟ:/|'D;_[Y=dU/1Yѱ|um3&\@y(fwқ g\ \@ç7ߓ{Uw&]1ßmYTPrEhsdϽ=>ef1+ @@s4cv5U~'e>+?'MV oYf,*/% 10appB'L0_ ݌M?L`aaaa4.п- @@ĝ X1 螞dH߉dGFz ޱci$)1i ain|87z\EiYv:TŬk֭X0멦shzjœ֭UTGDN𑧑>;ZO^k +&,Xaê9*DqkYjݚfhqֲf뒑?SZ7,iptCa3o6Co--]{p0FkR3iӻÇI]k45ו5rz$kKSW{#~ Zc24W_$7t ɽᡃQ?6:sl?U4]_{|MDkں7ܸϙp9r>f?ZbnKӈR|Kztna,ӘԲ,ӺeSK8'gJH^%Wѐl]0ѻ}uS{)C4]JGѻ>Fiؘp䏍cOÙ2h}ti4UcQƮC'J:>zW~,m==XG/I&srr"?_%rcrlW8pxrb1ӈ4-O_ 4h  4h f[ZIENDB`d3-array-3.1.1/package.json000066400000000000000000000033571412622006300154300ustar00rootroot00000000000000{ "name": "d3-array", "version": "3.1.1", "description": "Array manipulation, ordering, searching, summarizing, etc.", "homepage": "https://d3js.org/d3-array/", "repository": { "type": "git", "url": "https://github.com/d3/d3-array.git" }, "keywords": [ "d3", "d3-module", "histogram", "bisect", "shuffle", "statistics", "search", "sort", "array" ], "license": "ISC", "author": { "name": "Mike Bostock", "url": "http://bost.ocks.org/mike" }, "type": "module", "files": [ "dist/**/*.js", "src/**/*.js" ], "module": "src/index.js", "main": "src/index.js", "jsdelivr": "dist/d3-array.min.js", "unpkg": "dist/d3-array.min.js", "exports": { "umd": "./dist/d3-array.min.js", "default": "./src/index.js" }, "sideEffects": false, "dependencies": { "internmap": "1 - 2" }, "devDependencies": { "@rollup/plugin-node-resolve": "13", "d3-random": "2 - 3", "eslint": "7", "jsdom": "17", "mocha": "9", "rollup": "2", "rollup-plugin-terser": "7" }, "scripts": { "test": "mocha 'test/**/*-test.js' && eslint src test", "prepublishOnly": "rm -rf dist && yarn test && rollup -c", "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -" }, "engines": { "node": ">=12" } } d3-array-3.1.1/rollup.config.js000066400000000000000000000024001412622006300162450ustar00rootroot00000000000000import {nodeResolve} from "@rollup/plugin-node-resolve"; import {readFileSync} from "fs"; import {terser} from "rollup-plugin-terser"; import * as meta from "./package.json"; // Extract copyrights from the LICENSE. const copyright = readFileSync("./LICENSE", "utf-8") .split(/\n/g) .filter(line => /^copyright\s+/i.test(line)) .map(line => line.replace(/^copyright\s+/i, "")) .join(", "); const config = { input: "src/index.js", external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)), output: { file: `dist/${meta.name}.js`, name: "d3", format: "umd", indent: false, extend: true, banner: `// ${meta.homepage} v${meta.version} Copyright ${copyright}`, globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) }, plugins: [ nodeResolve() ] }; export default [ config, { ...config, output: { ...config.output, file: `dist/${meta.name}.min.js` }, plugins: [ ...config.plugins, terser({ output: { preamble: config.output.banner }, mangle: { reserved: [ "InternMap", "InternSet" ] } }) ] } ]; d3-array-3.1.1/src/000077500000000000000000000000001412622006300137215ustar00rootroot00000000000000d3-array-3.1.1/src/array.js000066400000000000000000000001321412622006300153710ustar00rootroot00000000000000var array = Array.prototype; export var slice = array.slice; export var map = array.map; d3-array-3.1.1/src/ascending.js000066400000000000000000000001771412622006300162170ustar00rootroot00000000000000export default function ascending(a, b) { return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } d3-array-3.1.1/src/bin.js000066400000000000000000000060621412622006300150330ustar00rootroot00000000000000import {slice} from "./array.js"; import bisect from "./bisect.js"; import constant from "./constant.js"; import extent from "./extent.js"; import identity from "./identity.js"; import nice from "./nice.js"; import ticks, {tickIncrement} from "./ticks.js"; import sturges from "./threshold/sturges.js"; export default function bin() { var value = identity, domain = extent, threshold = sturges; function histogram(data) { if (!Array.isArray(data)) data = Array.from(data); var i, n = data.length, x, values = new Array(n); for (i = 0; i < n; ++i) { values[i] = value(data[i], i, data); } var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); // Convert number of thresholds into uniform thresholds, and nice the // default domain accordingly. if (!Array.isArray(tz)) { const max = x1, tn = +tz; if (domain === extent) [x0, x1] = nice(x0, x1, tn); tz = ticks(x0, x1, tn); // If the last threshold is coincident with the domain’s upper bound, the // last bin will be zero-width. If the default domain is used, and this // last threshold is coincident with the maximum input value, we can // extend the niced upper bound by one tick to ensure uniform bin widths; // otherwise, we simply remove the last threshold. Note that we don’t // coerce values or the domain to numbers, and thus must be careful to // compare order (>=) rather than strict equality (===)! if (tz[tz.length - 1] >= x1) { if (max >= x1 && domain === extent) { const step = tickIncrement(x0, x1, tn); if (isFinite(step)) { if (step > 0) { x1 = (Math.floor(x1 / step) + 1) * step; } else if (step < 0) { x1 = (Math.ceil(x1 * -step) + 1) / -step; } } } else { tz.pop(); } } } // Remove any thresholds outside the domain. var m = tz.length; while (tz[0] <= x0) tz.shift(), --m; while (tz[m - 1] > x1) tz.pop(), --m; var bins = new Array(m + 1), bin; // Initialize bins. for (i = 0; i <= m; ++i) { bin = bins[i] = []; bin.x0 = i > 0 ? tz[i - 1] : x0; bin.x1 = i < m ? tz[i] : x1; } // Assign data to bins by value, ignoring any outside the domain. for (i = 0; i < n; ++i) { x = values[i]; if (x != null && x0 <= x && x <= x1) { bins[bisect(tz, x, 0, m)].push(data[i]); } } return bins; } histogram.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; }; histogram.domain = function(_) { return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; }; histogram.thresholds = function(_) { return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; }; return histogram; } d3-array-3.1.1/src/bisect.js000066400000000000000000000005211412622006300155260ustar00rootroot00000000000000import ascending from "./ascending.js"; import bisector from "./bisector.js"; import number from "./number.js"; const ascendingBisect = bisector(ascending); export const bisectRight = ascendingBisect.right; export const bisectLeft = ascendingBisect.left; export const bisectCenter = bisector(number).center; export default bisectRight; d3-array-3.1.1/src/bisector.js000066400000000000000000000020101412622006300160620ustar00rootroot00000000000000import ascending from "./ascending.js"; export default function bisector(f) { let delta = f; let compare1 = f; let compare2 = f; if (f.length !== 2) { delta = (d, x) => f(d) - x; compare1 = ascending; compare2 = (d, x) => ascending(f(d), x); } function left(a, x, lo = 0, hi = a.length) { if (lo < hi) { if (compare1(x, x) !== 0) return hi; do { const mid = (lo + hi) >>> 1; if (compare2(a[mid], x) < 0) lo = mid + 1; else hi = mid; } while (lo < hi); } return lo; } function right(a, x, lo = 0, hi = a.length) { if (lo < hi) { if (compare1(x, x) !== 0) return hi; do { const mid = (lo + hi) >>> 1; if (compare2(a[mid], x) <= 0) lo = mid + 1; else hi = mid; } while (lo < hi); } return lo; } function center(a, x, lo = 0, hi = a.length) { const i = left(a, x, lo, hi - 1); return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; } return {left, center, right}; } d3-array-3.1.1/src/constant.js000066400000000000000000000000721412622006300161070ustar00rootroot00000000000000export default function constant(x) { return () => x; } d3-array-3.1.1/src/count.js000066400000000000000000000006501412622006300154100ustar00rootroot00000000000000export default function count(values, valueof) { let count = 0; if (valueof === undefined) { for (let value of values) { if (value != null && (value = +value) >= value) { ++count; } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { ++count; } } } return count; } d3-array-3.1.1/src/cross.js000066400000000000000000000015501412622006300154110ustar00rootroot00000000000000function length(array) { return array.length | 0; } function empty(length) { return !(length > 0); } function arrayify(values) { return typeof values !== "object" || "length" in values ? values : Array.from(values); } function reducer(reduce) { return values => reduce(...values); } export default function cross(...values) { const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop()); values = values.map(arrayify); const lengths = values.map(length); const j = values.length - 1; const index = new Array(j + 1).fill(0); const product = []; if (j < 0 || lengths.some(empty)) return product; while (true) { product.push(index.map((j, i) => values[i][j])); let i = j; while (++index[i] === lengths[i]) { if (i === 0) return reduce ? product.map(reduce) : product; index[i--] = 0; } } } d3-array-3.1.1/src/cumsum.js000066400000000000000000000003321412622006300155660ustar00rootroot00000000000000export default function cumsum(values, valueof) { var sum = 0, index = 0; return Float64Array.from(values, valueof === undefined ? v => (sum += +v || 0) : v => (sum += +valueof(v, index++, values) || 0)); }d3-array-3.1.1/src/descending.js000066400000000000000000000002201412622006300163540ustar00rootroot00000000000000export default function descending(a, b) { return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; } d3-array-3.1.1/src/deviation.js000066400000000000000000000002441412622006300162410ustar00rootroot00000000000000import variance from "./variance.js"; export default function deviation(values, valueof) { const v = variance(values, valueof); return v ? Math.sqrt(v) : v; } d3-array-3.1.1/src/difference.js000066400000000000000000000003721412622006300163530ustar00rootroot00000000000000import {InternSet} from "internmap"; export default function difference(values, ...others) { values = new InternSet(values); for (const other of others) { for (const value of other) { values.delete(value); } } return values; } d3-array-3.1.1/src/disjoint.js000066400000000000000000000006241412622006300161040ustar00rootroot00000000000000import {InternSet} from "internmap"; export default function disjoint(values, other) { const iterator = other[Symbol.iterator](), set = new InternSet(); for (const v of values) { if (set.has(v)) return false; let value, done; while (({value, done} = iterator.next())) { if (done) break; if (Object.is(v, value)) return false; set.add(value); } } return true; } d3-array-3.1.1/src/every.js000066400000000000000000000004111412622006300154050ustar00rootroot00000000000000export default function every(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); let index = -1; for (const value of values) { if (!test(value, ++index, values)) { return false; } } return true; } d3-array-3.1.1/src/extent.js000066400000000000000000000013231412622006300155650ustar00rootroot00000000000000export default function extent(values, valueof) { let min; let max; if (valueof === undefined) { for (const value of values) { if (value != null) { if (min === undefined) { if (value >= value) min = max = value; } else { if (min > value) min = value; if (max < value) max = value; } } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null) { if (min === undefined) { if (value >= value) min = max = value; } else { if (min > value) min = value; if (max < value) max = value; } } } } return [min, max]; } d3-array-3.1.1/src/filter.js000066400000000000000000000004431412622006300155450ustar00rootroot00000000000000export default function filter(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); const array = []; let index = -1; for (const value of values) { if (test(value, ++index, values)) { array.push(value); } } return array; } d3-array-3.1.1/src/fsum.js000066400000000000000000000031001412622006300152230ustar00rootroot00000000000000// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423 export class Adder { constructor() { this._partials = new Float64Array(32); this._n = 0; } add(x) { const p = this._partials; let i = 0; for (let j = 0; j < this._n && j < 32; j++) { const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); if (lo) p[i++] = lo; x = hi; } p[i] = x; this._n = i + 1; return this; } valueOf() { const p = this._partials; let n = this._n, x, y, lo, hi = 0; if (n > 0) { hi = p[--n]; while (n > 0) { x = hi; y = p[--n]; hi = x + y; lo = y - (hi - x); if (lo) break; } if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) { y = lo * 2; x = hi + y; if (y == x - hi) hi = x; } } return hi; } } export function fsum(values, valueof) { const adder = new Adder(); if (valueof === undefined) { for (let value of values) { if (value = +value) { adder.add(value); } } } else { let index = -1; for (let value of values) { if (value = +valueof(value, ++index, values)) { adder.add(value); } } } return +adder; } export function fcumsum(values, valueof) { const adder = new Adder(); let index = -1; return Float64Array.from(values, valueof === undefined ? v => adder.add(+v || 0) : v => adder.add(+valueof(v, ++index, values) || 0) ); } d3-array-3.1.1/src/greatest.js000066400000000000000000000012431412622006300160750ustar00rootroot00000000000000import ascending from "./ascending.js"; export default function greatest(values, compare = ascending) { let max; let defined = false; if (compare.length === 1) { let maxValue; for (const element of values) { const value = compare(element); if (defined ? ascending(value, maxValue) > 0 : ascending(value, value) === 0) { max = element; maxValue = value; defined = true; } } } else { for (const value of values) { if (defined ? compare(value, max) > 0 : compare(value, value) === 0) { max = value; defined = true; } } } return max; } d3-array-3.1.1/src/greatestIndex.js000066400000000000000000000007261412622006300170720ustar00rootroot00000000000000import ascending from "./ascending.js"; import maxIndex from "./maxIndex.js"; export default function greatestIndex(values, compare = ascending) { if (compare.length === 1) return maxIndex(values, compare); let maxValue; let max = -1; let index = -1; for (const value of values) { ++index; if (max < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { maxValue = value; max = index; } } return max; } d3-array-3.1.1/src/group.js000066400000000000000000000032751412622006300154220ustar00rootroot00000000000000import {InternMap} from "internmap"; import identity from "./identity.js"; export default function group(values, ...keys) { return nest(values, identity, identity, keys); } export function groups(values, ...keys) { return nest(values, Array.from, identity, keys); } function flatten(groups, keys) { for (let i = 1, n = keys.length; i < n; ++i) { groups = groups.flatMap(g => g.pop().map(([key, value]) => [...g, key, value])); } return groups; } export function flatGroup(values, ...keys) { return flatten(groups(values, ...keys), keys); } export function flatRollup(values, reduce, ...keys) { return flatten(rollups(values, reduce, ...keys), keys); } export function rollup(values, reduce, ...keys) { return nest(values, identity, reduce, keys); } export function rollups(values, reduce, ...keys) { return nest(values, Array.from, reduce, keys); } export function index(values, ...keys) { return nest(values, identity, unique, keys); } export function indexes(values, ...keys) { return nest(values, Array.from, unique, keys); } function unique(values) { if (values.length !== 1) throw new Error("duplicate key"); return values[0]; } function nest(values, map, reduce, keys) { return (function regroup(values, i) { if (i >= keys.length) return reduce(values); const groups = new InternMap(); const keyof = keys[i++]; let index = -1; for (const value of values) { const key = keyof(value, ++index, values); const group = groups.get(key); if (group) group.push(value); else groups.set(key, [value]); } for (const [key, values] of groups) { groups.set(key, regroup(values, i)); } return map(groups); })(values, 0); } d3-array-3.1.1/src/groupSort.js000066400000000000000000000006551412622006300162710ustar00rootroot00000000000000import ascending from "./ascending.js"; import group, {rollup} from "./group.js"; import sort from "./sort.js"; export default function groupSort(values, reduce, key) { return (reduce.length !== 2 ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk))) : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk)))) .map(([key]) => key); } d3-array-3.1.1/src/identity.js000066400000000000000000000000641412622006300161100ustar00rootroot00000000000000export default function identity(x) { return x; } d3-array-3.1.1/src/index.js000066400000000000000000000056441412622006300153770ustar00rootroot00000000000000export {default as bisect, bisectRight, bisectLeft, bisectCenter} from "./bisect.js"; export {default as ascending} from "./ascending.js"; export {default as bisector} from "./bisector.js"; export {default as count} from "./count.js"; export {default as cross} from "./cross.js"; export {default as cumsum} from "./cumsum.js"; export {default as descending} from "./descending.js"; export {default as deviation} from "./deviation.js"; export {default as extent} from "./extent.js"; export {Adder, fsum, fcumsum} from "./fsum.js"; export {default as group, flatGroup, flatRollup, groups, index, indexes, rollup, rollups} from "./group.js"; export {default as groupSort} from "./groupSort.js"; export {default as bin, default as histogram} from "./bin.js"; // Deprecated; use bin. export {default as thresholdFreedmanDiaconis} from "./threshold/freedmanDiaconis.js"; export {default as thresholdScott} from "./threshold/scott.js"; export {default as thresholdSturges} from "./threshold/sturges.js"; export {default as max} from "./max.js"; export {default as maxIndex} from "./maxIndex.js"; export {default as mean} from "./mean.js"; export {default as median} from "./median.js"; export {default as merge} from "./merge.js"; export {default as min} from "./min.js"; export {default as minIndex} from "./minIndex.js"; export {default as mode} from "./mode.js"; export {default as nice} from "./nice.js"; export {default as pairs} from "./pairs.js"; export {default as permute} from "./permute.js"; export {default as quantile, quantileSorted} from "./quantile.js"; export {default as quickselect} from "./quickselect.js"; export {default as range} from "./range.js"; export {default as rank} from "./rank.js"; export {default as least} from "./least.js"; export {default as leastIndex} from "./leastIndex.js"; export {default as greatest} from "./greatest.js"; export {default as greatestIndex} from "./greatestIndex.js"; export {default as scan} from "./scan.js"; // Deprecated; use leastIndex. export {default as shuffle, shuffler} from "./shuffle.js"; export {default as sum} from "./sum.js"; export {default as ticks, tickIncrement, tickStep} from "./ticks.js"; export {default as transpose} from "./transpose.js"; export {default as variance} from "./variance.js"; export {default as zip} from "./zip.js"; export {default as every} from "./every.js"; export {default as some} from "./some.js"; export {default as filter} from "./filter.js"; export {default as map} from "./map.js"; export {default as reduce} from "./reduce.js"; export {default as reverse} from "./reverse.js"; export {default as sort} from "./sort.js"; export {default as difference} from "./difference.js"; export {default as disjoint} from "./disjoint.js"; export {default as intersection} from "./intersection.js"; export {default as subset} from "./subset.js"; export {default as superset} from "./superset.js"; export {default as union} from "./union.js"; export {InternMap, InternSet} from "internmap"; d3-array-3.1.1/src/intersection.js000066400000000000000000000006761412622006300167760ustar00rootroot00000000000000import {InternSet} from "internmap"; export default function intersection(values, ...others) { values = new InternSet(values); others = others.map(set); out: for (const value of values) { for (const other of others) { if (!other.has(value)) { values.delete(value); continue out; } } } return values; } function set(values) { return values instanceof InternSet ? values : new InternSet(values); } d3-array-3.1.1/src/least.js000066400000000000000000000012401412622006300153640ustar00rootroot00000000000000import ascending from "./ascending.js"; export default function least(values, compare = ascending) { let min; let defined = false; if (compare.length === 1) { let minValue; for (const element of values) { const value = compare(element); if (defined ? ascending(value, minValue) < 0 : ascending(value, value) === 0) { min = element; minValue = value; defined = true; } } } else { for (const value of values) { if (defined ? compare(value, min) < 0 : compare(value, value) === 0) { min = value; defined = true; } } } return min; } d3-array-3.1.1/src/leastIndex.js000066400000000000000000000007231412622006300163610ustar00rootroot00000000000000import ascending from "./ascending.js"; import minIndex from "./minIndex.js"; export default function leastIndex(values, compare = ascending) { if (compare.length === 1) return minIndex(values, compare); let minValue; let min = -1; let index = -1; for (const value of values) { ++index; if (min < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { minValue = value; min = index; } } return min; } d3-array-3.1.1/src/map.js000066400000000000000000000004661412622006300150420ustar00rootroot00000000000000export default function map(values, mapper) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); if (typeof mapper !== "function") throw new TypeError("mapper is not a function"); return Array.from(values, (value, index) => mapper(value, index, values)); } d3-array-3.1.1/src/max.js000066400000000000000000000007661412622006300150550ustar00rootroot00000000000000export default function max(values, valueof) { let max; if (valueof === undefined) { for (const value of values) { if (value != null && (max < value || (max === undefined && value >= value))) { max = value; } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (max < value || (max === undefined && value >= value))) { max = value; } } } return max; } d3-array-3.1.1/src/maxIndex.js000066400000000000000000000011061412622006300160320ustar00rootroot00000000000000export default function maxIndex(values, valueof) { let max; let maxIndex = -1; let index = -1; if (valueof === undefined) { for (const value of values) { ++index; if (value != null && (max < value || (max === undefined && value >= value))) { max = value, maxIndex = index; } } } else { for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (max < value || (max === undefined && value >= value))) { max = value, maxIndex = index; } } } return maxIndex; } d3-array-3.1.1/src/mean.js000066400000000000000000000007431412622006300152030ustar00rootroot00000000000000export default function mean(values, valueof) { let count = 0; let sum = 0; if (valueof === undefined) { for (let value of values) { if (value != null && (value = +value) >= value) { ++count, sum += value; } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { ++count, sum += value; } } } if (count) return sum / count; } d3-array-3.1.1/src/median.js000066400000000000000000000002041412622006300155100ustar00rootroot00000000000000import quantile from "./quantile.js"; export default function median(values, valueof) { return quantile(values, 0.5, valueof); } d3-array-3.1.1/src/merge.js000066400000000000000000000002451412622006300153570ustar00rootroot00000000000000function* flatten(arrays) { for (const array of arrays) { yield* array; } } export default function merge(arrays) { return Array.from(flatten(arrays)); } d3-array-3.1.1/src/min.js000066400000000000000000000007661412622006300150530ustar00rootroot00000000000000export default function min(values, valueof) { let min; if (valueof === undefined) { for (const value of values) { if (value != null && (min > value || (min === undefined && value >= value))) { min = value; } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (min > value || (min === undefined && value >= value))) { min = value; } } } return min; } d3-array-3.1.1/src/minIndex.js000066400000000000000000000011061412622006300160300ustar00rootroot00000000000000export default function minIndex(values, valueof) { let min; let minIndex = -1; let index = -1; if (valueof === undefined) { for (const value of values) { ++index; if (value != null && (min > value || (min === undefined && value >= value))) { min = value, minIndex = index; } } } else { for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (min > value || (min === undefined && value >= value))) { min = value, minIndex = index; } } } return minIndex; } d3-array-3.1.1/src/mode.js000066400000000000000000000013041412622006300152010ustar00rootroot00000000000000import {InternMap} from "internmap"; export default function mode(values, valueof) { const counts = new InternMap(); if (valueof === undefined) { for (let value of values) { if (value != null && value >= value) { counts.set(value, (counts.get(value) || 0) + 1); } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null && value >= value) { counts.set(value, (counts.get(value) || 0) + 1); } } } let modeValue; let modeCount = 0; for (const [value, count] of counts) { if (count > modeCount) { modeCount = count; modeValue = value; } } return modeValue; } d3-array-3.1.1/src/nice.js000066400000000000000000000010271412622006300151750ustar00rootroot00000000000000import {tickIncrement} from "./ticks.js"; export default function nice(start, stop, count) { let prestep; while (true) { const step = tickIncrement(start, stop, count); if (step === prestep || step === 0 || !isFinite(step)) { return [start, stop]; } else if (step > 0) { start = Math.floor(start / step) * step; stop = Math.ceil(stop / step) * step; } else if (step < 0) { start = Math.ceil(start * step) / step; stop = Math.floor(stop * step) / step; } prestep = step; } } d3-array-3.1.1/src/number.js000066400000000000000000000007211412622006300155470ustar00rootroot00000000000000export default function number(x) { return x === null ? NaN : +x; } export function* numbers(values, valueof) { if (valueof === undefined) { for (let value of values) { if (value != null && (value = +value) >= value) { yield value; } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { yield value; } } } } d3-array-3.1.1/src/pairs.js000066400000000000000000000004631412622006300154000ustar00rootroot00000000000000export default function pairs(values, pairof = pair) { const pairs = []; let previous; let first = false; for (const value of values) { if (first) pairs.push(pairof(previous, value)); previous = value; first = true; } return pairs; } export function pair(a, b) { return [a, b]; } d3-array-3.1.1/src/permute.js000066400000000000000000000001411412622006300157340ustar00rootroot00000000000000export default function permute(source, keys) { return Array.from(keys, key => source[key]); } d3-array-3.1.1/src/quantile.js000066400000000000000000000020161412622006300161000ustar00rootroot00000000000000import max from "./max.js"; import min from "./min.js"; import quickselect from "./quickselect.js"; import number, {numbers} from "./number.js"; export default function quantile(values, p, valueof) { values = Float64Array.from(numbers(values, valueof)); if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return min(values); if (p >= 1) return max(values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1)); return value0 + (value1 - value0) * (i - i0); } export function quantileSorted(values, p, valueof = number) { if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); if (p >= 1) return +valueof(values[n - 1], n - 1, values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); return value0 + (value1 - value0) * (i - i0); } d3-array-3.1.1/src/quickselect.js000066400000000000000000000025701412622006300165770ustar00rootroot00000000000000import {ascendingDefined, compareDefined} from "./sort.js"; // Based on https://github.com/mourner/quickselect // ISC license, Copyright 2018 Vladimir Agafonkin. export default function quickselect(array, k, left = 0, right = array.length - 1, compare) { compare = compare === undefined ? ascendingDefined : compareDefined(compare); while (right > left) { if (right - left > 600) { const n = right - left + 1; const m = k - left + 1; const z = Math.log(n); const s = 0.5 * Math.exp(2 * z / 3); const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); quickselect(array, k, newLeft, newRight, compare); } const t = array[k]; let i = left; let j = right; swap(array, left, k); if (compare(array[right], t) > 0) swap(array, left, right); while (i < j) { swap(array, i, j), ++i, --j; while (compare(array[i], t) < 0) ++i; while (compare(array[j], t) > 0) --j; } if (compare(array[left], t) === 0) swap(array, left, j); else ++j, swap(array, j, right); if (j <= k) left = j + 1; if (k <= j) right = j - 1; } return array; } function swap(array, i, j) { const t = array[i]; array[i] = array[j]; array[j] = t; } d3-array-3.1.1/src/range.js000066400000000000000000000005361412622006300153570ustar00rootroot00000000000000export default function range(start, stop, step) { start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); while (++i < n) { range[i] = start + i * step; } return range; } d3-array-3.1.1/src/rank.js000066400000000000000000000015211412622006300152110ustar00rootroot00000000000000import ascending from "./ascending.js"; import {ascendingDefined, compareDefined} from "./sort.js"; export default function rank(values, valueof = ascending) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); let V = Array.from(values); const R = new Float64Array(V.length); if (valueof.length !== 2) V = V.map(valueof), valueof = ascending; const compareIndex = (i, j) => valueof(V[i], V[j]); let k, r; Uint32Array .from(V, (_, i) => i) .sort(valueof === ascending ? (i, j) => ascendingDefined(V[i], V[j]) : compareDefined(compareIndex)) .forEach((j, i) => { const c = compareIndex(j, k === undefined ? j : k); if (c >= 0) { if (k === undefined || c > 0) k = j, r = i; R[j] = r; } else { R[j] = NaN; } }); return R; } d3-array-3.1.1/src/reduce.js000066400000000000000000000007141412622006300155300ustar00rootroot00000000000000export default function reduce(values, reducer, value) { if (typeof reducer !== "function") throw new TypeError("reducer is not a function"); const iterator = values[Symbol.iterator](); let done, next, index = -1; if (arguments.length < 3) { ({done, value} = iterator.next()); if (done) return; ++index; } while (({done, value: next} = iterator.next()), !done) { value = reducer(value, next, ++index, values); } return value; } d3-array-3.1.1/src/reverse.js000066400000000000000000000002671412622006300157370ustar00rootroot00000000000000export default function reverse(values) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); return Array.from(values).reverse(); } d3-array-3.1.1/src/scan.js000066400000000000000000000002621412622006300152030ustar00rootroot00000000000000import leastIndex from "./leastIndex.js"; export default function scan(values, compare) { const index = leastIndex(values, compare); return index < 0 ? undefined : index; } d3-array-3.1.1/src/shuffle.js000066400000000000000000000005111412622006300157100ustar00rootroot00000000000000export default shuffler(Math.random); export function shuffler(random) { return function shuffle(array, i0 = 0, i1 = array.length) { let m = i1 - (i0 = +i0); while (m) { const i = random() * m-- | 0, t = array[m + i0]; array[m + i0] = array[i + i0]; array[i + i0] = t; } return array; }; } d3-array-3.1.1/src/some.js000066400000000000000000000004071412622006300152230ustar00rootroot00000000000000export default function some(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); let index = -1; for (const value of values) { if (test(value, ++index, values)) { return true; } } return false; } d3-array-3.1.1/src/sort.js000066400000000000000000000023451412622006300152520ustar00rootroot00000000000000import ascending from "./ascending.js"; import permute from "./permute.js"; export default function sort(values, ...F) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); values = Array.from(values); let [f] = F; if ((f && f.length !== 2) || F.length > 1) { const index = Uint32Array.from(values, (d, i) => i); if (F.length > 1) { F = F.map(f => values.map(f)); index.sort((i, j) => { for (const f of F) { const c = ascendingDefined(f[i], f[j]); if (c) return c; } }); } else { f = values.map(f); index.sort((i, j) => ascendingDefined(f[i], f[j])); } return permute(values, index); } return values.sort(compareDefined(f)); } export function compareDefined(compare = ascending) { if (compare === ascending) return ascendingDefined; if (typeof compare !== "function") throw new TypeError("compare is not a function"); return (a, b) => { const x = compare(a, b); if (x || x === 0) return x; return (compare(b, b) === 0) - (compare(a, a) === 0); }; } export function ascendingDefined(a, b) { return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0); } d3-array-3.1.1/src/subset.js000066400000000000000000000001731412622006300155650ustar00rootroot00000000000000import superset from "./superset.js"; export default function subset(values, other) { return superset(other, values); } d3-array-3.1.1/src/sum.js000066400000000000000000000005521412622006300150650ustar00rootroot00000000000000export default function sum(values, valueof) { let sum = 0; if (valueof === undefined) { for (let value of values) { if (value = +value) { sum += value; } } } else { let index = -1; for (let value of values) { if (value = +valueof(value, ++index, values)) { sum += value; } } } return sum; } d3-array-3.1.1/src/superset.js000066400000000000000000000010221412622006300161240ustar00rootroot00000000000000export default function superset(values, other) { const iterator = values[Symbol.iterator](), set = new Set(); for (const o of other) { const io = intern(o); if (set.has(io)) continue; let value, done; while (({value, done} = iterator.next())) { if (done) return false; const ivalue = intern(value); set.add(ivalue); if (Object.is(io, ivalue)) break; } } return true; } function intern(value) { return value !== null && typeof value === "object" ? value.valueOf() : value; } d3-array-3.1.1/src/threshold/000077500000000000000000000000001412622006300157155ustar00rootroot00000000000000d3-array-3.1.1/src/threshold/freedmanDiaconis.js000066400000000000000000000004161412622006300215070ustar00rootroot00000000000000import count from "../count.js"; import quantile from "../quantile.js"; export default function thresholdFreedmanDiaconis(values, min, max) { return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(count(values), -1 / 3))); } d3-array-3.1.1/src/threshold/scott.js000066400000000000000000000003471412622006300174130ustar00rootroot00000000000000import count from "../count.js"; import deviation from "../deviation.js"; export default function thresholdScott(values, min, max) { return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(count(values), -1 / 3))); } d3-array-3.1.1/src/threshold/sturges.js000066400000000000000000000002231412622006300177440ustar00rootroot00000000000000import count from "../count.js"; export default function thresholdSturges(values) { return Math.ceil(Math.log(count(values)) / Math.LN2) + 1; } d3-array-3.1.1/src/ticks.js000066400000000000000000000033171412622006300154000ustar00rootroot00000000000000var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); export default function ticks(start, stop, count) { var reverse, i = -1, n, ticks, step; stop = +stop, start = +start, count = +count; if (start === stop && count > 0) return [start]; if (reverse = stop < start) n = start, start = stop, stop = n; if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; if (step > 0) { let r0 = Math.round(start / step), r1 = Math.round(stop / step); if (r0 * step < start) ++r0; if (r1 * step > stop) --r1; ticks = new Array(n = r1 - r0 + 1); while (++i < n) ticks[i] = (r0 + i) * step; } else { step = -step; let r0 = Math.round(start * step), r1 = Math.round(stop * step); if (r0 / step < start) ++r0; if (r1 / step > stop) --r1; ticks = new Array(n = r1 - r0 + 1); while (++i < n) ticks[i] = (r0 + i) / step; } if (reverse) ticks.reverse(); return ticks; } export function tickIncrement(start, stop, count) { var step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power); return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); } export function tickStep(start, stop, count) { var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; if (error >= e10) step1 *= 10; else if (error >= e5) step1 *= 5; else if (error >= e2) step1 *= 2; return stop < start ? -step1 : step1; } d3-array-3.1.1/src/transpose.js000066400000000000000000000005611412622006300162770ustar00rootroot00000000000000import min from "./min.js"; export default function transpose(matrix) { if (!(n = matrix.length)) return []; for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) { for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) { row[j] = matrix[j][i]; } } return transpose; } function length(d) { return d.length; } d3-array-3.1.1/src/union.js000066400000000000000000000003311412622006300154040ustar00rootroot00000000000000import {InternSet} from "internmap"; export default function union(...others) { const set = new InternSet(); for (const other of others) { for (const o of other) { set.add(o); } } return set; } d3-array-3.1.1/src/variance.js000066400000000000000000000012341412622006300160470ustar00rootroot00000000000000export default function variance(values, valueof) { let count = 0; let delta; let mean = 0; let sum = 0; if (valueof === undefined) { for (let value of values) { if (value != null && (value = +value) >= value) { delta = value - mean; mean += delta / ++count; sum += delta * (value - mean); } } } else { let index = -1; for (let value of values) { if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { delta = value - mean; mean += delta / ++count; sum += delta * (value - mean); } } } if (count > 1) return sum / (count - 1); } d3-array-3.1.1/src/zip.js000066400000000000000000000001521412622006300150570ustar00rootroot00000000000000import transpose from "./transpose.js"; export default function zip() { return transpose(arguments); } d3-array-3.1.1/test/000077500000000000000000000000001412622006300141115ustar00rootroot00000000000000d3-array-3.1.1/test/.eslintrc.json000066400000000000000000000003201412622006300167000ustar00rootroot00000000000000{ "extends": "eslint:recommended", "parserOptions": { "sourceType": "module", "ecmaVersion": 8 }, "env": { "es6": true, "mocha": true }, "rules": { "no-sparse-arrays": 0 } } d3-array-3.1.1/test/OneTimeNumber.js000066400000000000000000000002501412622006300171550ustar00rootroot00000000000000export function OneTimeNumber(value) { this.value = value; } OneTimeNumber.prototype.valueOf = function() { var v = this.value; this.value = NaN; return v; }; d3-array-3.1.1/test/ascending-test.js000066400000000000000000000016161412622006300173630ustar00rootroot00000000000000import assert from "assert"; import {ascending} from "../src/index.js"; it("ascending(a, b) returns a negative number if a < b", () => { assert(ascending(0, 1) < 0); assert(ascending("a", "b") < 0); }); it("ascending(a, b) returns a positive number if a > b", () => { assert(ascending(1, 0) > 0); assert(ascending("b", "a") > 0); }); it("ascending(a, b) returns zero if a >= b and a <= b", () => { assert.strictEqual(ascending(0, 0), 0); assert.strictEqual(ascending("a", "a"), 0); assert.strictEqual(ascending("0", 0), 0); assert.strictEqual(ascending(0, "0"), 0); }); it("ascending(a, b) returns NaN if a and b are not comparable", () => { assert(isNaN(ascending(0, undefined))); assert(isNaN(ascending(undefined, 0))); assert(isNaN(ascending(undefined, undefined))); assert(isNaN(ascending(0, NaN))); assert(isNaN(ascending(NaN, 0))); assert(isNaN(ascending(NaN, NaN))); }); d3-array-3.1.1/test/asserts.js000066400000000000000000000005111412622006300161300ustar00rootroot00000000000000import assert from "assert"; import {InternSet} from "internmap"; export function assertSetEqual(actual, expected) { assert(actual instanceof Set); expected = new InternSet(expected); for (const a of actual) assert(expected.has(a), `unexpected ${a}`); for (const e of expected) assert(actual.has(e), `expected ${e}`); } d3-array-3.1.1/test/bin-test.js000066400000000000000000000114761412622006300162050ustar00rootroot00000000000000import assert from "assert"; import {bin, extent, histogram, thresholdSturges} from "../src/index.js"; it("histogram is a deprecated alias for bin", () => { assert.strictEqual(histogram, bin); }); it("bin() returns a default bin generator", () => { const h = bin(); assert.strictEqual(h.value()(42), 42); assert.strictEqual(h.domain(), extent); assert.deepStrictEqual(h.thresholds(), thresholdSturges); }); it("bin(data) computes bins of the specified array of data", () => { const h = bin(); assert.deepStrictEqual(h([0, 0, 0, 10, 20, 20]), [ box([0, 0, 0], 0, 5), box([], 5, 10), box([10], 10, 15), box([], 15, 20), box([20, 20], 20, 25) ]); }); it("bin(iterable) is equivalent to bin(array)", () => { const h = bin(); assert.deepStrictEqual(h(iterable([0, 0, 0, 10, 20, 20])), [ box([0, 0, 0], 0, 5), box([], 5, 10), box([10], 10, 15), box([], 15, 20), box([20, 20], 20, 25) ]); }); it("bin.value(number) sets the constant value", () => { const h = bin().value(12); // Pointless, but for consistency. assert.deepStrictEqual(h([0, 0, 0, 1, 2, 2]), [ box([0, 0, 0, 1, 2, 2], 12, 12), ]); }); it("bin(data) does not bin null, undefined, or NaN", () => { const h = bin(); assert.deepStrictEqual(h([0, null, undefined, NaN, 10, 20, 20]), [ box([0], 0, 5), box([], 5, 10), box([10], 10, 15), box([], 15, 20), box([20, 20], 20, 25) ]); }); it("bin.value(function) sets the value accessor", () => { const h = bin().value((d) => d.value); const a = {value: 0}; const b = {value: 10}; const c = {value: 20}; assert.deepStrictEqual(h([a, a, a, b, c, c]), [ box([a, a, a], 0, 5), box([], 5, 10), box([b], 10, 15), box([], 15, 20), box([c, c], 20, 25) ]); }); it("bin.domain(array) sets the domain", () => { const h = bin().domain([0, 20]); assert.deepStrictEqual(h.domain()(), [0, 20]); assert.deepStrictEqual(h([1, 2, 2, 10, 18, 18]), [ box([1, 2, 2], 0, 5), box([], 5, 10), box([10], 10, 15), box([18, 18], 15, 20) ]); }); it("bin.domain(function) sets the domain accessor", () => { let actual; const values = [1, 2, 2, 10, 18, 18]; const domain = (values) => { actual = values; return [0, 20]; }; const h = bin().domain(domain); assert.strictEqual(h.domain(), domain); assert.deepStrictEqual(h(values), [ box([1, 2, 2], 0, 5), box([], 5, 10), box([10], 10, 15), box([18, 18], 15, 20) ]); assert.deepStrictEqual(actual, values); }); it("bin.thresholds(number) sets the approximate number of bin thresholds", () => { const h = bin().thresholds(3); assert.deepStrictEqual(h([0, 0, 0, 10, 30, 30]), [ box([0, 0, 0], 0, 10), box([10], 10, 20), box([], 20, 30), box([30, 30], 30, 40) ]); }); it("bin.thresholds(array) sets the bin thresholds", () => { const h = bin().thresholds([10, 20]); assert.deepStrictEqual(h([0, 0, 0, 10, 30, 30]), [ box([0, 0, 0], 0, 10), box([10], 10, 20), box([30, 30], 20, 30) ]); }); it("bin.thresholds(array) ignores thresholds outside the domain", () => { const h = bin().thresholds([0, 1, 2, 3, 4]); assert.deepStrictEqual(h([0, 1, 2, 3]), [ box([0], 0, 1), box([1], 1, 2), box([2], 2, 3), box([3], 3, 3) ]); }); it("bin.thresholds(function) sets the bin thresholds accessor", () => { let actual; const values = [0, 0, 0, 10, 30, 30]; const h = bin().thresholds((values, x0, x1) => { actual = [values, x0, x1]; return [10, 20]; }); assert.deepStrictEqual(h(values), [ box([0, 0, 0], 0, 10), box([10], 10, 20), box([30, 30], 20, 30) ]); assert.deepStrictEqual(actual, [values, 0, 30]); assert.deepStrictEqual(h.thresholds(() => 5)(values), [ box([0, 0, 0], 0, 5), box([], 5, 10), box([10], 10, 15), box([], 15, 20), box([], 20, 25), box([], 25, 30), box([30, 30], 30, 35) ]); }); it("bin(data) uses nice thresholds", () => { const h = bin().domain([0, 1]).thresholds(5); assert.deepStrictEqual(h([]).map(b => [b.x0, b.x1]), [ [0.0, 0.2], [0.2, 0.4], [0.4, 0.6], [0.6, 0.8], [0.8, 1.0] ]); }); it("bin()() returns bins whose rightmost bin is not too wide", () => { const h = bin(); assert.deepStrictEqual(h([9.8, 10, 11, 12, 13, 13.2]), [ box([9.8], 9, 10), box([10], 10, 11), box([11], 11, 12), box([12], 12, 13), box([13, 13.2], 13, 14) ]); }); it("bin(data) coerces values to numbers as expected", () => { const h = bin().thresholds(10); assert.deepStrictEqual(h(["1", "2", "3", "4", "5"]), [ box(["1"], 1, 1.5), box([], 1.5, 2), box(["2"], 2, 2.5), box([], 2.5, 3), box(["3"], 3, 3.5), box([], 3.5, 4), box(["4"], 4, 4.5), box([], 4.5, 5), box(["5"], 5, 5.5) ]); }); function box(bin, x0, x1) { bin.x0 = x0; bin.x1 = x1; return bin; } function* iterable(array) { yield* array; } d3-array-3.1.1/test/bisect-test.js000066400000000000000000000144531412622006300167040ustar00rootroot00000000000000import assert from "assert"; import {bisect, bisectLeft, bisectRight} from "../src/index.js"; it("bisect is an alias for bisectRight", () => { assert.strictEqual(bisect, bisectRight); }); it("bisectLeft(array, value) returns the index of an exact match", () => { const numbers = [1, 2, 3]; assert.strictEqual(bisectLeft(numbers, 1), 0); assert.strictEqual(bisectLeft(numbers, 2), 1); assert.strictEqual(bisectLeft(numbers, 3), 2); }); it("bisectLeft(array, value) returns the index of the first match", () => { const numbers = [1, 2, 2, 3]; assert.strictEqual(bisectLeft(numbers, 1), 0); assert.strictEqual(bisectLeft(numbers, 2), 1); assert.strictEqual(bisectLeft(numbers, 3), 3); }); it("bisectLeft(empty, value) returns zero", () => { assert.strictEqual(bisectLeft([], 1), 0); }); it("bisectLeft(array, value) returns the insertion point of a non-exact match", () => { const numbers = [1, 2, 3]; assert.strictEqual(bisectLeft(numbers, 0.5), 0); assert.strictEqual(bisectLeft(numbers, 1.5), 1); assert.strictEqual(bisectLeft(numbers, 2.5), 2); assert.strictEqual(bisectLeft(numbers, 3.5), 3); }); it("bisectLeft(array, value) has undefined behavior if the search value is unorderable", () => { const numbers = [1, 2, 3]; bisectLeft(numbers, new Date(NaN)); // who knows what this will return! bisectLeft(numbers, undefined); bisectLeft(numbers, NaN); }); it("bisectLeft(array, value, lo) observes the specified lower bound", () => { const numbers = [1, 2, 3, 4, 5]; assert.strictEqual(bisectLeft(numbers, 0, 2), 2); assert.strictEqual(bisectLeft(numbers, 1, 2), 2); assert.strictEqual(bisectLeft(numbers, 2, 2), 2); assert.strictEqual(bisectLeft(numbers, 3, 2), 2); assert.strictEqual(bisectLeft(numbers, 4, 2), 3); assert.strictEqual(bisectLeft(numbers, 5, 2), 4); assert.strictEqual(bisectLeft(numbers, 6, 2), 5); }); it("bisectLeft(array, value, lo, hi) observes the specified bounds", () => { const numbers = [1, 2, 3, 4, 5]; assert.strictEqual(bisectLeft(numbers, 0, 2, 3), 2); assert.strictEqual(bisectLeft(numbers, 1, 2, 3), 2); assert.strictEqual(bisectLeft(numbers, 2, 2, 3), 2); assert.strictEqual(bisectLeft(numbers, 3, 2, 3), 2); assert.strictEqual(bisectLeft(numbers, 4, 2, 3), 3); assert.strictEqual(bisectLeft(numbers, 5, 2, 3), 3); assert.strictEqual(bisectLeft(numbers, 6, 2, 3), 3); }); it("bisectLeft(array, value) handles large sparse d3", () => { const numbers = []; let i = 1 << 30; numbers[i++] = 1; numbers[i++] = 2; numbers[i++] = 3; numbers[i++] = 4; numbers[i++] = 5; assert.strictEqual(bisectLeft(numbers, 0, i - 5, i), i - 5); assert.strictEqual(bisectLeft(numbers, 1, i - 5, i), i - 5); assert.strictEqual(bisectLeft(numbers, 2, i - 5, i), i - 4); assert.strictEqual(bisectLeft(numbers, 3, i - 5, i), i - 3); assert.strictEqual(bisectLeft(numbers, 4, i - 5, i), i - 2); assert.strictEqual(bisectLeft(numbers, 5, i - 5, i), i - 1); assert.strictEqual(bisectLeft(numbers, 6, i - 5, i), i - 0); }); it("bisectRight(array, value) returns the index after an exact match", () => { const numbers = [1, 2, 3]; assert.strictEqual(bisectRight(numbers, 1), 1); assert.strictEqual(bisectRight(numbers, 2), 2); assert.strictEqual(bisectRight(numbers, 3), 3); }); it("bisectRight(array, value) returns the index after the last match", () => { const numbers = [1, 2, 2, 3]; assert.strictEqual(bisectRight(numbers, 1), 1); assert.strictEqual(bisectRight(numbers, 2), 3); assert.strictEqual(bisectRight(numbers, 3), 4); }); it("bisectRight(empty, value) returns zero", () => { assert.strictEqual(bisectRight([], 1), 0); }); it("bisectRight(array, value) returns the insertion point of a non-exact match", () => { const numbers = [1, 2, 3]; assert.strictEqual(bisectRight(numbers, 0.5), 0); assert.strictEqual(bisectRight(numbers, 1.5), 1); assert.strictEqual(bisectRight(numbers, 2.5), 2); assert.strictEqual(bisectRight(numbers, 3.5), 3); }); it("bisectRight(array, value, lo) observes the specified lower bound", () => { const numbers = [1, 2, 3, 4, 5]; assert.strictEqual(bisectRight(numbers, 0, 2), 2); assert.strictEqual(bisectRight(numbers, 1, 2), 2); assert.strictEqual(bisectRight(numbers, 2, 2), 2); assert.strictEqual(bisectRight(numbers, 3, 2), 3); assert.strictEqual(bisectRight(numbers, 4, 2), 4); assert.strictEqual(bisectRight(numbers, 5, 2), 5); assert.strictEqual(bisectRight(numbers, 6, 2), 5); }); it("bisectRight(array, value, lo, hi) observes the specified bounds", () => { const numbers = [1, 2, 3, 4, 5]; assert.strictEqual(bisectRight(numbers, 0, 2, 3), 2); assert.strictEqual(bisectRight(numbers, 1, 2, 3), 2); assert.strictEqual(bisectRight(numbers, 2, 2, 3), 2); assert.strictEqual(bisectRight(numbers, 3, 2, 3), 3); assert.strictEqual(bisectRight(numbers, 4, 2, 3), 3); assert.strictEqual(bisectRight(numbers, 5, 2, 3), 3); assert.strictEqual(bisectRight(numbers, 6, 2, 3), 3); }); it("bisectRight(array, value) handles large sparse d3", () => { const numbers = []; let i = 1 << 30; numbers[i++] = 1; numbers[i++] = 2; numbers[i++] = 3; numbers[i++] = 4; numbers[i++] = 5; assert.strictEqual(bisectRight(numbers, 0, i - 5, i), i - 5); assert.strictEqual(bisectRight(numbers, 1, i - 5, i), i - 4); assert.strictEqual(bisectRight(numbers, 2, i - 5, i), i - 3); assert.strictEqual(bisectRight(numbers, 3, i - 5, i), i - 2); assert.strictEqual(bisectRight(numbers, 4, i - 5, i), i - 1); assert.strictEqual(bisectRight(numbers, 5, i - 5, i), i - 0); assert.strictEqual(bisectRight(numbers, 6, i - 5, i), i - 0); }); it("bisectLeft(array, value, lo, hi) keeps non-comparable values to the right", () => { const values = [1, 2, null, undefined, NaN]; assert.strictEqual(bisectLeft(values, 1), 0); assert.strictEqual(bisectLeft(values, 2), 1); assert.strictEqual(bisectLeft(values, null), 5); assert.strictEqual(bisectLeft(values, undefined), 5); assert.strictEqual(bisectLeft(values, NaN), 5); }); it("bisectRight(array, value, lo, hi) keeps non-comparable values to the right", () => { const values = [1, 2, null, undefined]; assert.strictEqual(bisectRight(values, 1), 1); assert.strictEqual(bisectRight(values, 2), 2); assert.strictEqual(bisectRight(values, null), 4); assert.strictEqual(bisectRight(values, undefined), 4); assert.strictEqual(bisectRight(values, NaN), 4); }); d3-array-3.1.1/test/bisector-test.js000066400000000000000000000345261412622006300172500ustar00rootroot00000000000000import assert from "assert"; import {ascending, bisector} from "../src/index.js"; it("bisector(comparator).left(array, value) returns the index of an exact match", () => { const boxes = [1, 2, 3].map(box); const bisectLeft = bisector(ascendingBox).left; assert.strictEqual(bisectLeft(boxes, box(1)), 0); assert.strictEqual(bisectLeft(boxes, box(2)), 1); assert.strictEqual(bisectLeft(boxes, box(3)), 2); }); it("bisector(comparator).left(array, value) returns the index of the first match", () => { const boxes = [1, 2, 2, 3].map(box); const bisectLeft = bisector(ascendingBox).left; assert.strictEqual(bisectLeft(boxes, box(1)), 0); assert.strictEqual(bisectLeft(boxes, box(2)), 1); assert.strictEqual(bisectLeft(boxes, box(3)), 3); }); it("bisector(comparator).left(empty, value) returns zero", () => { assert.strictEqual(bisector(() => { throw new Error(); }).left([], 1), 0); }); it("bisector(comparator).left(array, value) returns the insertion point of a non-exact match", () => { const boxes = [1, 2, 3].map(box); const bisectLeft = bisector(ascendingBox).left; assert.strictEqual(bisectLeft(boxes, box(0.5)), 0); assert.strictEqual(bisectLeft(boxes, box(1.5)), 1); assert.strictEqual(bisectLeft(boxes, box(2.5)), 2); assert.strictEqual(bisectLeft(boxes, box(3.5)), 3); }); it("bisector(comparator).left(array, value) has undefined behavior if the search value is unorderable", () => { const boxes = [1, 2, 3].map(box); const bisectLeft = bisector(ascendingBox).left; bisectLeft(boxes, box(new Date(NaN))); // who knows what this will return! bisectLeft(boxes, box(undefined)); bisectLeft(boxes, box(NaN)); }); it("bisector(comparator).left(array, value, lo) observes the specified lower bound", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectLeft = bisector(ascendingBox).left; assert.strictEqual(bisectLeft(boxes, box(0), 2), 2); assert.strictEqual(bisectLeft(boxes, box(1), 2), 2); assert.strictEqual(bisectLeft(boxes, box(2), 2), 2); assert.strictEqual(bisectLeft(boxes, box(3), 2), 2); assert.strictEqual(bisectLeft(boxes, box(4), 2), 3); assert.strictEqual(bisectLeft(boxes, box(5), 2), 4); assert.strictEqual(bisectLeft(boxes, box(6), 2), 5); }); it("bisector(comparator).left(array, value, lo, hi) observes the specified bounds", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectLeft = bisector(ascendingBox).left; assert.strictEqual(bisectLeft(boxes, box(0), 2, 3), 2); assert.strictEqual(bisectLeft(boxes, box(1), 2, 3), 2); assert.strictEqual(bisectLeft(boxes, box(2), 2, 3), 2); assert.strictEqual(bisectLeft(boxes, box(3), 2, 3), 2); assert.strictEqual(bisectLeft(boxes, box(4), 2, 3), 3); assert.strictEqual(bisectLeft(boxes, box(5), 2, 3), 3); assert.strictEqual(bisectLeft(boxes, box(6), 2, 3), 3); }); it("bisector(comparator).left(array, value) handles large sparse d3", () => { const boxes = []; const bisectLeft = bisector(ascendingBox).left; let i = 1 << 30; boxes[i++] = box(1); boxes[i++] = box(2); boxes[i++] = box(3); boxes[i++] = box(4); boxes[i++] = box(5); assert.strictEqual(bisectLeft(boxes, box(0), i - 5, i), i - 5); assert.strictEqual(bisectLeft(boxes, box(1), i - 5, i), i - 5); assert.strictEqual(bisectLeft(boxes, box(2), i - 5, i), i - 4); assert.strictEqual(bisectLeft(boxes, box(3), i - 5, i), i - 3); assert.strictEqual(bisectLeft(boxes, box(4), i - 5, i), i - 2); assert.strictEqual(bisectLeft(boxes, box(5), i - 5, i), i - 1); assert.strictEqual(bisectLeft(boxes, box(6), i - 5, i), i - 0); }); it("bisector(comparator).right(array, value) returns the index after an exact match", () => { const boxes = [1, 2, 3].map(box); const bisectRight = bisector(ascendingBox).right; assert.strictEqual(bisectRight(boxes, box(1)), 1); assert.strictEqual(bisectRight(boxes, box(2)), 2); assert.strictEqual(bisectRight(boxes, box(3)), 3); }); it("bisector(comparator).right(array, value) returns the index after the last match", () => { const boxes = [1, 2, 2, 3].map(box); const bisectRight = bisector(ascendingBox).right; assert.strictEqual(bisectRight(boxes, box(1)), 1); assert.strictEqual(bisectRight(boxes, box(2)), 3); assert.strictEqual(bisectRight(boxes, box(3)), 4); }); it("bisector(comparator).right(empty, value) returns zero", () => { assert.strictEqual(bisector(() => { throw new Error(); }).right([], 1), 0); }); it("bisector(comparator).right(array, value) returns the insertion point of a non-exact match", () => { const boxes = [1, 2, 3].map(box); const bisectRight = bisector(ascendingBox).right; assert.strictEqual(bisectRight(boxes, box(0.5)), 0); assert.strictEqual(bisectRight(boxes, box(1.5)), 1); assert.strictEqual(bisectRight(boxes, box(2.5)), 2); assert.strictEqual(bisectRight(boxes, box(3.5)), 3); }); it("bisector(comparator).right(array, value, lo) observes the specified lower bound", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectRight = bisector(ascendingBox).right; assert.strictEqual(bisectRight(boxes, box(0), 2), 2); assert.strictEqual(bisectRight(boxes, box(1), 2), 2); assert.strictEqual(bisectRight(boxes, box(2), 2), 2); assert.strictEqual(bisectRight(boxes, box(3), 2), 3); assert.strictEqual(bisectRight(boxes, box(4), 2), 4); assert.strictEqual(bisectRight(boxes, box(5), 2), 5); assert.strictEqual(bisectRight(boxes, box(6), 2), 5); }); it("bisector(comparator).right(array, value, lo, hi) observes the specified bounds", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectRight = bisector(ascendingBox).right; assert.strictEqual(bisectRight(boxes, box(0), 2, 3), 2); assert.strictEqual(bisectRight(boxes, box(1), 2, 3), 2); assert.strictEqual(bisectRight(boxes, box(2), 2, 3), 2); assert.strictEqual(bisectRight(boxes, box(3), 2, 3), 3); assert.strictEqual(bisectRight(boxes, box(4), 2, 3), 3); assert.strictEqual(bisectRight(boxes, box(5), 2, 3), 3); assert.strictEqual(bisectRight(boxes, box(6), 2, 3), 3); }); it("bisector(comparator).right(array, value) handles large sparse d3", () => { const boxes = []; const bisectRight = bisector(ascendingBox).right; let i = 1 << 30; boxes[i++] = box(1); boxes[i++] = box(2); boxes[i++] = box(3); boxes[i++] = box(4); boxes[i++] = box(5); assert.strictEqual(bisectRight(boxes, box(0), i - 5, i), i - 5); assert.strictEqual(bisectRight(boxes, box(1), i - 5, i), i - 4); assert.strictEqual(bisectRight(boxes, box(2), i - 5, i), i - 3); assert.strictEqual(bisectRight(boxes, box(3), i - 5, i), i - 2); assert.strictEqual(bisectRight(boxes, box(4), i - 5, i), i - 1); assert.strictEqual(bisectRight(boxes, box(5), i - 5, i), i - 0); assert.strictEqual(bisectRight(boxes, box(6), i - 5, i), i - 0); }); it("bisector(accessor).left(array, value) returns the index of an exact match", () => { const boxes = [1, 2, 3].map(box); const bisectLeft = bisector(unbox).left; assert.strictEqual(bisectLeft(boxes, 1), 0); assert.strictEqual(bisectLeft(boxes, 2), 1); assert.strictEqual(bisectLeft(boxes, 3), 2); }); it("bisector(accessor).left(array, value) returns the index of the first match", () => { const boxes = [1, 2, 2, 3].map(box); const bisectLeft = bisector(unbox).left; assert.strictEqual(bisectLeft(boxes, 1), 0); assert.strictEqual(bisectLeft(boxes, 2), 1); assert.strictEqual(bisectLeft(boxes, 3), 3); }); it("bisector(accessor).left(array, value) returns the insertion point of a non-exact match", () => { const boxes = [1, 2, 3].map(box); const bisectLeft = bisector(unbox).left; assert.strictEqual(bisectLeft(boxes, 0.5), 0); assert.strictEqual(bisectLeft(boxes, 1.5), 1); assert.strictEqual(bisectLeft(boxes, 2.5), 2); assert.strictEqual(bisectLeft(boxes, 3.5), 3); }); it("bisector(accessor).left(array, value) has undefined behavior if the search value is unorderable", () => { const boxes = [1, 2, 3].map(box); const bisectLeft = bisector(unbox).left; bisectLeft(boxes, new Date(NaN)); // who knows what this will return! bisectLeft(boxes, undefined); bisectLeft(boxes, NaN); }); it("bisector(accessor).left(array, value, lo) observes the specified lower bound", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectLeft = bisector(unbox).left; assert.strictEqual(bisectLeft(boxes, 0, 2), 2); assert.strictEqual(bisectLeft(boxes, 1, 2), 2); assert.strictEqual(bisectLeft(boxes, 2, 2), 2); assert.strictEqual(bisectLeft(boxes, 3, 2), 2); assert.strictEqual(bisectLeft(boxes, 4, 2), 3); assert.strictEqual(bisectLeft(boxes, 5, 2), 4); assert.strictEqual(bisectLeft(boxes, 6, 2), 5); }); it("bisector(accessor).left(array, value, lo, hi) observes the specified bounds", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectLeft = bisector(unbox).left; assert.strictEqual(bisectLeft(boxes, 0, 2, 3), 2); assert.strictEqual(bisectLeft(boxes, 1, 2, 3), 2); assert.strictEqual(bisectLeft(boxes, 2, 2, 3), 2); assert.strictEqual(bisectLeft(boxes, 3, 2, 3), 2); assert.strictEqual(bisectLeft(boxes, 4, 2, 3), 3); assert.strictEqual(bisectLeft(boxes, 5, 2, 3), 3); assert.strictEqual(bisectLeft(boxes, 6, 2, 3), 3); }); it("bisector(accessor).left(array, value) handles large sparse d3", () => { const boxes = []; const bisectLeft = bisector(unbox).left; let i = 1 << 30; boxes[i++] = box(1); boxes[i++] = box(2); boxes[i++] = box(3); boxes[i++] = box(4); boxes[i++] = box(5); assert.strictEqual(bisectLeft(boxes, 0, i - 5, i), i - 5); assert.strictEqual(bisectLeft(boxes, 1, i - 5, i), i - 5); assert.strictEqual(bisectLeft(boxes, 2, i - 5, i), i - 4); assert.strictEqual(bisectLeft(boxes, 3, i - 5, i), i - 3); assert.strictEqual(bisectLeft(boxes, 4, i - 5, i), i - 2); assert.strictEqual(bisectLeft(boxes, 5, i - 5, i), i - 1); assert.strictEqual(bisectLeft(boxes, 6, i - 5, i), i - 0); }); it("bisector(accessor).right(array, value) returns the index after an exact match", () => { const boxes = [1, 2, 3].map(box); const bisectRight = bisector(unbox).right; assert.strictEqual(bisectRight(boxes, 1), 1); assert.strictEqual(bisectRight(boxes, 2), 2); assert.strictEqual(bisectRight(boxes, 3), 3); }); it("bisector(accessor).right(array, value) returns the index after the last match", () => { const boxes = [1, 2, 2, 3].map(box); const bisectRight = bisector(unbox).right; assert.strictEqual(bisectRight(boxes, 1), 1); assert.strictEqual(bisectRight(boxes, 2), 3); assert.strictEqual(bisectRight(boxes, 3), 4); }); it("bisector(accessor).right(array, value) returns the insertion point of a non-exact match", () => { const boxes = [1, 2, 3].map(box); const bisectRight = bisector(unbox).right; assert.strictEqual(bisectRight(boxes, 0.5), 0); assert.strictEqual(bisectRight(boxes, 1.5), 1); assert.strictEqual(bisectRight(boxes, 2.5), 2); assert.strictEqual(bisectRight(boxes, 3.5), 3); }); it("bisector(accessor).right(array, value, lo) observes the specified lower bound", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectRight = bisector(unbox).right; assert.strictEqual(bisectRight(boxes, 0, 2), 2); assert.strictEqual(bisectRight(boxes, 1, 2), 2); assert.strictEqual(bisectRight(boxes, 2, 2), 2); assert.strictEqual(bisectRight(boxes, 3, 2), 3); assert.strictEqual(bisectRight(boxes, 4, 2), 4); assert.strictEqual(bisectRight(boxes, 5, 2), 5); assert.strictEqual(bisectRight(boxes, 6, 2), 5); }); it("bisector(accessor).right(array, value, lo, hi) observes the specified bounds", () => { const boxes = [1, 2, 3, 4, 5].map(box); const bisectRight = bisector(unbox).right; assert.strictEqual(bisectRight(boxes, 0, 2, 3), 2); assert.strictEqual(bisectRight(boxes, 1, 2, 3), 2); assert.strictEqual(bisectRight(boxes, 2, 2, 3), 2); assert.strictEqual(bisectRight(boxes, 3, 2, 3), 3); assert.strictEqual(bisectRight(boxes, 4, 2, 3), 3); assert.strictEqual(bisectRight(boxes, 5, 2, 3), 3); assert.strictEqual(bisectRight(boxes, 6, 2, 3), 3); }); it("bisector(accessor).right(array, value) handles large sparse d3", () => { const boxes = []; const bisectRight = bisector(unbox).right; let i = 1 << 30; boxes[i++] = box(1); boxes[i++] = box(2); boxes[i++] = box(3); boxes[i++] = box(4); boxes[i++] = box(5); assert.strictEqual(bisectRight(boxes, 0, i - 5, i), i - 5); assert.strictEqual(bisectRight(boxes, 1, i - 5, i), i - 4); assert.strictEqual(bisectRight(boxes, 2, i - 5, i), i - 3); assert.strictEqual(bisectRight(boxes, 3, i - 5, i), i - 2); assert.strictEqual(bisectRight(boxes, 4, i - 5, i), i - 1); assert.strictEqual(bisectRight(boxes, 5, i - 5, i), i - 0); assert.strictEqual(bisectRight(boxes, 6, i - 5, i), i - 0); }); it("bisector(accessor).center(array, value) returns the closest index", () => { const data = [0, 1, 2, 3, 4]; const bisectCenter = bisector(d => +d).center; assert.strictEqual(bisectCenter(data, 2), 2); assert.strictEqual(bisectCenter(data, 2.2), 2); assert.strictEqual(bisectCenter(data, 2.6), 3); assert.strictEqual(bisectCenter(data, 3), 3); assert.strictEqual(bisectCenter(data, 4), 4); assert.strictEqual(bisectCenter(data, 4.5), 4); }); it("bisector(comparator).center(array, value) returns the closest index", () => { const data = [0, 1, 2, 3, 4]; const bisectCenter = bisector((d, x) => +d - x).center; assert.strictEqual(bisectCenter(data, 2), 2); assert.strictEqual(bisectCenter(data, 2.2), 2); assert.strictEqual(bisectCenter(data, 2.6), 3); assert.strictEqual(bisectCenter(data, 3), 3); }); it("bisector(comparator).center(empty, value) returns zero", () => { assert.strictEqual(bisector(() => { throw new Error(); }).center([], 1), 0); }); it("bisector(ascending).center(array, value) returns the left value", () => { const data = [0, 1, 2, 3, 4]; const bisectCenter = bisector(ascending).center; assert.strictEqual(bisectCenter(data, 2.0), 2); assert.strictEqual(bisectCenter(data, 2.2), 3); assert.strictEqual(bisectCenter(data, 2.6), 3); assert.strictEqual(bisectCenter(data, 3.0), 3); }); it("bisector(ordinalAccessor).center(array, value) returns the left value", () => { const data = ["aa", "bb", "cc", "dd", "ee"]; const bisectCenter = bisector(d => d).center; assert.strictEqual(bisectCenter(data, "cc"), 2); assert.strictEqual(bisectCenter(data, "ce"), 3); assert.strictEqual(bisectCenter(data, "cf"), 3); assert.strictEqual(bisectCenter(data, "dd"), 3); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } function ascendingBox(a, b) { return ascending(a.value, b.value); } d3-array-3.1.1/test/count-test.js000066400000000000000000000013571412622006300165620ustar00rootroot00000000000000import assert from "assert"; import {count} from "../src/index.js"; it("count() accepts an iterable", () => { assert.deepStrictEqual(count([1, 2]), 2); assert.deepStrictEqual(count(new Set([1, 2])), 2); assert.deepStrictEqual(count(generate(1, 2)), 2); }); it("count() ignores NaN, null", () => { assert.deepStrictEqual(count([NaN, null, 0, 1]), 2); }); it("count() coerces to a number", () => { assert.deepStrictEqual(count(["1", " 2", "Fred"]), 2); }); it("count() accepts an accessor", () => { assert.deepStrictEqual(count([{v:NaN}, {}, {v:0}, {v:1}], d => d.v), 2); assert.deepStrictEqual(count([{n: "Alice", age: NaN}, {n: "Bob", age: 18}, {n: "Other"}], d => d.age), 1); }); function* generate(...values) { yield* values; } d3-array-3.1.1/test/cross-test.js000066400000000000000000000037611412622006300165640ustar00rootroot00000000000000import assert from "assert"; import {cross} from "../src/index.js"; it("cross() returns an empty array", () => { assert.deepStrictEqual(cross(), []); }); it("cross([]) returns an empty array", () => { assert.deepStrictEqual(cross([]), []); }); it("cross([1, 2], []) returns an empty array", () => { assert.deepStrictEqual(cross([1, 2], []), []); }); it("cross({length: weird}) returns an empty array", () => { assert.deepStrictEqual(cross({length: NaN}), []); assert.deepStrictEqual(cross({length: 0.5}), []); assert.deepStrictEqual(cross({length: -1}), []); assert.deepStrictEqual(cross({length: undefined}), []); }); it("cross(...strings) returns the expected result", () => { assert.deepStrictEqual(cross("foo", "bar", (a, b) => a + b), ["fb", "fa", "fr", "ob", "oa", "or", "ob", "oa", "or"]); }); it("cross(a) returns the expected result", () => { assert.deepStrictEqual(cross([1, 2]), [[1], [2]]); }); it("cross(a, b) returns Cartesian product a×b", () => { assert.deepStrictEqual(cross([1, 2], ["x", "y"]), [[1, "x"], [1, "y"], [2, "x"], [2, "y"]]); }); it("cross(a, b, c) returns Cartesian product a×b×c", () => { assert.deepStrictEqual(cross([1, 2], [3, 4], [5, 6, 7]), [ [1, 3, 5], [1, 3, 6], [1, 3, 7], [1, 4, 5], [1, 4, 6], [1, 4, 7], [2, 3, 5], [2, 3, 6], [2, 3, 7], [2, 4, 5], [2, 4, 6], [2, 4, 7] ]); }); it("cross(a, b, f) invokes the specified function for each pair", () => { assert.deepStrictEqual(cross([1, 2], ["x", "y"], (a, b) => a + b), ["1x", "1y", "2x", "2y"]); }); it("cross(a, b, c, f) invokes the specified function for each triple", () => { assert.deepStrictEqual(cross([1, 2], [3, 4], [5, 6, 7], (a, b, c) => a + b + c), [9, 10, 11, 10, 11, 12, 10, 11, 12, 11, 12, 13]); }); it("cross(a, b) returns Cartesian product a×b of generators", () => { assert.deepStrictEqual(cross(generate(1, 2), generate("x", "y")), [[1, "x"], [1, "y"], [2, "x"], [2, "y"]]); }); function* generate(...values) { yield* values; } d3-array-3.1.1/test/cumsum-test.js000066400000000000000000000107051412622006300167400ustar00rootroot00000000000000import assert from "assert"; import {cumsum} from "../src/index.js"; it("cumsum(array) returns the cumulative sum of the specified numbers", () => { assert.deepStrictEqual(Array.from(cumsum([1])), [1]); assert.deepStrictEqual(Array.from(cumsum([5, 1, 2, 3, 4])), [5, 6, 8, 11, 15]); assert.deepStrictEqual(Array.from(cumsum([20, 3])), [20, 23]); assert.deepStrictEqual(Array.from(cumsum([3, 20])), [3, 23]); }); it("cumsum(array) observes values that can be coerced to numbers", () => { assert.deepStrictEqual(Array.from(cumsum(["20", "3"])), [20, 23]); assert.deepStrictEqual(Array.from(cumsum(["3", "20"])), [3, 23]); assert.deepStrictEqual(Array.from(cumsum(["3", 20])), [3, 23]); assert.deepStrictEqual(Array.from(cumsum([20, "3"])), [20, 23]); assert.deepStrictEqual(Array.from(cumsum([3, "20"])), [3, 23]); assert.deepStrictEqual(Array.from(cumsum(["20", 3])), [20, 23]); }); it("cumsum(array) ignores non-numeric values", () => { assert.deepStrictEqual(Array.from(cumsum(["a", "b", "c"])), [0, 0, 0]); assert.deepStrictEqual(Array.from(cumsum(["a", 1, "2"])), [0, 1, 3]); }); it("cumsum(array) ignores null, undefined and NaN", () => { assert.deepStrictEqual(Array.from(cumsum([NaN, 1, 2, 3, 4, 5])), [0, 1, 3, 6, 10, 15]); assert.deepStrictEqual(Array.from(cumsum([1, 2, 3, 4, 5, NaN])), [1, 3, 6, 10, 15, 15]); assert.deepStrictEqual(Array.from(cumsum([10, null, 3, undefined, 5, NaN])), [10, 10, 13, 13, 18, 18]); }); it("cumsum(array) returns zeros if there are no numbers", () => { assert.deepStrictEqual(Array.from(cumsum([])), []); assert.deepStrictEqual(Array.from(cumsum([NaN])), [0]); assert.deepStrictEqual(Array.from(cumsum([undefined])), [0]); assert.deepStrictEqual(Array.from(cumsum([undefined, NaN])), [0, 0]); assert.deepStrictEqual(Array.from(cumsum([undefined, NaN, {}])), [0, 0, 0]); }); it("cumsum(array, f) returns the cumsum of the specified numbers", () => { assert.deepStrictEqual(Array.from(cumsum([1].map(box), unbox)), [1]); assert.deepStrictEqual(Array.from(cumsum([5, 1, 2, 3, 4].map(box), unbox)), [5, 6, 8, 11, 15]); assert.deepStrictEqual(Array.from(cumsum([20, 3].map(box), unbox)), [20, 23]); assert.deepStrictEqual(Array.from(cumsum([3, 20].map(box), unbox)), [3, 23]); }); it("cumsum(array, f) observes values that can be coerced to numbers", () => { assert.deepStrictEqual(Array.from(cumsum(["20", "3"].map(box), unbox)), [20, 23]); assert.deepStrictEqual(Array.from(cumsum(["3", "20"].map(box), unbox)), [3, 23]); assert.deepStrictEqual(Array.from(cumsum(["3", 20].map(box), unbox)), [3, 23]); assert.deepStrictEqual(Array.from(cumsum([20, "3"].map(box), unbox)), [20, 23]); assert.deepStrictEqual(Array.from(cumsum([3, "20"].map(box), unbox)), [3, 23]); assert.deepStrictEqual(Array.from(cumsum(["20", 3].map(box), unbox)), [20, 23]); }); it("cumsum(array, f) ignores non-numeric values", () => { assert.deepStrictEqual(Array.from(cumsum(["a", "b", "c"].map(box), unbox)), [0, 0, 0]); assert.deepStrictEqual(Array.from(cumsum(["a", 1, "2"].map(box), unbox)), [0, 1, 3]); }); it("cumsum(array, f) ignores null, undefined and NaN", () => { assert.deepStrictEqual(Array.from(cumsum([NaN, 1, 2, 3, 4, 5].map(box), unbox)), [0, 1, 3, 6, 10, 15]); assert.deepStrictEqual(Array.from(cumsum([1, 2, 3, 4, 5, NaN].map(box), unbox)), [1, 3, 6, 10, 15, 15]); assert.deepStrictEqual(Array.from(cumsum([10, null, 3, undefined, 5, NaN].map(box), unbox)), [10, 10, 13, 13, 18, 18]); }); it("cumsum(array, f) returns zeros if there are no numbers", () => { assert.deepStrictEqual(Array.from(cumsum([].map(box), unbox)), []); assert.deepStrictEqual(Array.from(cumsum([NaN].map(box), unbox)), [0]); assert.deepStrictEqual(Array.from(cumsum([undefined].map(box), unbox)), [0]); assert.deepStrictEqual(Array.from(cumsum([undefined, NaN].map(box), unbox)), [0, 0]); assert.deepStrictEqual(Array.from(cumsum([undefined, NaN, {}].map(box), unbox)), [0, 0, 0]); }); it("cumsum(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; cumsum(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("cumsum(array, f) uses the undefined context", () => { const results = []; cumsum([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/data/000077500000000000000000000000001412622006300150225ustar00rootroot00000000000000d3-array-3.1.1/test/data/barley.json000066400000000000000000000202601412622006300171730ustar00rootroot00000000000000[{"yield":27,"variety":"Manchuria","year":1931,"site":"University Farm"},{"yield":48.86667,"variety":"Manchuria","year":1931,"site":"Waseca"},{"yield":27.43334,"variety":"Manchuria","year":1931,"site":"Morris"},{"yield":39.93333,"variety":"Manchuria","year":1931,"site":"Crookston"},{"yield":32.96667,"variety":"Manchuria","year":1931,"site":"Grand Rapids"},{"yield":28.96667,"variety":"Manchuria","year":1931,"site":"Duluth"},{"yield":43.06666,"variety":"Glabron","year":1931,"site":"University Farm"},{"yield":55.2,"variety":"Glabron","year":1931,"site":"Waseca"},{"yield":28.76667,"variety":"Glabron","year":1931,"site":"Morris"},{"yield":38.13333,"variety":"Glabron","year":1931,"site":"Crookston"},{"yield":29.13333,"variety":"Glabron","year":1931,"site":"Grand Rapids"},{"yield":29.66667,"variety":"Glabron","year":1931,"site":"Duluth"},{"yield":35.13333,"variety":"Svansota","year":1931,"site":"University Farm"},{"yield":47.33333,"variety":"Svansota","year":1931,"site":"Waseca"},{"yield":25.76667,"variety":"Svansota","year":1931,"site":"Morris"},{"yield":40.46667,"variety":"Svansota","year":1931,"site":"Crookston"},{"yield":29.66667,"variety":"Svansota","year":1931,"site":"Grand Rapids"},{"yield":25.7,"variety":"Svansota","year":1931,"site":"Duluth"},{"yield":39.9,"variety":"Velvet","year":1931,"site":"University Farm"},{"yield":50.23333,"variety":"Velvet","year":1931,"site":"Waseca"},{"yield":26.13333,"variety":"Velvet","year":1931,"site":"Morris"},{"yield":41.33333,"variety":"Velvet","year":1931,"site":"Crookston"},{"yield":23.03333,"variety":"Velvet","year":1931,"site":"Grand Rapids"},{"yield":26.3,"variety":"Velvet","year":1931,"site":"Duluth"},{"yield":36.56666,"variety":"Trebi","year":1931,"site":"University Farm"},{"yield":63.8333,"variety":"Trebi","year":1931,"site":"Waseca"},{"yield":43.76667,"variety":"Trebi","year":1931,"site":"Morris"},{"yield":46.93333,"variety":"Trebi","year":1931,"site":"Crookston"},{"yield":29.76667,"variety":"Trebi","year":1931,"site":"Grand Rapids"},{"yield":33.93333,"variety":"Trebi","year":1931,"site":"Duluth"},{"yield":43.26667,"variety":"No. 457","year":1931,"site":"University Farm"},{"yield":58.1,"variety":"No. 457","year":1931,"site":"Waseca"},{"yield":28.7,"variety":"No. 457","year":1931,"site":"Morris"},{"yield":45.66667,"variety":"No. 457","year":1931,"site":"Crookston"},{"yield":32.16667,"variety":"No. 457","year":1931,"site":"Grand Rapids"},{"yield":33.6,"variety":"No. 457","year":1931,"site":"Duluth"},{"yield":36.6,"variety":"No. 462","year":1931,"site":"University Farm"},{"yield":65.7667,"variety":"No. 462","year":1931,"site":"Waseca"},{"yield":30.36667,"variety":"No. 462","year":1931,"site":"Morris"},{"yield":48.56666,"variety":"No. 462","year":1931,"site":"Crookston"},{"yield":24.93334,"variety":"No. 462","year":1931,"site":"Grand Rapids"},{"yield":28.1,"variety":"No. 462","year":1931,"site":"Duluth"},{"yield":32.76667,"variety":"Peatland","year":1931,"site":"University Farm"},{"yield":48.56666,"variety":"Peatland","year":1931,"site":"Waseca"},{"yield":29.86667,"variety":"Peatland","year":1931,"site":"Morris"},{"yield":41.6,"variety":"Peatland","year":1931,"site":"Crookston"},{"yield":34.7,"variety":"Peatland","year":1931,"site":"Grand Rapids"},{"yield":32,"variety":"Peatland","year":1931,"site":"Duluth"},{"yield":24.66667,"variety":"No. 475","year":1931,"site":"University Farm"},{"yield":46.76667,"variety":"No. 475","year":1931,"site":"Waseca"},{"yield":22.6,"variety":"No. 475","year":1931,"site":"Morris"},{"yield":44.1,"variety":"No. 475","year":1931,"site":"Crookston"},{"yield":19.7,"variety":"No. 475","year":1931,"site":"Grand Rapids"},{"yield":33.06666,"variety":"No. 475","year":1931,"site":"Duluth"},{"yield":39.3,"variety":"Wisconsin No. 38","year":1931,"site":"University Farm"},{"yield":58.8,"variety":"Wisconsin No. 38","year":1931,"site":"Waseca"},{"yield":29.46667,"variety":"Wisconsin No. 38","year":1931,"site":"Morris"},{"yield":49.86667,"variety":"Wisconsin No. 38","year":1931,"site":"Crookston"},{"yield":34.46667,"variety":"Wisconsin No. 38","year":1931,"site":"Grand Rapids"},{"yield":31.6,"variety":"Wisconsin No. 38","year":1931,"site":"Duluth"},{"yield":26.9,"variety":"Manchuria","year":1932,"site":"University Farm"},{"yield":33.46667,"variety":"Manchuria","year":1932,"site":"Waseca"},{"yield":34.36666,"variety":"Manchuria","year":1932,"site":"Morris"},{"yield":32.96667,"variety":"Manchuria","year":1932,"site":"Crookston"},{"yield":22.13333,"variety":"Manchuria","year":1932,"site":"Grand Rapids"},{"yield":22.56667,"variety":"Manchuria","year":1932,"site":"Duluth"},{"yield":36.8,"variety":"Glabron","year":1932,"site":"University Farm"},{"yield":37.73333,"variety":"Glabron","year":1932,"site":"Waseca"},{"yield":35.13333,"variety":"Glabron","year":1932,"site":"Morris"},{"yield":26.16667,"variety":"Glabron","year":1932,"site":"Crookston"},{"yield":14.43333,"variety":"Glabron","year":1932,"site":"Grand Rapids"},{"yield":25.86667,"variety":"Glabron","year":1932,"site":"Duluth"},{"yield":27.43334,"variety":"Svansota","year":1932,"site":"University Farm"},{"yield":38.5,"variety":"Svansota","year":1932,"site":"Waseca"},{"yield":35.03333,"variety":"Svansota","year":1932,"site":"Morris"},{"yield":20.63333,"variety":"Svansota","year":1932,"site":"Crookston"},{"yield":16.63333,"variety":"Svansota","year":1932,"site":"Grand Rapids"},{"yield":22.23333,"variety":"Svansota","year":1932,"site":"Duluth"},{"yield":26.8,"variety":"Velvet","year":1932,"site":"University Farm"},{"yield":37.4,"variety":"Velvet","year":1932,"site":"Waseca"},{"yield":38.83333,"variety":"Velvet","year":1932,"site":"Morris"},{"yield":32.06666,"variety":"Velvet","year":1932,"site":"Crookston"},{"yield":32.23333,"variety":"Velvet","year":1932,"site":"Grand Rapids"},{"yield":22.46667,"variety":"Velvet","year":1932,"site":"Duluth"},{"yield":29.06667,"variety":"Trebi","year":1932,"site":"University Farm"},{"yield":49.2333,"variety":"Trebi","year":1932,"site":"Waseca"},{"yield":46.63333,"variety":"Trebi","year":1932,"site":"Morris"},{"yield":41.83333,"variety":"Trebi","year":1932,"site":"Crookston"},{"yield":20.63333,"variety":"Trebi","year":1932,"site":"Grand Rapids"},{"yield":30.6,"variety":"Trebi","year":1932,"site":"Duluth"},{"yield":26.43334,"variety":"No. 457","year":1932,"site":"University Farm"},{"yield":42.2,"variety":"No. 457","year":1932,"site":"Waseca"},{"yield":43.53334,"variety":"No. 457","year":1932,"site":"Morris"},{"yield":34.33333,"variety":"No. 457","year":1932,"site":"Crookston"},{"yield":19.46667,"variety":"No. 457","year":1932,"site":"Grand Rapids"},{"yield":22.7,"variety":"No. 457","year":1932,"site":"Duluth"},{"yield":25.56667,"variety":"No. 462","year":1932,"site":"University Farm"},{"yield":44.7,"variety":"No. 462","year":1932,"site":"Waseca"},{"yield":47,"variety":"No. 462","year":1932,"site":"Morris"},{"yield":30.53333,"variety":"No. 462","year":1932,"site":"Crookston"},{"yield":19.9,"variety":"No. 462","year":1932,"site":"Grand Rapids"},{"yield":22.5,"variety":"No. 462","year":1932,"site":"Duluth"},{"yield":28.06667,"variety":"Peatland","year":1932,"site":"University Farm"},{"yield":36.03333,"variety":"Peatland","year":1932,"site":"Waseca"},{"yield":43.2,"variety":"Peatland","year":1932,"site":"Morris"},{"yield":25.23333,"variety":"Peatland","year":1932,"site":"Crookston"},{"yield":26.76667,"variety":"Peatland","year":1932,"site":"Grand Rapids"},{"yield":31.36667,"variety":"Peatland","year":1932,"site":"Duluth"},{"yield":30,"variety":"No. 475","year":1932,"site":"University Farm"},{"yield":41.26667,"variety":"No. 475","year":1932,"site":"Waseca"},{"yield":44.23333,"variety":"No. 475","year":1932,"site":"Morris"},{"yield":32.13333,"variety":"No. 475","year":1932,"site":"Crookston"},{"yield":15.23333,"variety":"No. 475","year":1932,"site":"Grand Rapids"},{"yield":27.36667,"variety":"No. 475","year":1932,"site":"Duluth"},{"yield":38,"variety":"Wisconsin No. 38","year":1932,"site":"University Farm"},{"yield":58.16667,"variety":"Wisconsin No. 38","year":1932,"site":"Waseca"},{"yield":47.16667,"variety":"Wisconsin No. 38","year":1932,"site":"Morris"},{"yield":35.9,"variety":"Wisconsin No. 38","year":1932,"site":"Crookston"},{"yield":20.66667,"variety":"Wisconsin No. 38","year":1932,"site":"Grand Rapids"},{"yield":29.33333,"variety":"Wisconsin No. 38","year":1932,"site":"Duluth"}]d3-array-3.1.1/test/descending-test.js000066400000000000000000000016411412622006300175310ustar00rootroot00000000000000import assert from "assert"; import {descending} from "../src/index.js"; it("descending(a, b) returns a positive number if a < b", () => { assert(descending(0, 1) > 0); assert(descending("a", "b") > 0); }); it("descending(a, b) returns a negative number if a > b", () => { assert(descending(1, 0) < 0); assert(descending("b", "a") < 0); }); it("descending(a, b) returns zero if a >= b and a <= b", () => { assert.strictEqual(descending(0, 0), 0); assert.strictEqual(descending("a", "a"), 0); assert.strictEqual(descending("0", 0), 0); assert.strictEqual(descending(0, "0"), 0); }); it("descending(a, b) returns NaN if a and b are not comparable", () => { assert(isNaN(descending(0, undefined))); assert(isNaN(descending(undefined, 0))); assert(isNaN(descending(undefined, undefined))); assert(isNaN(descending(0, NaN))); assert(isNaN(descending(NaN, 0))); assert(isNaN(descending(NaN, NaN))); }); d3-array-3.1.1/test/deviation-test.js000066400000000000000000000053721412622006300174150ustar00rootroot00000000000000import assert from "assert"; import {deviation} from "../src/index.js"; it("deviation(array) returns the standard deviation of the specified numbers", () => { assert.strictEqual(deviation([5, 1, 2, 3, 4]), Math.sqrt(2.5)); assert.strictEqual(deviation([20, 3]), Math.sqrt(144.5)); assert.strictEqual(deviation([3, 20]), Math.sqrt(144.5)); }); it("deviation(array) ignores null, undefined and NaN", () => { assert.strictEqual(deviation([NaN, 1, 2, 3, 4, 5]), Math.sqrt(2.5)); assert.strictEqual(deviation([1, 2, 3, 4, 5, NaN]), Math.sqrt(2.5)); assert.strictEqual(deviation([10, null, 3, undefined, 5, NaN]), Math.sqrt(13)); }); it("deviation(array) can handle large numbers without overflowing", () => { assert.strictEqual(deviation([Number.MAX_VALUE, Number.MAX_VALUE]), 0); assert.strictEqual(deviation([-Number.MAX_VALUE, -Number.MAX_VALUE]), 0); }); it("deviation(array) returns undefined if the array has fewer than two numbers", () => { assert.strictEqual(deviation([1]), undefined); assert.strictEqual(deviation([]), undefined); assert.strictEqual(deviation([null]), undefined); assert.strictEqual(deviation([undefined]), undefined); assert.strictEqual(deviation([NaN]), undefined); assert.strictEqual(deviation([NaN, NaN]), undefined); }); it("deviation(array, f) returns the deviation of the specified numbers", () => { assert.strictEqual(deviation([5, 1, 2, 3, 4].map(box), unbox), Math.sqrt(2.5)); assert.strictEqual(deviation([20, 3].map(box), unbox), Math.sqrt(144.5)); assert.strictEqual(deviation([3, 20].map(box), unbox), Math.sqrt(144.5)); }); it("deviation(array, f) ignores null, undefined and NaN", () => { assert.strictEqual(deviation([NaN, 1, 2, 3, 4, 5].map(box), unbox), Math.sqrt(2.5)); assert.strictEqual(deviation([1, 2, 3, 4, 5, NaN].map(box), unbox), Math.sqrt(2.5)); assert.strictEqual(deviation([10, null, 3, undefined, 5, NaN].map(box), unbox), Math.sqrt(13)); }); it("deviation(array, f) can handle large numbers without overflowing", () => { assert.strictEqual(deviation([Number.MAX_VALUE, Number.MAX_VALUE].map(box), unbox), 0); assert.strictEqual(deviation([-Number.MAX_VALUE, -Number.MAX_VALUE].map(box), unbox), 0); }); it("deviation(array, f) returns undefined if the array has fewer than two numbers", () => { assert.strictEqual(deviation([1].map(box), unbox), undefined); assert.strictEqual(deviation([].map(box), unbox), undefined); assert.strictEqual(deviation([null].map(box), unbox), undefined); assert.strictEqual(deviation([undefined].map(box), unbox), undefined); assert.strictEqual(deviation([NaN].map(box), unbox), undefined); assert.strictEqual(deviation([NaN, NaN].map(box), unbox), undefined); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/difference-test.js000066400000000000000000000020431412622006300175150ustar00rootroot00000000000000import {difference} from "../src/index.js"; import {assertSetEqual} from "./asserts.js"; it("difference(values, other) returns a set of values", () => { assertSetEqual(difference([1, 2, 3], [2, 1]), [3]); assertSetEqual(difference([1, 2], [2, 3, 1]), []); assertSetEqual(difference([2, 1, 3], [4, 3, 1]), [2]); }); it("difference(...values) accepts iterables", () => { assertSetEqual(difference(new Set([1, 2, 3]), new Set([1])), [2, 3]); }); it("difference(values, other) performs interning", () => { assertSetEqual(difference([new Date("2021-01-01"), new Date("2021-01-02"), new Date("2021-01-03")], [new Date("2021-01-02"), new Date("2021-01-01")]), [new Date("2021-01-03")]); assertSetEqual(difference([new Date("2021-01-01"), new Date("2021-01-02")], [new Date("2021-01-02"), new Date("2021-01-03"), new Date("2021-01-01")]), []); assertSetEqual(difference([new Date("2021-01-02"), new Date("2021-01-01"), new Date("2021-01-03")], [new Date("2021-01-04"), new Date("2021-01-03"), new Date("2021-01-01")]), [new Date("2021-01-02")]); }); d3-array-3.1.1/test/disjoint-test.js000066400000000000000000000020541412622006300172500ustar00rootroot00000000000000import assert from "assert"; import {disjoint} from "../src/index.js"; it("disjoint(values, other) returns true if sets are disjoint", () => { assert.strictEqual(disjoint([1], [2]), true); assert.strictEqual(disjoint([2, 3], [3, 4]), false); assert.strictEqual(disjoint([1], []), true); }); it("disjoint(values, other) allows values to be infinite", () => { assert.strictEqual(disjoint(odds(), [0, 2, 4, 5]), false); }); it("disjoint(values, other) allows other to be infinite", () => { assert.strictEqual(disjoint([2], repeat(1, 3, 2)), false); }); it("disjoint(values, other) performs interning", () => { assert.strictEqual(disjoint([new Date("2021-01-01")], [new Date("2021-01-02")]), true); assert.strictEqual(disjoint([new Date("2021-01-02"), new Date("2021-01-03")], [new Date("2021-01-03"), new Date("2021-01-04")]), false); assert.strictEqual(disjoint([new Date("2021-01-01")], []), true); }); function* odds() { for (let i = 1; true; i += 2) { yield i; } } function* repeat(...values) { while (true) { yield* values; } } d3-array-3.1.1/test/every-test.js000066400000000000000000000035061412622006300165620ustar00rootroot00000000000000import assert from "assert"; import {every} from "../src/index.js"; it("every(values, test) returns true if all tests pass", () => { assert.strictEqual(every([1, 2, 3, 2, 1], x => x & 1), false); assert.strictEqual(every([1, 2, 3, 2, 1], x => x >= 1), true); }); it("every(values, test) returns true if values is empty", () => { assert.strictEqual(every([], () => false), true); }); it("every(values, test) accepts an iterable", () => { assert.strictEqual(every(new Set([1, 2, 3, 2, 1]), x => x >= 1), true); assert.strictEqual(every((function*() { yield* [1, 2, 3, 2, 1]; })(), x => x >= 1), true); assert.strictEqual(every(Uint8Array.of(1, 2, 3, 2, 1), x => x >= 1), true); }); it("every(values, test) enforces that test is a function", () => { assert.throws(() => every([]), TypeError); }); it("every(values, test) enforces that values is iterable", () => { assert.throws(() => every({}, () => true), TypeError); }); it("every(values, test) passes test (value, index, values)", () => { const calls = []; const values = new Set([5, 4, 3, 2, 1]); every(values, function() { return calls.push([this, ...arguments]); }); assert.deepStrictEqual(calls, [ [undefined, 5, 0, values], [undefined, 4, 1, values], [undefined, 3, 2, values], [undefined, 2, 3, values], [undefined, 1, 4, values] ]); }); it("every(values, test) short-circuts when test returns falsey", () => { let calls = 0; assert.strictEqual(every([1, 2, 3], x => (++calls, x < 2)), false); assert.strictEqual(calls, 2); assert.strictEqual(every([1, 2, 3], x => (++calls, x - 2)), false); assert.strictEqual(calls, 4); }); it("every(values, test) does not skip sparse elements", () => { assert.deepStrictEqual(every([, 1, 2,, ], x => x === undefined || x >=1), true); assert.deepStrictEqual(every([, 1, 2,, ], x => x >=1), false); }); d3-array-3.1.1/test/extent-test.js000066400000000000000000000110121412622006300167260ustar00rootroot00000000000000import assert from "assert"; import {extent} from "../src/index.js"; it("extent(array) returns the least and greatest numeric values for numbers", () => { assert.deepStrictEqual(extent([1]), [1, 1]); assert.deepStrictEqual(extent([5, 1, 2, 3, 4]), [1, 5]); assert.deepStrictEqual(extent([20, 3]), [3, 20]); assert.deepStrictEqual(extent([3, 20]), [3, 20]); }); it("extent(array) returns the least and greatest lexicographic value for strings", () => { assert.deepStrictEqual(extent(["c", "a", "b"]), ["a", "c"]); assert.deepStrictEqual(extent(["20", "3"]), ["20", "3"]); assert.deepStrictEqual(extent(["3", "20"]), ["20", "3"]); }); it("extent(array) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(extent([NaN, 1, 2, 3, 4, 5]), [1, 5]); assert.deepStrictEqual(extent([o, 1, 2, 3, 4, 5]), [1, 5]); assert.deepStrictEqual(extent([1, 2, 3, 4, 5, NaN]), [1, 5]); assert.deepStrictEqual(extent([1, 2, 3, 4, 5, o]), [1, 5]); assert.deepStrictEqual(extent([10, null, 3, undefined, 5, NaN]), [3, 10]); assert.deepStrictEqual(extent([-1, null, -3, undefined, -5, NaN]), [-5, -1]); }); it("extent(array) compares heterogenous types as numbers", () => { assert.deepStrictEqual(extent([20, "3"]), ["3", 20]); assert.deepStrictEqual(extent(["20", 3]), [3, "20"]); assert.deepStrictEqual(extent([3, "20"]), [3, "20"]); assert.deepStrictEqual(extent(["3", 20]), ["3", 20]); }); it("extent(array) returns undefined if the array contains no numbers", () => { assert.deepStrictEqual(extent([]), [undefined, undefined]); assert.deepStrictEqual(extent([null]), [undefined, undefined]); assert.deepStrictEqual(extent([undefined]), [undefined, undefined]); assert.deepStrictEqual(extent([NaN]), [undefined, undefined]); assert.deepStrictEqual(extent([NaN, NaN]), [undefined, undefined]); }); it("extent(array, f) returns the least and greatest numeric value for numbers", () => { assert.deepStrictEqual(extent([1].map(box), unbox), [1, 1]); assert.deepStrictEqual(extent([5, 1, 2, 3, 4].map(box), unbox), [1, 5]); assert.deepStrictEqual(extent([20, 3].map(box), unbox), [3, 20]); assert.deepStrictEqual(extent([3, 20].map(box), unbox), [3, 20]); }); it("extent(array, f) returns the least and greatest lexicographic value for strings", () => { assert.deepStrictEqual(extent(["c", "a", "b"].map(box), unbox), ["a", "c"]); assert.deepStrictEqual(extent(["20", "3"].map(box), unbox), ["20", "3"]); assert.deepStrictEqual(extent(["3", "20"].map(box), unbox), ["20", "3"]); }); it("extent(array, f) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(extent([NaN, 1, 2, 3, 4, 5].map(box), unbox), [1, 5]); assert.deepStrictEqual(extent([o, 1, 2, 3, 4, 5].map(box), unbox), [1, 5]); assert.deepStrictEqual(extent([1, 2, 3, 4, 5, NaN].map(box), unbox), [1, 5]); assert.deepStrictEqual(extent([1, 2, 3, 4, 5, o].map(box), unbox), [1, 5]); assert.deepStrictEqual(extent([10, null, 3, undefined, 5, NaN].map(box), unbox), [3, 10]); assert.deepStrictEqual(extent([-1, null, -3, undefined, -5, NaN].map(box), unbox), [-5, -1]); }); it("extent(array, f) compares heterogenous types as numbers", () => { assert.deepStrictEqual(extent([20, "3"].map(box), unbox), ["3", 20]); assert.deepStrictEqual(extent(["20", 3].map(box), unbox), [3, "20"]); assert.deepStrictEqual(extent([3, "20"].map(box), unbox), [3, "20"]); assert.deepStrictEqual(extent(["3", 20].map(box), unbox), ["3", 20]); }); it("extent(array, f) returns undefined if the array contains no observed values", () => { assert.deepStrictEqual(extent([].map(box), unbox), [undefined, undefined]); assert.deepStrictEqual(extent([null].map(box), unbox), [undefined, undefined]); assert.deepStrictEqual(extent([undefined].map(box), unbox), [undefined, undefined]); assert.deepStrictEqual(extent([NaN].map(box), unbox), [undefined, undefined]); assert.deepStrictEqual(extent([NaN, NaN].map(box), unbox), [undefined, undefined]); }); it("extent(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; extent(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("extent(array, f) uses the undefined context", () => { const results = []; extent([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/fcumsum-test.js000066400000000000000000000106201412622006300171020ustar00rootroot00000000000000import assert from "assert"; import {cumsum, fcumsum} from "../src/index.js"; it("fcumsum(array) returns a Float64Array of the expected length", () => { const A = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]; const R = cumsum(A); assert(R instanceof Float64Array); assert.strictEqual(R.length, A.length); }); it("fcumsum(array) is an exact cumsum", () => { assert.strictEqual(lastc([0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]), 1); assert.strictEqual(lastc([0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3]), 0); assert.strictEqual(lastc(["20", "3"].map(box), unbox), 23); }); it("fcumsum(array) returns the fsum of the specified numbers", () => { assert.strictEqual(lastc([1]), 1); assert.strictEqual(lastc([5, 1, 2, 3, 4]), 15); assert.strictEqual(lastc([20, 3]), 23); assert.strictEqual(lastc([3, 20]), 23); }); it("fcumsum(array) observes values that can be coerced to numbers", () => { assert.strictEqual(lastc(["20", "3"]), 23); assert.strictEqual(lastc(["3", "20"]), 23); assert.strictEqual(lastc(["3", 20]), 23); assert.strictEqual(lastc([20, "3"]), 23); assert.strictEqual(lastc([3, "20"]), 23); assert.strictEqual(lastc(["20", 3]), 23); }); it("fcumsum(array) ignores non-numeric values", () => { assert.strictEqual(lastc(["a", "b", "c"]), 0); assert.strictEqual(lastc(["a", 1, "2"]), 3); }); it("fcumsum(array) ignores null, undefined and NaN", () => { assert.strictEqual(lastc([NaN, 1, 2, 3, 4, 5]), 15); assert.strictEqual(lastc([1, 2, 3, 4, 5, NaN]), 15); assert.strictEqual(lastc([10, null, 3, undefined, 5, NaN]), 18); }); it("fcumsum(array) returns an array of zeros if there are no numbers", () => { assert.deepStrictEqual(Array.from(fcumsum([])), []); assert.deepStrictEqual(Array.from(fcumsum([NaN])), [0]); assert.deepStrictEqual(Array.from(fcumsum([undefined])), [0]); assert.deepStrictEqual(Array.from(fcumsum([undefined, NaN])), [0, 0]); assert.deepStrictEqual(Array.from(fcumsum([undefined, NaN, {}])), [0, 0, 0]); }); it("fcumsum(array, f) returns the fsum of the specified numbers", () => { assert.strictEqual(lastc([1].map(box), unbox), 1); assert.strictEqual(lastc([5, 1, 2, 3, 4].map(box), unbox), 15); assert.strictEqual(lastc([20, 3].map(box), unbox), 23); assert.strictEqual(lastc([3, 20].map(box), unbox), 23); }); it("fcumsum(array, f) observes values that can be coerced to numbers", () => { assert.strictEqual(lastc(["20", "3"].map(box), unbox), 23); assert.strictEqual(lastc(["3", "20"].map(box), unbox), 23); assert.strictEqual(lastc(["3", 20].map(box), unbox), 23); assert.strictEqual(lastc([20, "3"].map(box), unbox), 23); assert.strictEqual(lastc([3, "20"].map(box), unbox), 23); assert.strictEqual(lastc(["20", 3].map(box), unbox), 23); }); it("fcumsum(array, f) ignores non-numeric values", () => { assert.strictEqual(lastc(["a", "b", "c"].map(box), unbox), 0); assert.strictEqual(lastc(["a", 1, "2"].map(box), unbox), 3); }); it("fcumsum(array, f) ignores null, undefined and NaN", () => { assert.strictEqual(lastc([NaN, 1, 2, 3, 4, 5].map(box), unbox), 15); assert.strictEqual(lastc([1, 2, 3, 4, 5, NaN].map(box), unbox), 15); assert.strictEqual(lastc([10, null, 3, undefined, 5, NaN].map(box), unbox), 18); }); it("fcumsum(array, f) returns zero if there are no numbers", () => { assert.deepStrictEqual(Array.from(fcumsum([].map(box), unbox)), []); assert.deepStrictEqual(Array.from(fcumsum([NaN].map(box), unbox)), [0]); assert.deepStrictEqual(Array.from(fcumsum([undefined].map(box), unbox)), [0]); assert.deepStrictEqual(Array.from(fcumsum([undefined, NaN].map(box), unbox)), [0, 0]); assert.deepStrictEqual(Array.from(fcumsum([undefined, NaN, {}].map(box), unbox)), [0, 0, 0]); }); it("fcumsum(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; lastc(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("fcumsum(array, f) uses the undefined context", () => { const results = []; lastc([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } function lastc(values, valueof) { const array = fcumsum(values, valueof); return array[array.length -1]; } d3-array-3.1.1/test/filter-test.js000066400000000000000000000026441412622006300167170ustar00rootroot00000000000000import assert from "assert"; import * as d3 from "../src/index.js"; it("filter(values, test) returns the values that pass the test", () => { assert.deepStrictEqual(d3.filter([1, 2, 3, 2, 1], x => x & 1), [1, 3, 1]); }); it("filter(values, test) accepts an iterable", () => { assert.deepStrictEqual(d3.filter(new Set([1, 2, 3, 2, 1]), x => x & 1), [1, 3]); assert.deepStrictEqual(d3.filter((function*() { yield* [1, 2, 3, 2, 1]; })(), x => x & 1), [1, 3, 1]); }); it("filter(values, test) accepts a typed array", () => { assert.deepStrictEqual(d3.filter(Uint8Array.of(1, 2, 3, 2, 1), x => x & 1), [1, 3, 1]); }); it("filter(values, test) enforces that test is a function", () => { assert.throws(() => d3.filter([]), TypeError); }); it("filter(values, test) enforces that values is iterable", () => { assert.throws(() => d3.filter({}, () => true), TypeError); }); it("filter(values, test) passes test (value, index, values)", () => { const calls = []; const values = new Set([5, 4, 3, 2, 1]); d3.filter(values, function() { calls.push([this, ...arguments]); }); assert.deepStrictEqual(calls, [ [undefined, 5, 0, values], [undefined, 4, 1, values], [undefined, 3, 2, values], [undefined, 2, 3, values], [undefined, 1, 4, values] ]); }); it("filter(values, test) does not skip sparse elements", () => { assert.deepStrictEqual(d3.filter([, 1, 2,, ], () => true), [undefined, 1, 2, undefined]); }); d3-array-3.1.1/test/flatGroup-test.js000066400000000000000000000014551412622006300173740ustar00rootroot00000000000000import assert from "assert"; import {flatGroup} from "../src/index.js"; const data = [ {name: "jim", amount: "34.0", date: "11/12/2015"}, {name: "carl", amount: "120.11", date: "11/12/2015"}, {name: "stacy", amount: "12.01", date: "01/04/2016"}, {name: "stacy", amount: "34.05", date: "01/04/2016"} ]; it("flatGroup(data, accessor, accessor) returns the expected array", () => { assert.deepStrictEqual( flatGroup(data, d => d.name, d => d.amount), [ ['jim', '34.0', [{name: 'jim', amount: '34.0', date: '11/12/2015'}]], ['carl', '120.11', [{name: 'carl', amount: '120.11', date: '11/12/2015'}]], ['stacy', '12.01', [{name: 'stacy', amount: '12.01', date: '01/04/2016'}]], ['stacy', '34.05', [{name: 'stacy', amount: '34.05', date: '01/04/2016'}]] ] ); }); d3-array-3.1.1/test/flatRollup-test.js000066400000000000000000000015341412622006300175530ustar00rootroot00000000000000import assert from "assert"; import {flatRollup} from "../src/index.js"; const data = [ {name: "jim", amount: "34.0", date: "11/12/2015"}, {name: "carl", amount: "120.11", date: "11/12/2015"}, {name: "stacy", amount: "12.01", date: "01/04/2016"}, {name: "stacy", amount: "34.05", date: "01/04/2016"} ]; it("flatRollup(data, reduce, accessor) returns the expected array", () => { assert.deepStrictEqual( flatRollup(data, v => v.length, d => d.name), [ ['jim', 1], ['carl', 1], ['stacy', 2] ] ); }); it("flatRollup(data, reduce, accessor, accessor) returns the expected array", () => { assert.deepStrictEqual( flatRollup(data, v => v.length, d => d.name, d => d.amount), [ ['jim', '34.0', 1], ['carl', '120.11', 1], ['stacy', '12.01', 1], ['stacy', '34.05', 1] ] ); }); d3-array-3.1.1/test/fsum-test.js000066400000000000000000000100711412622006300163750ustar00rootroot00000000000000import assert from "assert"; import {Adder, fsum} from "../src/index.js"; it("new Adder() returns an Adder", () => { assert.strictEqual(typeof new Adder().add, "function"); assert.strictEqual(typeof new Adder().valueOf, "function"); }); it("+adder can be applied several times", () => { const adder = new Adder(); for (let i = 0; i < 10; ++i) adder.add(0.1); assert.strictEqual(+adder, 1); assert.strictEqual(+adder, 1); }); it("fsum(array) is an exact sum", () => { assert.strictEqual(fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]), 1); assert.strictEqual(fsum([.3, .3, .3, .3, .3, .3, .3, .3, .3, .3, -.3, -.3, -.3, -.3, -.3, -.3, -.3, -.3, -.3, -.3]), 0); assert.strictEqual(fsum(["20", "3"].map(box), unbox), 23); }); it("fsum(array) returns the fsum of the specified numbers", () => { assert.strictEqual(fsum([1]), 1); assert.strictEqual(fsum([5, 1, 2, 3, 4]), 15); assert.strictEqual(fsum([20, 3]), 23); assert.strictEqual(fsum([3, 20]), 23); }); it("fsum(array) observes values that can be coerced to numbers", () => { assert.strictEqual(fsum(["20", "3"]), 23); assert.strictEqual(fsum(["3", "20"]), 23); assert.strictEqual(fsum(["3", 20]), 23); assert.strictEqual(fsum([20, "3"]), 23); assert.strictEqual(fsum([3, "20"]), 23); assert.strictEqual(fsum(["20", 3]), 23); }); it("fsum(array) ignores non-numeric values", () => { assert.strictEqual(fsum(["a", "b", "c"]), 0); assert.strictEqual(fsum(["a", 1, "2"]), 3); }); it("fsum(array) ignores null, undefined and NaN", () => { assert.strictEqual(fsum([NaN, 1, 2, 3, 4, 5]), 15); assert.strictEqual(fsum([1, 2, 3, 4, 5, NaN]), 15); assert.strictEqual(fsum([10, null, 3, undefined, 5, NaN]), 18); }); it("fsum(array) returns zero if there are no numbers", () => { assert.strictEqual(fsum([]), 0); assert.strictEqual(fsum([NaN]), 0); assert.strictEqual(fsum([undefined]), 0); assert.strictEqual(fsum([undefined, NaN]), 0); assert.strictEqual(fsum([undefined, NaN, {}]), 0); }); it("fsum(array, f) returns the fsum of the specified numbers", () => { assert.strictEqual(fsum([1].map(box), unbox), 1); assert.strictEqual(fsum([5, 1, 2, 3, 4].map(box), unbox), 15); assert.strictEqual(fsum([20, 3].map(box), unbox), 23); assert.strictEqual(fsum([3, 20].map(box), unbox), 23); }); it("fsum(array, f) observes values that can be coerced to numbers", () => { assert.strictEqual(fsum(["20", "3"].map(box), unbox), 23); assert.strictEqual(fsum(["3", "20"].map(box), unbox), 23); assert.strictEqual(fsum(["3", 20].map(box), unbox), 23); assert.strictEqual(fsum([20, "3"].map(box), unbox), 23); assert.strictEqual(fsum([3, "20"].map(box), unbox), 23); assert.strictEqual(fsum(["20", 3].map(box), unbox), 23); }); it("fsum(array, f) ignores non-numeric values", () => { assert.strictEqual(fsum(["a", "b", "c"].map(box), unbox), 0); assert.strictEqual(fsum(["a", 1, "2"].map(box), unbox), 3); }); it("fsum(array, f) ignores null, undefined and NaN", () => { assert.strictEqual(fsum([NaN, 1, 2, 3, 4, 5].map(box), unbox), 15); assert.strictEqual(fsum([1, 2, 3, 4, 5, NaN].map(box), unbox), 15); assert.strictEqual(fsum([10, null, 3, undefined, 5, NaN].map(box), unbox), 18); }); it("fsum(array, f) returns zero if there are no numbers", () => { assert.strictEqual(fsum([].map(box), unbox), 0); assert.strictEqual(fsum([NaN].map(box), unbox), 0); assert.strictEqual(fsum([undefined].map(box), unbox), 0); assert.strictEqual(fsum([undefined, NaN].map(box), unbox), 0); assert.strictEqual(fsum([undefined, NaN, {}].map(box), unbox), 0); }); it("fsum(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; fsum(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("fsum(array, f) uses the undefined context", () => { const results = []; fsum([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/greatest-test.js000066400000000000000000000051161412622006300172450ustar00rootroot00000000000000import assert from "assert"; import {descending, greatest} from "../src/index.js"; it("greatest(array) compares using natural order", () => { assert.strictEqual(greatest([0, 1]), 1); assert.strictEqual(greatest([1, 0]), 1); assert.strictEqual(greatest([0, "1"]), "1"); assert.strictEqual(greatest(["1", 0]), "1"); assert.strictEqual(greatest(["10", "2"]), "2"); assert.strictEqual(greatest(["2", "10"]), "2"); assert.strictEqual(greatest(["10", "2", NaN]), "2"); assert.strictEqual(greatest([NaN, "10", "2"]), "2"); assert.strictEqual(greatest(["2", NaN, "10"]), "2"); assert.strictEqual(greatest([2, NaN, 10]), 10); assert.strictEqual(greatest([10, 2, NaN]), 10); assert.strictEqual(greatest([NaN, 10, 2]), 10); }); it("greatest(array, compare) compares using the specified compare function", () => { const a = {name: "a"}, b = {name: "b"}; assert.deepStrictEqual(greatest([a, b], (a, b) => a.name.localeCompare(b.name)), {name: "b"}); assert.strictEqual(greatest([1, 0], descending), 0); assert.strictEqual(greatest(["1", 0], descending), 0); assert.strictEqual(greatest(["2", "10"], descending), "10"); assert.strictEqual(greatest(["2", NaN, "10"], descending), "10"); assert.strictEqual(greatest([2, NaN, 10], descending), 2); }); it("greatest(array, accessor) uses the specified accessor function", () => { const a = {name: "a", v: 42}, b = {name: "b", v: 0.42}; assert.deepStrictEqual(greatest([a, b], d => d.name), b); assert.deepStrictEqual(greatest([a, b], d => d.v), a); }); it("greatest(array) returns undefined if the array is empty", () => { assert.strictEqual(greatest([]), undefined); }); it("greatest(array) returns undefined if the array contains only incomparable values", () => { assert.strictEqual(greatest([NaN, undefined]), undefined); assert.strictEqual(greatest([NaN, "foo"], (a, b) => a - b), undefined); }); it("greatest(array) returns the first of equal values", () => { assert.deepStrictEqual(greatest([2, 2, 1, 1, 0, 0, 0, 3, 0].map(box), descendingValue), {value: 0, index: 4}); assert.deepStrictEqual(greatest([3, 2, 2, 1, 1, 0, 0, 0, 3, 0].map(box), ascendingValue), {value: 3, index: 0}); }); it("greatest(array) ignores null and undefined", () => { assert.deepStrictEqual(greatest([null, -2, undefined]), -2); }); it("greatest(array, accessor) ignores null and undefined", () => { assert.deepStrictEqual(greatest([null, -2, undefined], d => d), -2); }); function box(value, index) { return {value, index}; } function ascendingValue(a, b) { return a.value - b.value; } function descendingValue(a, b) { return b.value - a.value; } d3-array-3.1.1/test/greatestIndex-test.js000066400000000000000000000046741412622006300202450ustar00rootroot00000000000000import assert from "assert"; import {ascending, descending, greatestIndex} from "../src/index.js"; it("greatestIndex(array) compares using natural order", () => { assert.strictEqual(greatestIndex([0, 1]), 1); assert.strictEqual(greatestIndex([1, 0]), 0); assert.strictEqual(greatestIndex([0, "1"]), 1); assert.strictEqual(greatestIndex(["1", 0]), 0); assert.strictEqual(greatestIndex(["10", "2"]), 1); assert.strictEqual(greatestIndex(["2", "10"]), 0); assert.strictEqual(greatestIndex(["10", "2", NaN]), 1); assert.strictEqual(greatestIndex([NaN, "10", "2"]), 2); assert.strictEqual(greatestIndex(["2", NaN, "10"]), 0); assert.strictEqual(greatestIndex([2, NaN, 10]), 2); assert.strictEqual(greatestIndex([10, 2, NaN]), 0); assert.strictEqual(greatestIndex([NaN, 10, 2]), 1); }); it("greatestIndex(array, compare) compares using the specified compare function", () => { const a = {name: "a"}, b = {name: "b"}; assert.strictEqual(greatestIndex([a, b], (a, b) => a.name.localeCompare(b.name)), 1); assert.strictEqual(greatestIndex([1, 0], ascending), 0); assert.strictEqual(greatestIndex(["1", 0], ascending), 0); assert.strictEqual(greatestIndex(["2", "10"], ascending), 0); assert.strictEqual(greatestIndex(["2", NaN, "10"], ascending), 0); assert.strictEqual(greatestIndex([2, NaN, 10], ascending), 2); }); it("greatestIndex(array, accessor) uses the specified accessor function", () => { const a = {name: "a", v: 42}, b = {name: "b", v: 0.42}; assert.deepStrictEqual(greatestIndex([a, b], d => d.name), 1); assert.deepStrictEqual(greatestIndex([a, b], d => d.v), 0); }); it("greatestIndex(array) returns -1 if the array is empty", () => { assert.strictEqual(greatestIndex([]), -1); }); it("greatestIndex(array) returns -1 if the array contains only incomparable values", () => { assert.strictEqual(greatestIndex([NaN, undefined]), -1); assert.strictEqual(greatestIndex([NaN, "foo"], (a, b) => a - b), -1); }); it("greatestIndex(array) returns the first of equal values", () => { assert.strictEqual(greatestIndex([-2, -2, -1, -1, 0, 0, 0, -3, 0]), 4); assert.strictEqual(greatestIndex([-3, -2, -2, -1, -1, 0, 0, 0, -3, 0], descending), 0); }); it("greatestIndex(array) ignores null and undefined", () => { assert.deepStrictEqual(greatestIndex([null, -2, undefined]), 1); }); it("greatestIndex(array, accessor) ignores null and undefined", () => { assert.deepStrictEqual(greatestIndex([null, -2, undefined], d => d), 1); }); d3-array-3.1.1/test/group-test.js000066400000000000000000000060261412622006300165640ustar00rootroot00000000000000import assert from "assert"; import {group} from "../src/index.js"; const data = [ {name: "jim", amount: "34.0", date: "11/12/2015"}, {name: "carl", amount: "120.11", date: "11/12/2015"}, {name: "stacy", amount: "12.01", date: "01/04/2016"}, {name: "stacy", amount: "34.05", date: "01/04/2016"} ]; it("group(data, accessor) returns the expected map", () => { assert.deepStrictEqual( entries(group(data, d => d.name), 1), [ [ "jim", [ { "name": "jim", "amount": "34.0", "date": "11/12/2015" } ] ], [ "carl", [ { "name": "carl", "amount": "120.11", "date": "11/12/2015" } ] ], [ "stacy", [ { "name": "stacy", "amount": "12.01", "date": "01/04/2016" }, { "name": "stacy", "amount": "34.05", "date": "01/04/2016" } ] ] ] ); }); it("group(data, accessor, accessor) returns the expected map", () => { assert.deepStrictEqual( entries(group(data, d => d.name, d => d.amount), 2), [ [ "jim", [ [ "34.0", [ { "name": "jim", "amount": "34.0", "date": "11/12/2015" } ] ] ] ], [ "carl", [ [ "120.11", [ { "name": "carl", "amount": "120.11", "date": "11/12/2015" } ] ] ] ], [ "stacy", [ [ "12.01", [ { "name": "stacy", "amount": "12.01", "date": "01/04/2016" } ] ], [ "34.05", [ { "name": "stacy", "amount": "34.05", "date": "01/04/2016" } ] ] ] ] ] ); }); it("group(data, accessor) interns keys", () => { const a1 = new Date(Date.UTC(2001, 0, 1)); const a2 = new Date(Date.UTC(2001, 0, 1)); const b = new Date(Date.UTC(2002, 0, 1)); const map = group([[a1, 1], [a2, 2], [b, 3]], ([date]) => date); assert.deepStrictEqual(map.get(a1), [[a1, 1], [a2, 2]]); assert.deepStrictEqual(map.get(a2), [[a1, 1], [a2, 2]]); assert.deepStrictEqual(map.get(b), [[b, 3]]); assert.deepStrictEqual(map.get(+a1), [[a1, 1], [a2, 2]]); assert.deepStrictEqual(map.get(+a2), [[a1, 1], [a2, 2]]); assert.deepStrictEqual(map.get(+b), [[b, 3]]); assert.strictEqual([...map.keys()][0], a1); assert.strictEqual([...map.keys()][1], b); }); function entries(map, depth) { if (depth > 0) { return Array.from(map, ([k, v]) => [k, entries(v, depth - 1)]); } else { return map; } } d3-array-3.1.1/test/groupSort-test.js000066400000000000000000000050371412622006300174350ustar00rootroot00000000000000import assert from "assert"; import {readFileSync} from "fs"; import {ascending, descending, groupSort, median} from "../src/index.js"; const barley = JSON.parse(readFileSync("./test/data/barley.json")); it("groupSort(data, reduce, key) returns sorted keys when reduce is an accessor", () => { assert.deepStrictEqual( groupSort(barley, g => median(g, d => d.yield), d => d.variety), ["Svansota", "No. 462", "Manchuria", "No. 475", "Velvet", "Peatland", "Glabron", "No. 457", "Wisconsin No. 38", "Trebi"] ); assert.deepStrictEqual( groupSort(barley, g => -median(g, d => d.yield), d => d.variety), ["Trebi", "Wisconsin No. 38", "No. 457", "Glabron", "Peatland", "Velvet", "No. 475", "Manchuria", "No. 462", "Svansota"] ); assert.deepStrictEqual( groupSort(barley, g => median(g, d => -d.yield), d => d.variety), ["Trebi", "Wisconsin No. 38", "No. 457", "Glabron", "Peatland", "Velvet", "No. 475", "Manchuria", "No. 462", "Svansota"] ); assert.deepStrictEqual( groupSort(barley, g => median(g, d => d.yield), d => d.site), ["Grand Rapids", "Duluth", "University Farm", "Morris", "Crookston", "Waseca"] ); assert.deepStrictEqual( groupSort(barley, g => -median(g, d => d.yield), d => d.site), ["Waseca", "Crookston", "Morris", "University Farm", "Duluth", "Grand Rapids"] ); assert.deepStrictEqual( groupSort(barley, g => median(g, d => -d.yield), d => d.site), ["Waseca", "Crookston", "Morris", "University Farm", "Duluth", "Grand Rapids"] ); }); it("groupSort(data, reduce, key) returns sorted keys when reduce is a comparator", () => { assert.deepStrictEqual( groupSort(barley, (a, b) => ascending(median(a, d => d.yield), median(b, d => d.yield)), d => d.variety), ["Svansota", "No. 462", "Manchuria", "No. 475", "Velvet", "Peatland", "Glabron", "No. 457", "Wisconsin No. 38", "Trebi"] ); assert.deepStrictEqual( groupSort(barley, (a, b) => descending(median(a, d => d.yield), median(b, d => d.yield)), d => d.variety), ["Trebi", "Wisconsin No. 38", "No. 457", "Glabron", "Peatland", "Velvet", "No. 475", "Manchuria", "No. 462", "Svansota"] ); assert.deepStrictEqual( groupSort(barley, (a, b) => ascending(median(a, d => d.yield), median(b, d => d.yield)), d => d.site), ["Grand Rapids", "Duluth", "University Farm", "Morris", "Crookston", "Waseca"] ); assert.deepStrictEqual( groupSort(barley, (a, b) => descending(median(a, d => d.yield), median(b, d => d.yield)), d => d.site), ["Waseca", "Crookston", "Morris", "University Farm", "Duluth", "Grand Rapids"] ); }); d3-array-3.1.1/test/groups-test.js000066400000000000000000000043061412622006300167460ustar00rootroot00000000000000import assert from "assert"; import {groups} from "../src/index.js"; const data = [ {name: "jim", amount: "34.0", date: "11/12/2015"}, {name: "carl", amount: "120.11", date: "11/12/2015"}, {name: "stacy", amount: "12.01", date: "01/04/2016"}, {name: "stacy", amount: "34.05", date: "01/04/2016"} ]; it("groups(data, accessor) returns the expected array", () => { assert.deepStrictEqual( groups(data, d => d.name), [ [ "jim", [ { "name": "jim", "amount": "34.0", "date": "11/12/2015" } ] ], [ "carl", [ { "name": "carl", "amount": "120.11", "date": "11/12/2015" } ] ], [ "stacy", [ { "name": "stacy", "amount": "12.01", "date": "01/04/2016" }, { "name": "stacy", "amount": "34.05", "date": "01/04/2016" } ] ] ] ); }); it("groups(data, accessor, accessor) returns the expected array", () => { assert.deepStrictEqual( groups(data, d => d.name, d => d.amount), [ [ "jim", [ [ "34.0", [ { "name": "jim", "amount": "34.0", "date": "11/12/2015" } ] ] ] ], [ "carl", [ [ "120.11", [ { "name": "carl", "amount": "120.11", "date": "11/12/2015" } ] ] ] ], [ "stacy", [ [ "12.01", [ { "name": "stacy", "amount": "12.01", "date": "01/04/2016" } ] ], [ "34.05", [ { "name": "stacy", "amount": "34.05", "date": "01/04/2016" } ] ] ] ] ] ); }); d3-array-3.1.1/test/index-test.js000066400000000000000000000035051412622006300165360ustar00rootroot00000000000000import assert from "assert"; import {index, indexes} from "../src/index.js"; const data = [ {name: "jim", amount: 34.0, date: "11/12/2015"}, {name: "carl", amount: 120.11, date: "11/12/2015"}, {name: "stacy", amount: 12.01, date: "01/04/2016"}, {name: "stacy", amount: 34.05, date: "01/04/2016"} ]; it("indexes(data, ...keys) returns the expected nested arrays", () => { assert.deepStrictEqual( indexes(data, d => d.amount), [ [34.0, {name: "jim", amount: 34.0, date: "11/12/2015"}], [120.11, {name: "carl", amount: 120.11, date: "11/12/2015"}], [12.01, {name: "stacy", amount: 12.01, date: "01/04/2016"}], [34.05, {name: "stacy", amount: 34.05, date: "01/04/2016"}] ] ); assert.deepStrictEqual( indexes(data, d => d.name, d => d.amount), [ [ "jim", [ [34.0, {name: "jim", amount: 34.0, date: "11/12/2015"}] ] ], [ "carl", [ [120.11, {name: "carl", amount: 120.11, date: "11/12/2015"}] ] ], [ "stacy", [ [12.01, {name: "stacy", amount: 12.01, date: "01/04/2016"}], [34.05, {name: "stacy", amount: 34.05, date: "01/04/2016"}] ] ] ] ); }); it("index(data, ...keys) returns the expected map", () => { assert.deepStrictEqual( entries(index(data, d => d.amount), 1), indexes(data, d => d.amount) ); assert.deepStrictEqual( entries(index(data, d => d.name, d => d.amount), 2), indexes(data, d => d.name, d => d.amount) ); }); it("index(data, ...keys) throws on a non-unique key", () => { assert.throws(() => index(data, d => d.name)); assert.throws(() => index(data, d => d.date)); }); function entries(map, depth) { return depth > 0 ? Array.from(map, ([k, v]) => [k, entries(v, depth - 1)]) : map; } d3-array-3.1.1/test/intersection-test.js000066400000000000000000000015571412622006300201420ustar00rootroot00000000000000import {intersection} from "../src/index.js"; import {assertSetEqual} from "./asserts.js"; it("intersection(values) returns a set of values", () => { assertSetEqual(intersection([1, 2, 3, 2, 1]), [1, 2, 3]); }); it("intersection(values, other) returns a set of values", () => { assertSetEqual(intersection([1, 2], [2, 3, 1]), [1, 2]); assertSetEqual(intersection([2, 1, 3], [4, 3, 1]), [1, 3]); }); it("intersection(...values) returns a set of values", () => { assertSetEqual(intersection([1, 2], [2, 1], [2, 3]), [2]); }); it("intersection(...values) accepts iterables", () => { assertSetEqual(intersection(new Set([1, 2, 3])), [1, 2, 3]); }); it("intersection(...values) performs interning", () => { assertSetEqual(intersection([new Date("2021-01-01"), new Date("2021-01-03")], [new Date("2021-01-01"), new Date("2021-01-02")]), [new Date("2021-01-01")]); }); d3-array-3.1.1/test/least-test.js000066400000000000000000000047351412622006300165450ustar00rootroot00000000000000import assert from "assert"; import {descending, least} from "../src/index.js"; it("least(array) compares using natural order", () => { assert.strictEqual(least([0, 1]), 0); assert.strictEqual(least([1, 0]), 0); assert.strictEqual(least([0, "1"]), 0); assert.strictEqual(least(["1", 0]), 0); assert.strictEqual(least(["10", "2"]), "10"); assert.strictEqual(least(["2", "10"]), "10"); assert.strictEqual(least(["10", "2", NaN]), "10"); assert.strictEqual(least([NaN, "10", "2"]), "10"); assert.strictEqual(least(["2", NaN, "10"]), "10"); assert.strictEqual(least([2, NaN, 10]), 2); assert.strictEqual(least([10, 2, NaN]), 2); assert.strictEqual(least([NaN, 10, 2]), 2); }); it("least(array, compare) compares using the specified compare function", () => { const a = {name: "a"}, b = {name: "b"}; assert.deepStrictEqual(least([a, b], (a, b) => a.name.localeCompare(b.name)), {name: "a"}); assert.strictEqual(least([1, 0], descending), 1); assert.strictEqual(least(["1", 0], descending), "1"); assert.strictEqual(least(["2", "10"], descending), "2"); assert.strictEqual(least(["2", NaN, "10"], descending), "2"); assert.strictEqual(least([2, NaN, 10], descending), 10); }); it("least(array, accessor) uses the specified accessor function", () => { const a = {name: "a", v: 42}, b = {name: "b", v: 0.42}; assert.deepStrictEqual(least([a, b], d => d.name), a); assert.deepStrictEqual(least([a, b], d => d.v), b); }); it("least(array) returns undefined if the array is empty", () => { assert.strictEqual(least([]), undefined); }); it("least(array) returns undefined if the array contains only incomparable values", () => { assert.strictEqual(least([NaN, undefined]), undefined); assert.strictEqual(least([NaN, "foo"], (a, b) => a - b), undefined); }); it("least(array) returns the first of equal values", () => { assert.deepStrictEqual(least([2, 2, 1, 1, 0, 0, 0, 3, 0].map(box), ascendingValue), {value: 0, index: 4}); assert.deepStrictEqual(least([3, 2, 2, 1, 1, 0, 0, 0, 3, 0].map(box), descendingValue), {value: 3, index: 0}); }); it("least(array) ignores null and undefined", () => { assert.deepStrictEqual(least([null, 2, undefined]), 2); }); it("least(array, accessor) ignores null and undefined", () => { assert.deepStrictEqual(least([null, 2, undefined], d => d), 2); }); function box(value, index) { return {value, index}; } function ascendingValue(a, b) { return a.value - b.value; } function descendingValue(a, b) { return b.value - a.value; } d3-array-3.1.1/test/leastIndex-test.js000066400000000000000000000044751412622006300175360ustar00rootroot00000000000000import assert from "assert"; import {descending, leastIndex} from "../src/index.js"; it("leastIndex(array) compares using natural order", () => { assert.strictEqual(leastIndex([0, 1]), 0); assert.strictEqual(leastIndex([1, 0]), 1); assert.strictEqual(leastIndex([0, "1"]), 0); assert.strictEqual(leastIndex(["1", 0]), 1); assert.strictEqual(leastIndex(["10", "2"]), 0); assert.strictEqual(leastIndex(["2", "10"]), 1); assert.strictEqual(leastIndex(["10", "2", NaN]), 0); assert.strictEqual(leastIndex([NaN, "10", "2"]), 1); assert.strictEqual(leastIndex(["2", NaN, "10"]), 2); assert.strictEqual(leastIndex([2, NaN, 10]), 0); assert.strictEqual(leastIndex([10, 2, NaN]), 1); assert.strictEqual(leastIndex([NaN, 10, 2]), 2); }); it("leastIndex(array, compare) compares using the specified compare function", () => { const a = {name: "a"}, b = {name: "b"}; assert.strictEqual(leastIndex([a, b], (a, b) => a.name.localeCompare(b.name)), 0); assert.strictEqual(leastIndex([1, 0], descending), 0); assert.strictEqual(leastIndex(["1", 0], descending), 0); assert.strictEqual(leastIndex(["2", "10"], descending), 0); assert.strictEqual(leastIndex(["2", NaN, "10"], descending), 0); assert.strictEqual(leastIndex([2, NaN, 10], descending), 2); }); it("leastIndex(array, accessor) uses the specified accessor function", () => { const a = {name: "a", v: 42}, b = {name: "b", v: 0.42}; assert.deepStrictEqual(leastIndex([a, b], d => d.name), 0); assert.deepStrictEqual(leastIndex([a, b], d => d.v), 1); }); it("leastIndex(array) returns -1 if the array is empty", () => { assert.strictEqual(leastIndex([]), -1); }); it("leastIndex(array) returns -1 if the array contains only incomparable values", () => { assert.strictEqual(leastIndex([NaN, undefined]), -1); assert.strictEqual(leastIndex([NaN, "foo"], (a, b) => a - b), -1); }); it("leastIndex(array) returns the first of equal values", () => { assert.strictEqual(leastIndex([2, 2, 1, 1, 0, 0, 0, 3, 0]), 4); assert.strictEqual(leastIndex([3, 2, 2, 1, 1, 0, 0, 0, 3, 0], descending), 0); }); it("leastIndex(array) ignores null and undefined", () => { assert.deepStrictEqual(leastIndex([null, 2, undefined]), 1); }); it("leastIndex(array, accessor) ignores null and undefined", () => { assert.deepStrictEqual(leastIndex([null, 2, undefined], d => d), 1); }); d3-array-3.1.1/test/map-test.js000066400000000000000000000025501412622006300162030ustar00rootroot00000000000000import assert from "assert"; import {map} from "../src/index.js"; it("map(values, mapper) returns the mapped values", () => { assert.deepStrictEqual(map([1, 2, 3, 2, 1], x => x * 2), [2, 4, 6, 4, 2]); }); it("map(values, mapper) accepts an iterable", () => { assert.deepStrictEqual(map(new Set([1, 2, 3, 2, 1]), x => x * 2), [2, 4, 6]); assert.deepStrictEqual(map((function*() { yield* [1, 2, 3, 2, 1]; })(), x => x * 2), [2, 4, 6, 4, 2]); }); it("map(values, mapper) accepts a typed array", () => { assert.deepStrictEqual(map(Uint8Array.of(1, 2, 3, 2, 1), x => x * 2), [2, 4, 6, 4, 2]); }); it("map(values, mapper) enforces that test is a function", () => { assert.throws(() => map([]), TypeError); }); it("map(values, mapper) enforces that values is iterable", () => { assert.throws(() => map({}, () => true), TypeError); }); it("map(values, mapper) passes test (value, index, values)", () => { const calls = []; const values = new Set([5, 4, 3, 2, 1]); map(values, function() { calls.push([this, ...arguments]); }); assert.deepStrictEqual(calls, [ [undefined, 5, 0, values], [undefined, 4, 1, values], [undefined, 3, 2, values], [undefined, 2, 3, values], [undefined, 1, 4, values] ]); }); it("map(values, mapper) does not skip sparse elements", () => { assert.deepStrictEqual(map([, 1, 2,, ], x => x * 2), [NaN, 2, 4, NaN]); }); d3-array-3.1.1/test/max-test.js000066400000000000000000000076421412622006300162220ustar00rootroot00000000000000import assert from "assert"; import {max} from "../src/index.js"; it("max(array) returns the greatest numeric value for numbers", () => { assert.deepStrictEqual(max([1]), 1); assert.deepStrictEqual(max([5, 1, 2, 3, 4]), 5); assert.deepStrictEqual(max([20, 3]), 20); assert.deepStrictEqual(max([3, 20]), 20); }); it("max(array) returns the greatest lexicographic value for strings", () => { assert.deepStrictEqual(max(["c", "a", "b"]), "c"); assert.deepStrictEqual(max(["20", "3"]), "3"); assert.deepStrictEqual(max(["3", "20"]), "3"); }); it("max(array) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(max([NaN, 1, 2, 3, 4, 5]), 5); assert.deepStrictEqual(max([o, 1, 2, 3, 4, 5]), 5); assert.deepStrictEqual(max([1, 2, 3, 4, 5, NaN]), 5); assert.deepStrictEqual(max([1, 2, 3, 4, 5, o]), 5); assert.deepStrictEqual(max([10, null, 3, undefined, 5, NaN]), 10); assert.deepStrictEqual(max([-1, null, -3, undefined, -5, NaN]), -1); }); it("max(array) compares heterogenous types as numbers", () => { assert.strictEqual(max([20, "3"]), 20); assert.strictEqual(max(["20", 3]), "20"); assert.strictEqual(max([3, "20"]), "20"); assert.strictEqual(max(["3", 20]), 20); }); it("max(array) returns undefined if the array contains no numbers", () => { assert.strictEqual(max([]), undefined); assert.strictEqual(max([null]), undefined); assert.strictEqual(max([undefined]), undefined); assert.strictEqual(max([NaN]), undefined); assert.strictEqual(max([NaN, NaN]), undefined); }); it("max(array, f) returns the greatest numeric value for numbers", () => { assert.deepStrictEqual(max([1].map(box), unbox), 1); assert.deepStrictEqual(max([5, 1, 2, 3, 4].map(box), unbox), 5); assert.deepStrictEqual(max([20, 3].map(box), unbox), 20); assert.deepStrictEqual(max([3, 20].map(box), unbox), 20); }); it("max(array, f) returns the greatest lexicographic value for strings", () => { assert.deepStrictEqual(max(["c", "a", "b"].map(box), unbox), "c"); assert.deepStrictEqual(max(["20", "3"].map(box), unbox), "3"); assert.deepStrictEqual(max(["3", "20"].map(box), unbox), "3"); }); it("max(array, f) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(max([NaN, 1, 2, 3, 4, 5].map(box), unbox), 5); assert.deepStrictEqual(max([o, 1, 2, 3, 4, 5].map(box), unbox), 5); assert.deepStrictEqual(max([1, 2, 3, 4, 5, NaN].map(box), unbox), 5); assert.deepStrictEqual(max([1, 2, 3, 4, 5, o].map(box), unbox), 5); assert.deepStrictEqual(max([10, null, 3, undefined, 5, NaN].map(box), unbox), 10); assert.deepStrictEqual(max([-1, null, -3, undefined, -5, NaN].map(box), unbox), -1); }); it("max(array, f) compares heterogenous types as numbers", () => { assert.strictEqual(max([20, "3"].map(box), unbox), 20); assert.strictEqual(max(["20", 3].map(box), unbox), "20"); assert.strictEqual(max([3, "20"].map(box), unbox), "20"); assert.strictEqual(max(["3", 20].map(box), unbox), 20); }); it("max(array, f) returns undefined if the array contains no observed values", () => { assert.strictEqual(max([].map(box), unbox), undefined); assert.strictEqual(max([null].map(box), unbox), undefined); assert.strictEqual(max([undefined].map(box), unbox), undefined); assert.strictEqual(max([NaN].map(box), unbox), undefined); assert.strictEqual(max([NaN, NaN].map(box), unbox), undefined); }); it("max(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; max(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("max(array, f) uses the undefined context", () => { const results = []; max([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/maxIndex-test.js000066400000000000000000000101361412622006300172020ustar00rootroot00000000000000import assert from "assert"; import {maxIndex} from "../src/index.js"; it("maxIndex(array) returns the index of the greatest numeric value for numbers", () => { assert.deepStrictEqual(maxIndex([1]), 0); assert.deepStrictEqual(maxIndex([5, 1, 2, 3, 4]), 0); assert.deepStrictEqual(maxIndex([20, 3]), 0); assert.deepStrictEqual(maxIndex([3, 20]), 1); }); it("maxIndex(array) returns the greatest lexicographic value for strings", () => { assert.deepStrictEqual(maxIndex(["c", "a", "b"]), 0); assert.deepStrictEqual(maxIndex(["20", "3"]), 1); assert.deepStrictEqual(maxIndex(["3", "20"]), 0); }); it("maxIndex(array) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(maxIndex([NaN, 1, 2, 3, 4, 5]), 5); assert.deepStrictEqual(maxIndex([o, 1, 2, 3, 4, 5]), 5); assert.deepStrictEqual(maxIndex([1, 2, 3, 4, 5, NaN]), 4); assert.deepStrictEqual(maxIndex([1, 2, 3, 4, 5, o]), 4); assert.deepStrictEqual(maxIndex([10, null, 3, undefined, 5, NaN]), 0); assert.deepStrictEqual(maxIndex([-1, null, -3, undefined, -5, NaN]), 0); }); it("maxIndex(array) compares heterogenous types as numbers", () => { assert.strictEqual(maxIndex([20, "3"]), 0); assert.strictEqual(maxIndex(["20", 3]), 0); assert.strictEqual(maxIndex([3, "20"]), 1); assert.strictEqual(maxIndex(["3", 20]), 1); }); it("maxIndex(array) returns -1 if the array contains no numbers", () => { assert.strictEqual(maxIndex([]), -1); assert.strictEqual(maxIndex([null]), -1); assert.strictEqual(maxIndex([undefined]), -1); assert.strictEqual(maxIndex([NaN]), -1); assert.strictEqual(maxIndex([NaN, NaN]), -1); }); it("maxIndex(array, f) returns the greatest numeric value for numbers", () => { assert.deepStrictEqual(maxIndex([1].map(box), unbox), 0); assert.deepStrictEqual(maxIndex([5, 1, 2, 3, 4].map(box), unbox), 0); assert.deepStrictEqual(maxIndex([20, 3].map(box), unbox), 0); assert.deepStrictEqual(maxIndex([3, 20].map(box), unbox), 1); }); it("maxIndex(array, f) returns the greatest lexicographic value for strings", () => { assert.deepStrictEqual(maxIndex(["c", "a", "b"].map(box), unbox), 0); assert.deepStrictEqual(maxIndex(["20", "3"].map(box), unbox), 1); assert.deepStrictEqual(maxIndex(["3", "20"].map(box), unbox), 0); }); it("maxIndex(array, f) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(maxIndex([NaN, 1, 2, 3, 4, 5].map(box), unbox), 5); assert.deepStrictEqual(maxIndex([o, 1, 2, 3, 4, 5].map(box), unbox), 5); assert.deepStrictEqual(maxIndex([1, 2, 3, 4, 5, NaN].map(box), unbox), 4); assert.deepStrictEqual(maxIndex([1, 2, 3, 4, 5, o].map(box), unbox), 4); assert.deepStrictEqual(maxIndex([10, null, 3, undefined, 5, NaN].map(box), unbox), 0); assert.deepStrictEqual(maxIndex([-1, null, -3, undefined, -5, NaN].map(box), unbox), 0); }); it("maxIndex(array, f) compares heterogenous types as numbers", () => { assert.strictEqual(maxIndex([20, "3"].map(box), unbox), 0); assert.strictEqual(maxIndex(["20", 3].map(box), unbox), 0); assert.strictEqual(maxIndex([3, "20"].map(box), unbox), 1); assert.strictEqual(maxIndex(["3", 20].map(box), unbox), 1); }); it("maxIndex(array, f) returns -1 if the array contains no observed values", () => { assert.strictEqual(maxIndex([].map(box), unbox), -1); assert.strictEqual(maxIndex([null].map(box), unbox), -1); assert.strictEqual(maxIndex([undefined].map(box), unbox), -1); assert.strictEqual(maxIndex([NaN].map(box), unbox), -1); assert.strictEqual(maxIndex([NaN, NaN].map(box), unbox), -1); }); it("maxIndex(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; maxIndex(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("maxIndex(array, f) uses the undefined context", () => { const results = []; maxIndex([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/mean-test.js000066400000000000000000000065641412622006300163570ustar00rootroot00000000000000import assert from "assert"; import {mean} from "../src/index.js"; import {OneTimeNumber} from "./OneTimeNumber.js"; it("mean(array) returns the mean value for numbers", () => { assert.strictEqual(mean([1]), 1); assert.strictEqual(mean([5, 1, 2, 3, 4]), 3); assert.strictEqual(mean([20, 3]), 11.5); assert.strictEqual(mean([3, 20]), 11.5); }); it("mean(array) ignores null, undefined and NaN", () => { assert.strictEqual(mean([NaN, 1, 2, 3, 4, 5]), 3); assert.strictEqual(mean([1, 2, 3, 4, 5, NaN]), 3); assert.strictEqual(mean([10, null, 3, undefined, 5, NaN]), 6); }); it("mean(array) returns undefined if the array contains no observed values", () => { assert.strictEqual(mean([]), undefined); assert.strictEqual(mean([null]), undefined); assert.strictEqual(mean([undefined]), undefined); assert.strictEqual(mean([NaN]), undefined); assert.strictEqual(mean([NaN, NaN]), undefined); }); it("mean(array) coerces values to numbers", () => { assert.strictEqual(mean(["1"]), 1); assert.strictEqual(mean(["5", "1", "2", "3", "4"]), 3); assert.strictEqual(mean(["20", "3"]), 11.5); assert.strictEqual(mean(["3", "20"]), 11.5); }); it("mean(array) coerces values exactly once", () => { const numbers = [1, new OneTimeNumber(3)]; assert.strictEqual(mean(numbers), 2); assert.strictEqual(mean(numbers), 1); }); it("mean(array, f) returns the mean value for numbers", () => { assert.strictEqual(mean([1].map(box), unbox), 1); assert.strictEqual(mean([5, 1, 2, 3, 4].map(box), unbox), 3); assert.strictEqual(mean([20, 3].map(box), unbox), 11.5); assert.strictEqual(mean([3, 20].map(box), unbox), 11.5); }); it("mean(array, f) ignores null, undefined and NaN", () => { assert.strictEqual(mean([NaN, 1, 2, 3, 4, 5].map(box), unbox), 3); assert.strictEqual(mean([1, 2, 3, 4, 5, NaN].map(box), unbox), 3); assert.strictEqual(mean([10, null, 3, undefined, 5, NaN].map(box), unbox), 6); }); it("mean(array, f) returns undefined if the array contains no observed values", () => { assert.strictEqual(mean([].map(box), unbox), undefined); assert.strictEqual(mean([null].map(box), unbox), undefined); assert.strictEqual(mean([undefined].map(box), unbox), undefined); assert.strictEqual(mean([NaN].map(box), unbox), undefined); assert.strictEqual(mean([NaN, NaN].map(box), unbox), undefined); }); it("mean(array, f) coerces values to numbers", () => { assert.strictEqual(mean(["1"].map(box), unbox), 1); assert.strictEqual(mean(["5", "1", "2", "3", "4"].map(box), unbox), 3); assert.strictEqual(mean(["20", "3"].map(box), unbox), 11.5); assert.strictEqual(mean(["3", "20"].map(box), unbox), 11.5); }); it("mean(array, f) coerces values exactly once", () => { const numbers = [1, new OneTimeNumber(3)].map(box); assert.strictEqual(mean(numbers, unbox), 2); assert.strictEqual(mean(numbers, unbox), 1); }); it("mean(array, f) passes the accessor d, i, and array", () => { const results = []; const strings = ["a", "b", "c"]; mean(strings, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, strings], ["b", 1, strings], ["c", 2, strings]]); }); it("mean(array, f) uses the undefined context", () => { const results = []; mean([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/median-test.js000066400000000000000000000104041412622006300166600ustar00rootroot00000000000000import assert from "assert"; import {median} from "../src/index.js"; import {OneTimeNumber} from "./OneTimeNumber.js"; it("median(array) returns the median value for numbers", () => { assert.strictEqual(median([1]), 1); assert.strictEqual(median([5, 1, 2, 3]), 2.5); assert.strictEqual(median([5, 1, 2, 3, 4]), 3); assert.strictEqual(median([20, 3]), 11.5); assert.strictEqual(median([3, 20]), 11.5); }); it("median(array) ignores null, undefined and NaN", () => { assert.strictEqual(median([NaN, 1, 2, 3, 4, 5]), 3); assert.strictEqual(median([1, 2, 3, 4, 5, NaN]), 3); assert.strictEqual(median([10, null, 3, undefined, 5, NaN]), 5); }); it("median(array) can handle large numbers without overflowing", () => { assert.strictEqual(median([Number.MAX_VALUE, Number.MAX_VALUE]), Number.MAX_VALUE); assert.strictEqual(median([-Number.MAX_VALUE, -Number.MAX_VALUE]), -Number.MAX_VALUE); }); it("median(array) returns undefined if the array contains no observed values", () => { assert.strictEqual(median([]), undefined); assert.strictEqual(median([null]), undefined); assert.strictEqual(median([undefined]), undefined); assert.strictEqual(median([NaN]), undefined); assert.strictEqual(median([NaN, NaN]), undefined); }); it("median(array) coerces strings to numbers", () => { assert.strictEqual(median(["1"]), 1); assert.strictEqual(median(["5", "1", "2", "3", "4"]), 3); assert.strictEqual(median(["20", "3"]), 11.5); assert.strictEqual(median(["3", "20"]), 11.5); assert.strictEqual(median(["2", "3", "20"]), 3); assert.strictEqual(median(["20", "3", "2"]), 3); }); it("median(array) coerces values exactly once", () => { const array = [1, new OneTimeNumber(3)]; assert.strictEqual(median(array), 2); assert.strictEqual(median(array), 1); }); it("median(array, f) returns the median value for numbers", () => { assert.strictEqual(median([1].map(box), unbox), 1); assert.strictEqual(median([5, 1, 2, 3, 4].map(box), unbox), 3); assert.strictEqual(median([20, 3].map(box), unbox), 11.5); assert.strictEqual(median([3, 20].map(box), unbox), 11.5); }); it("median(array, f) ignores null, undefined and NaN", () => { assert.strictEqual(median([NaN, 1, 2, 3, 4, 5].map(box), unbox), 3); assert.strictEqual(median([1, 2, 3, 4, 5, NaN].map(box), unbox), 3); assert.strictEqual(median([10, null, 3, undefined, 5, NaN].map(box), unbox), 5); }); it("median(array, f) can handle large numbers without overflowing", () => { assert.strictEqual(median([Number.MAX_VALUE, Number.MAX_VALUE].map(box), unbox), Number.MAX_VALUE); assert.strictEqual(median([-Number.MAX_VALUE, -Number.MAX_VALUE].map(box), unbox), -Number.MAX_VALUE); }); it("median(array, f) returns undefined if the array contains no observed values", () => { assert.strictEqual(median([].map(box), unbox), undefined); assert.strictEqual(median([null].map(box), unbox), undefined); assert.strictEqual(median([undefined].map(box), unbox), undefined); assert.strictEqual(median([NaN].map(box), unbox), undefined); assert.strictEqual(median([NaN, NaN].map(box), unbox), undefined); }); it("median(array, f) coerces strings to numbers", () => { assert.strictEqual(median(["1"].map(box), unbox), 1); assert.strictEqual(median(["5", "1", "2", "3", "4"].map(box), unbox), 3); assert.strictEqual(median(["20", "3"].map(box), unbox), 11.5); assert.strictEqual(median(["3", "20"].map(box), unbox), 11.5); assert.strictEqual(median(["2", "3", "20"].map(box), unbox), 3); assert.strictEqual(median(["20", "3", "2"].map(box), unbox), 3); }); it("median(array, f) coerces values exactly once", () => { const array = [1, new OneTimeNumber(3)].map(box); assert.strictEqual(median(array, unbox), 2); assert.strictEqual(median(array, unbox), 1); }); it("median(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; median(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("median(array, f) uses the undefined context", () => { const results = []; median([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/merge-test.js000066400000000000000000000027121412622006300165250ustar00rootroot00000000000000import assert from "assert"; import {merge} from "../src/index.js"; it("merge(arrays) merges an array of arrays", () => { const a = {}, b = {}, c = {}, d = {}, e = {}, f = {}; assert.deepStrictEqual(merge([[a], [b, c], [d, e, f]]), [a, b, c, d, e, f]); }); it("merge(arrays) returns a new array when zero arrays are passed", () => { const input = []; const output = merge(input); assert.deepStrictEqual(output, []); input.push([0.1]); assert.deepStrictEqual(input, [[0.1]]); assert.deepStrictEqual(output, []); }); it("merge(arrays) returns a new array when one array is passed", () => { const input = [[1, 2, 3]]; const output = merge(input); assert.deepStrictEqual(output, [1, 2, 3]); input.push([4.1]); input[0].push(3.1); assert.deepStrictEqual(input, [[1, 2, 3, 3.1], [4.1]]); assert.deepStrictEqual(output, [1, 2, 3]); }); it("merge(arrays) returns a new array when two or more arrays are passed", () => { const input = [[1, 2, 3], [4, 5], [6]]; const output = merge(input); assert.deepStrictEqual(output, [1, 2, 3, 4, 5, 6]); input.push([7.1]); input[0].push(3.1); input[1].push(5.1); input[2].push(6.1); assert.deepStrictEqual(input, [[1, 2, 3, 3.1], [4, 5, 5.1], [6, 6.1], [7.1]]); assert.deepStrictEqual(output, [1, 2, 3, 4, 5, 6]); }); it("merge(arrays) does not modify the input arrays", () => { const input = [[1, 2, 3], [4, 5], [6]]; merge(input); assert.deepStrictEqual(input, [[1, 2, 3], [4, 5], [6]]); }); d3-array-3.1.1/test/min-test.js000066400000000000000000000076141412622006300162170ustar00rootroot00000000000000import assert from "assert"; import {min} from "../src/index.js"; it("min(array) returns the least numeric value for numbers", () => { assert.deepStrictEqual(min([1]), 1); assert.deepStrictEqual(min([5, 1, 2, 3, 4]), 1); assert.deepStrictEqual(min([20, 3]), 3); assert.deepStrictEqual(min([3, 20]), 3); }); it("min(array) returns the least lexicographic value for strings", () => { assert.deepStrictEqual(min(["c", "a", "b"]), "a"); assert.deepStrictEqual(min(["20", "3"]), "20"); assert.deepStrictEqual(min(["3", "20"]), "20"); }); it("min(array) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(min([NaN, 1, 2, 3, 4, 5]), 1); assert.deepStrictEqual(min([o, 1, 2, 3, 4, 5]), 1); assert.deepStrictEqual(min([1, 2, 3, 4, 5, NaN]), 1); assert.deepStrictEqual(min([1, 2, 3, 4, 5, o]), 1); assert.deepStrictEqual(min([10, null, 3, undefined, 5, NaN]), 3); assert.deepStrictEqual(min([-1, null, -3, undefined, -5, NaN]), -5); }); it("min(array) compares heterogenous types as numbers", () => { assert.strictEqual(min([20, "3"]), "3"); assert.strictEqual(min(["20", 3]), 3); assert.strictEqual(min([3, "20"]), 3); assert.strictEqual(min(["3", 20]), "3"); }); it("min(array) returns undefined if the array contains no numbers", () => { assert.strictEqual(min([]), undefined); assert.strictEqual(min([null]), undefined); assert.strictEqual(min([undefined]), undefined); assert.strictEqual(min([NaN]), undefined); assert.strictEqual(min([NaN, NaN]), undefined); }); it("min(array, f) returns the least numeric value for numbers", () => { assert.deepStrictEqual(min([1].map(box), unbox), 1); assert.deepStrictEqual(min([5, 1, 2, 3, 4].map(box), unbox), 1); assert.deepStrictEqual(min([20, 3].map(box), unbox), 3); assert.deepStrictEqual(min([3, 20].map(box), unbox), 3); }); it("min(array, f) returns the least lexicographic value for strings", () => { assert.deepStrictEqual(min(["c", "a", "b"].map(box), unbox), "a"); assert.deepStrictEqual(min(["20", "3"].map(box), unbox), "20"); assert.deepStrictEqual(min(["3", "20"].map(box), unbox), "20"); }); it("min(array, f) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(min([NaN, 1, 2, 3, 4, 5].map(box), unbox), 1); assert.deepStrictEqual(min([o, 1, 2, 3, 4, 5].map(box), unbox), 1); assert.deepStrictEqual(min([1, 2, 3, 4, 5, NaN].map(box), unbox), 1); assert.deepStrictEqual(min([1, 2, 3, 4, 5, o].map(box), unbox), 1); assert.deepStrictEqual(min([10, null, 3, undefined, 5, NaN].map(box), unbox), 3); assert.deepStrictEqual(min([-1, null, -3, undefined, -5, NaN].map(box), unbox), -5); }); it("min(array, f) compares heterogenous types as numbers", () => { assert.strictEqual(min([20, "3"].map(box), unbox), "3"); assert.strictEqual(min(["20", 3].map(box), unbox), 3); assert.strictEqual(min([3, "20"].map(box), unbox), 3); assert.strictEqual(min(["3", 20].map(box), unbox), "3"); }); it("min(array, f) returns undefined if the array contains no observed values", () => { assert.strictEqual(min([].map(box), unbox), undefined); assert.strictEqual(min([null].map(box), unbox), undefined); assert.strictEqual(min([undefined].map(box), unbox), undefined); assert.strictEqual(min([NaN].map(box), unbox), undefined); assert.strictEqual(min([NaN, NaN].map(box), unbox), undefined); }); it("min(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; min(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("min(array, f) uses the undefined context", () => { const results = []; min([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/minIndex-test.js000066400000000000000000000101711412622006300171770ustar00rootroot00000000000000import assert from "assert"; import {minIndex} from "../src/index.js"; it("minIndex(array) returns the index of the least numeric value for numbers", () => { assert.deepStrictEqual(minIndex([1]), 0); assert.deepStrictEqual(minIndex([5, 1, 2, 3, 4]), 1); assert.deepStrictEqual(minIndex([20, 3]), 1); assert.deepStrictEqual(minIndex([3, 20]), 0); }); it("minIndex(array) returns the index of the least lexicographic value for strings", () => { assert.deepStrictEqual(minIndex(["c", "a", "b"]), 1); assert.deepStrictEqual(minIndex(["20", "3"]), 0); assert.deepStrictEqual(minIndex(["3", "20"]), 1); }); it("minIndex(array) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(minIndex([NaN, 1, 2, 3, 4, 5]), 1); assert.deepStrictEqual(minIndex([o, 1, 2, 3, 4, 5]), 1); assert.deepStrictEqual(minIndex([1, 2, 3, 4, 5, NaN]), 0); assert.deepStrictEqual(minIndex([1, 2, 3, 4, 5, o]), 0); assert.deepStrictEqual(minIndex([10, null, 3, undefined, 5, NaN]), 2); assert.deepStrictEqual(minIndex([-1, null, -3, undefined, -5, NaN]), 4); }); it("minIndex(array) compares heterogenous types as numbers", () => { assert.strictEqual(minIndex([20, "3"]), 1); assert.strictEqual(minIndex(["20", 3]), 1); assert.strictEqual(minIndex([3, "20"]), 0); assert.strictEqual(minIndex(["3", 20]), 0); }); it("minIndex(array) returns -1 if the array contains no numbers", () => { assert.strictEqual(minIndex([]), -1); assert.strictEqual(minIndex([null]), -1); assert.strictEqual(minIndex([undefined]), -1); assert.strictEqual(minIndex([NaN]), -1); assert.strictEqual(minIndex([NaN, NaN]), -1); }); it("minIndex(array, f) returns the index of the least numeric value for numbers", () => { assert.deepStrictEqual(minIndex([1].map(box), unbox), 0); assert.deepStrictEqual(minIndex([5, 1, 2, 3, 4].map(box), unbox), 1); assert.deepStrictEqual(minIndex([20, 3].map(box), unbox), 1); assert.deepStrictEqual(minIndex([3, 20].map(box), unbox), 0); }); it("minIndex(array, f) returns the index of the least lexicographic value for strings", () => { assert.deepStrictEqual(minIndex(["c", "a", "b"].map(box), unbox), 1); assert.deepStrictEqual(minIndex(["20", "3"].map(box), unbox), 0); assert.deepStrictEqual(minIndex(["3", "20"].map(box), unbox), 1); }); it("minIndex(array, f) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.deepStrictEqual(minIndex([NaN, 1, 2, 3, 4, 5].map(box), unbox), 1); assert.deepStrictEqual(minIndex([o, 1, 2, 3, 4, 5].map(box), unbox), 1); assert.deepStrictEqual(minIndex([1, 2, 3, 4, 5, NaN].map(box), unbox), 0); assert.deepStrictEqual(minIndex([1, 2, 3, 4, 5, o].map(box), unbox), 0); assert.deepStrictEqual(minIndex([10, null, 3, undefined, 5, NaN].map(box), unbox), 2); assert.deepStrictEqual(minIndex([-1, null, -3, undefined, -5, NaN].map(box), unbox), 4); }); it("minIndex(array, f) compares heterogenous types as numbers", () => { assert.strictEqual(minIndex([20, "3"].map(box), unbox), 1); assert.strictEqual(minIndex(["20", 3].map(box), unbox), 1); assert.strictEqual(minIndex([3, "20"].map(box), unbox), 0); assert.strictEqual(minIndex(["3", 20].map(box), unbox), 0); }); it("minIndex(array, f) returns -1 if the array contains no observed values", () => { assert.strictEqual(minIndex([].map(box), unbox), -1); assert.strictEqual(minIndex([null].map(box), unbox), -1); assert.strictEqual(minIndex([undefined].map(box), unbox), -1); assert.strictEqual(minIndex([NaN].map(box), unbox), -1); assert.strictEqual(minIndex([NaN, NaN].map(box), unbox), -1); }); it("minIndex(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; minIndex(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("minIndex(array, f) uses the undefined context", () => { const results = []; minIndex([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/mode-test.js000066400000000000000000000073431412622006300163570ustar00rootroot00000000000000import assert from "assert"; import {mode} from "../src/index.js"; it("mode(array) returns the most frequent value for numbers", () => { assert.strictEqual(mode([1]), 1); assert.strictEqual(mode([5, 1, 1, 3, 4]), 1); }); it("mode(array) returns the most frequent value for strings", () => { assert.strictEqual(mode(["1"]), "1"); assert.strictEqual(mode(["5", "1", "1", "3", "4"]), "1"); }); it("mode(array) returns the most frequent value for heterogenous types", () => { assert.strictEqual(mode(["1"]), "1"); assert.strictEqual(mode(["5", "1", "1", 2, 2, "2", 1, 1, 1, "3", "4"]), 1); assert.strictEqual(mode(["5", 2, 2, "2", "2", 1, 1, 1, "3", "4"]), 1); }); it("mode(array) returns the first of the most frequent values", () => { assert.strictEqual(mode(["5", "1", "1", "2", "2", "3", "4"]), "1"); }); it("mode(array) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.strictEqual(mode([NaN, 1, 1, 3, 4, 5]), 1); assert.strictEqual(mode([o, 1, null, null, 1, null]), 1); assert.strictEqual(mode([1, NaN, NaN, 1, 5, NaN]), 1); assert.strictEqual(mode([1, o, o, 1, 5, o]), 1); assert.strictEqual(mode([1, undefined, undefined, 1, 5, undefined]), 1); }); it("mode(array) returns undefined if the array contains no comparable values", () => { assert.strictEqual(mode([]), undefined); assert.strictEqual(mode([null]), undefined); assert.strictEqual(mode([undefined]), undefined); assert.strictEqual(mode([NaN]), undefined); assert.strictEqual(mode([NaN, NaN]), undefined); }); it("mode(array, f) returns the most frequent value for numbers", () => { assert.strictEqual(mode([1].map(box), unbox), 1); assert.strictEqual(mode([5, 1, 1, 3, 4].map(box), unbox), 1); }); it("mode(array, f) returns the most frequent value for strings", () => { assert.strictEqual(mode(["1"].map(box), unbox), "1"); assert.strictEqual(mode(["5", "1", "1", "3", "4"].map(box), unbox), "1"); }); it("mode(array, f) returns the most frequent value for heterogenous types", () => { assert.strictEqual(mode(["1"].map(box), unbox), "1"); assert.strictEqual(mode(["5", "1", "1", 2, 2, "2", 1, 1, 1, "3", "4"].map(box), unbox), 1); }); it("mode(array, f) returns the first of the most frequent values", () => { assert.strictEqual(mode(["5", "1", "1", "2", "2", "3", "4"].map(box), unbox), "1"); }); it("mode(array, f) ignores null, undefined and NaN", () => { const o = {valueOf: () => NaN}; assert.strictEqual(mode([NaN, 1, 1, 3, 4, 5].map(box), unbox), 1); assert.strictEqual(mode([o, 1, null, null, 1, null].map(box), unbox), 1); assert.strictEqual(mode([1, NaN, NaN, 1, 5, NaN].map(box), unbox), 1); assert.strictEqual(mode([1, o, o, 1, 5, o].map(box), unbox), 1); assert.strictEqual(mode([1, undefined, undefined, 1, 5, undefined].map(box), unbox), 1); }); it("mode(array, f) returns undefined if the array contains no comparable values", () => { assert.strictEqual(mode([].map(box), unbox), undefined); assert.strictEqual(mode([null].map(box), unbox), undefined); assert.strictEqual(mode([undefined].map(box), unbox), undefined); assert.strictEqual(mode([NaN].map(box), unbox), undefined); assert.strictEqual(mode([NaN, NaN].map(box), unbox), undefined); }); it("mode(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; mode(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("mode(array, f) uses the undefined context", () => { const results = []; mode([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/nice-test.js000066400000000000000000000041031412622006300163400ustar00rootroot00000000000000import assert from "assert"; import {nice} from "../src/index.js"; it("nice(start, stop, count) returns [start, stop] if any argument is NaN", () => { assert.deepStrictEqual(nice(NaN, 1, 1), [NaN, 1]); assert.deepStrictEqual(nice(0, NaN, 1), [0, NaN]); assert.deepStrictEqual(nice(0, 1, NaN), [0, 1]); assert.deepStrictEqual(nice(NaN, NaN, 1), [NaN, NaN]); assert.deepStrictEqual(nice(0, NaN, NaN), [0, NaN]); assert.deepStrictEqual(nice(NaN, 1, NaN), [NaN, 1]); assert.deepStrictEqual(nice(NaN, NaN, NaN), [NaN, NaN]); }); it("nice(start, stop, count) returns [start, stop] if start === stop", () => { assert.deepStrictEqual(nice(1, 1, -1), [1, 1]); assert.deepStrictEqual(nice(1, 1, 0), [1, 1]); assert.deepStrictEqual(nice(1, 1, NaN), [1, 1]); assert.deepStrictEqual(nice(1, 1, 1), [1, 1]); assert.deepStrictEqual(nice(1, 1, 10), [1, 1]); }); it("nice(start, stop, count) returns [start, stop] if count is not positive", () => { assert.deepStrictEqual(nice(0, 1, -1), [0, 1]); assert.deepStrictEqual(nice(0, 1, 0), [0, 1]); }); it("nice(start, stop, count) returns [start, stop] if count is infinity", () => { assert.deepStrictEqual(nice(0, 1, Infinity), [0, 1]); }); it("nice(start, stop, count) returns the expected values", () => { assert.deepStrictEqual(nice(0.132, 0.876, 1000), [0.132, 0.876]); assert.deepStrictEqual(nice(0.132, 0.876, 100), [0.13, 0.88]); assert.deepStrictEqual(nice(0.132, 0.876, 30), [0.12, 0.88]); assert.deepStrictEqual(nice(0.132, 0.876, 10), [0.1, 0.9]); assert.deepStrictEqual(nice(0.132, 0.876, 6), [0.1, 0.9]); assert.deepStrictEqual(nice(0.132, 0.876, 5), [0, 1]); assert.deepStrictEqual(nice(0.132, 0.876, 1), [0, 1]); assert.deepStrictEqual(nice(132, 876, 1000), [132, 876]); assert.deepStrictEqual(nice(132, 876, 100), [130, 880]); assert.deepStrictEqual(nice(132, 876, 30), [120, 880]); assert.deepStrictEqual(nice(132, 876, 10), [100, 900]); assert.deepStrictEqual(nice(132, 876, 6), [100, 900]); assert.deepStrictEqual(nice(132, 876, 5), [0, 1000]); assert.deepStrictEqual(nice(132, 876, 1), [0, 1000]); }); d3-array-3.1.1/test/pairs-test.js000066400000000000000000000016661412622006300165530ustar00rootroot00000000000000import assert from "assert"; import {pairs} from "../src/index.js"; it("pairs(array) returns the empty array if input array has fewer than two elements", () => { assert.deepStrictEqual(pairs([]), []); assert.deepStrictEqual(pairs([1]), []); }); it("pairs(array) returns pairs of adjacent elements in the given array", () => { const a = {}, b = {}, c = {}, d = {}; assert.deepStrictEqual(pairs([1, 2]), [[1, 2]]); assert.deepStrictEqual(pairs([1, 2, 3]), [[1, 2], [2, 3]]); assert.deepStrictEqual(pairs([a, b, c, d]), [[a, b], [b, c], [c, d]]); }); it("pairs(array, f) invokes the function f for each pair of adjacent elements", () => { assert.deepStrictEqual(pairs([1, 3, 7], (a, b) => b - a), [2, 4]); }); it("pairs(array) includes null or undefined elements in pairs", () => { assert.deepStrictEqual(pairs([1, null, 2]), [[1, null], [null, 2]]); assert.deepStrictEqual(pairs([1, 2, undefined]), [[1, 2], [2, undefined]]); }); d3-array-3.1.1/test/permute-test.js000066400000000000000000000037211412622006300171100ustar00rootroot00000000000000import assert from "assert"; import {permute} from "../src/index.js"; it("permute(…) permutes according to the specified index", () => { assert.deepStrictEqual(permute([3, 4, 5], [2, 1, 0]), [5, 4, 3]); assert.deepStrictEqual(permute([3, 4, 5], [2, 0, 1]), [5, 3, 4]); assert.deepStrictEqual(permute([3, 4, 5], [0, 1, 2]), [3, 4, 5]); }); it("permute(…) does not modify the input array", () => { const input = [3, 4, 5]; permute(input, [2, 1, 0]); assert.deepStrictEqual(input, [3, 4, 5]); }); it("permute(…) can duplicate input values", () => { assert.deepStrictEqual(permute([3, 4, 5], [0, 1, 0]), [3, 4, 3]); assert.deepStrictEqual(permute([3, 4, 5], [2, 2, 2]), [5, 5, 5]); assert.deepStrictEqual(permute([3, 4, 5], [0, 1, 1]), [3, 4, 4]); }); it("permute(…) can return more elements", () => { assert.deepStrictEqual(permute([3, 4, 5], [0, 0, 1, 2]), [3, 3, 4, 5]); assert.deepStrictEqual(permute([3, 4, 5], [0, 1, 1, 1]), [3, 4, 4, 4]); }); it("permute(…) can return fewer elements", () => { assert.deepStrictEqual(permute([3, 4, 5], [0]), [3]); assert.deepStrictEqual(permute([3, 4, 5], [1, 2]), [4, 5]); assert.deepStrictEqual(permute([3, 4, 5], []), []); }); it("permute(…) can return undefined elements", () => { assert.deepStrictEqual(permute([3, 4, 5], [10]), [undefined]); assert.deepStrictEqual(permute([3, 4, 5], [-1]), [undefined]); assert.deepStrictEqual(permute([3, 4, 5], [0, -1]), [3, undefined]); }); it("permute(…) can take an object as the source", () => { assert.deepStrictEqual(permute({foo: 1, bar: 2}, ["bar", "foo"]), [2, 1]); }); it("permute(…) can take a typed array as the source", () => { assert.deepStrictEqual(permute(Float32Array.of(1, 2), [0, 0, 1, 0]), [1, 1, 2, 1]); assert.strictEqual(Array.isArray(permute(Float32Array.of(1, 2), [0])), true); }); it("permute(…) can take an iterable as the keys", () => { assert.deepStrictEqual(permute({foo: 1, bar: 2}, new Set(["bar", "foo"])), [2, 1]); }); d3-array-3.1.1/test/quantile-test.js000066400000000000000000000072171412622006300172550ustar00rootroot00000000000000import assert from "assert"; import {quantile, quantileSorted} from "../src/index.js"; it("quantileSorted(array, p) requires sorted numeric input, quantile doesn't", () => { assert.strictEqual(quantileSorted([1, 2, 3, 4], 0), 1); assert.strictEqual(quantileSorted([1, 2, 3, 4], 1), 4); assert.strictEqual(quantileSorted([4, 3, 2, 1], 0), 4); assert.strictEqual(quantileSorted([4, 3, 2, 1], 1), 1); assert.strictEqual(quantile([1, 2, 3, 4], 0), 1); assert.strictEqual(quantile([1, 2, 3, 4], 1), 4); assert.strictEqual(quantile([4, 3, 2, 1], 0), 1); assert.strictEqual(quantile([4, 3, 2, 1], 1), 4); }); it("quantile() accepts an iterable", () => { assert.strictEqual(quantile(new Set([1, 2, 3, 4]), 1), 4); }); it("quantile(array, p) uses the R-7 method", () => { const even = [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]; assert.strictEqual(quantile(even, 0), 3); assert.strictEqual(quantile(even, 0.25), 7.25); assert.strictEqual(quantile(even, 0.5), 9); assert.strictEqual(quantile(even, 0.75), 14.5); assert.strictEqual(quantile(even, 1), 20); const odd = [3, 6, 7, 8, 8, 9, 10, 13, 15, 16, 20]; assert.strictEqual(quantile(odd, 0), 3); assert.strictEqual(quantile(odd, 0.25), 7.5); assert.strictEqual(quantile(odd, 0.5), 9); assert.strictEqual(quantile(odd, 0.75), 14); assert.strictEqual(quantile(odd, 1), 20); }); it("quantile(array, p) coerces values to numbers", () => { const strings = ["1", "2", "3", "4"]; assert.strictEqual(quantile(strings, 1 / 3), 2); assert.strictEqual(quantile(strings, 1 / 2), 2.5); assert.strictEqual(quantile(strings, 2 / 3), 3); const dates = [new Date(Date.UTC(2011, 0, 1)), new Date(Date.UTC(2012, 0, 1))]; assert.strictEqual(quantile(dates, 0), +new Date(Date.UTC(2011, 0, 1))); assert.strictEqual(quantile(dates, 1 / 2), +new Date(Date.UTC(2011, 6, 2, 12))); assert.strictEqual(quantile(dates, 1), +new Date(Date.UTC(2012, 0, 1))); }); it("quantile(array, p) returns an exact value for integer p-values", () => { const data = [1, 2, 3, 4]; assert.strictEqual(quantile(data, 1 / 3), 2); assert.strictEqual(quantile(data, 2 / 3), 3); }); it("quantile(array, p) returns the expected value for integer or fractional p", () => { const data = [3, 1, 2, 4, 0]; assert.strictEqual(quantile(data, 0 / 4), 0); assert.strictEqual(quantile(data, 0.1 / 4), 0.1); assert.strictEqual(quantile(data, 1 / 4), 1); assert.strictEqual(quantile(data, 1.5 / 4), 1.5); assert.strictEqual(quantile(data, 2 / 4), 2); assert.strictEqual(quantile(data, 2.5 / 4), 2.5); assert.strictEqual(quantile(data, 3 / 4), 3); assert.strictEqual(quantile(data, 3.2 / 4), 3.2); assert.strictEqual(quantile(data, 4 / 4), 4); }); it("quantile(array, p) returns the first value for p = 0", () => { const data = [1, 2, 3, 4]; assert.strictEqual(quantile(data, 0), 1); }); it("quantile(array, p) returns the last value for p = 1", () => { const data = [1, 2, 3, 4]; assert.strictEqual(quantile(data, 1), 4); }); it("quantile(array, p, f) observes the specified accessor", () => { assert.strictEqual(quantile([1, 2, 3, 4].map(box), 0.5, unbox), 2.5); assert.strictEqual(quantile([1, 2, 3, 4].map(box), 0, unbox), 1); assert.strictEqual(quantile([1, 2, 3, 4].map(box), 1, unbox), 4); assert.strictEqual(quantile([2].map(box), 0, unbox), 2); assert.strictEqual(quantile([2].map(box), 0.5, unbox), 2); assert.strictEqual(quantile([2].map(box), 1, unbox), 2); assert.strictEqual(quantile([], 0, unbox), undefined); assert.strictEqual(quantile([], 0.5, unbox), undefined); assert.strictEqual(quantile([], 1, unbox), undefined); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/range-test.js000066400000000000000000000134161412622006300165250ustar00rootroot00000000000000import assert from "assert"; import {range} from "../src/index.js"; it("range(stop) returns [0, 1, 2, … stop - 1]", () => { assert.deepStrictEqual(range(5), [0, 1, 2, 3, 4]); assert.deepStrictEqual(range(2.01), [0, 1, 2]); assert.deepStrictEqual(range(1), [0]); assert.deepStrictEqual(range(.5), [0]); }); it("range(stop) returns an empty array if stop <= 0", () => { assert.deepStrictEqual(range(0), []); assert.deepStrictEqual(range(-0.5), []); assert.deepStrictEqual(range(-1), []); }); it("range(stop) returns an empty array if stop is NaN", () => { assert.deepStrictEqual(range(NaN), []); assert.deepStrictEqual(range(), []); }); it("range(start, stop) returns [start, start + 1, … stop - 1]", () => { assert.deepStrictEqual(range(0, 5), [0, 1, 2, 3, 4]); assert.deepStrictEqual(range(2, 5), [2, 3, 4]); assert.deepStrictEqual(range(2.5, 5), [2.5, 3.5, 4.5]); assert.deepStrictEqual(range(-1, 3), [-1, 0, 1, 2]); }); it("range(start, stop) returns an empty array if start or stop is NaN", () => { assert.deepStrictEqual(range(0, NaN), []); assert.deepStrictEqual(range(1, NaN), []); assert.deepStrictEqual(range(-1, NaN), []); assert.deepStrictEqual(range(0, undefined), []); assert.deepStrictEqual(range(1, undefined), []); assert.deepStrictEqual(range(-1, undefined), []); assert.deepStrictEqual(range(NaN, 0), []); assert.deepStrictEqual(range(NaN, 1), []); assert.deepStrictEqual(range(NaN, -1), []); assert.deepStrictEqual(range(undefined, 0), []); assert.deepStrictEqual(range(undefined, 1), []); assert.deepStrictEqual(range(undefined, -1), []); assert.deepStrictEqual(range(NaN, NaN), []); assert.deepStrictEqual(range(undefined, undefined), []); }); it("range(start, stop) returns an empty array if start >= stop", () => { assert.deepStrictEqual(range(0, 0), []); assert.deepStrictEqual(range(5, 5), []); assert.deepStrictEqual(range(6, 5), []); assert.deepStrictEqual(range(10, 10), []); assert.deepStrictEqual(range(20, 10), []); }); it("range(start, stop, step) returns [start, start + step, start + 2 * step, … stop - step]", () => { assert.deepStrictEqual(range(0, 5, 1), [0, 1, 2, 3, 4]); assert.deepStrictEqual(range(0, 5, 2), [0, 2, 4]); assert.deepStrictEqual(range(2, 5, 2), [2, 4]); assert.deepStrictEqual(range(-1, 3, 2), [-1, 1]); }); it("range(start, stop, step) allows a negative step", () => { assert.deepStrictEqual(range(5, 0, -1), [5, 4, 3, 2, 1]); assert.deepStrictEqual(range(5, 0, -2), [5, 3, 1]); assert.deepStrictEqual(range(5, 2, -2), [5, 3]); assert.deepStrictEqual(range(3, -1, -2), [3, 1]); }); it("range(start, stop, step) returns an empty array if start >= stop and step > 0", () => { assert.deepStrictEqual(range(5, 5, 2), []); assert.deepStrictEqual(range(6, 5, 2), []); assert.deepStrictEqual(range(10, 10, 1), []); assert.deepStrictEqual(range(10, 10, 0.5), []); assert.deepStrictEqual(range(0, 0, 1), []); assert.deepStrictEqual(range(0, 0, 0.5), []); assert.deepStrictEqual(range(20, 10, 2), []); assert.deepStrictEqual(range(20, 10, 1), []); assert.deepStrictEqual(range(20, 10, 0.5), []); }); it("range(start, stop, step) returns an empty array if start >= stop and step < 0", () => { assert.deepStrictEqual(range(5, 5, -2), []); assert.deepStrictEqual(range(5, 6, -2), []); assert.deepStrictEqual(range(10, 10, -1), []); assert.deepStrictEqual(range(10, 10, -0.5), []); assert.deepStrictEqual(range(0, 0, -1), []); assert.deepStrictEqual(range(0, 0, -0.5), []); assert.deepStrictEqual(range(10, 20, -2), []); assert.deepStrictEqual(range(10, 20, -1), []); assert.deepStrictEqual(range(10, 20, -0.5), []); }); it("range(start, stop, step) returns an empty array if start, stop or step is NaN", () => { assert.deepStrictEqual(range(NaN, 3, 2), []); assert.deepStrictEqual(range(3, NaN, 2), []); assert.deepStrictEqual(range(0, 5, NaN), []); assert.deepStrictEqual(range(NaN, NaN, NaN), []); assert.deepStrictEqual(range(NaN, NaN, NaN), []); assert.deepStrictEqual(range(undefined, undefined, undefined), []); assert.deepStrictEqual(range(0, 10, NaN), []); assert.deepStrictEqual(range(10, 0, NaN), []); assert.deepStrictEqual(range(0, 10, undefined), []); assert.deepStrictEqual(range(10, 0, undefined), []); }); it("range(start, stop, step) returns an empty array if step is zero", () => { assert.deepStrictEqual(range(0, 5, 0), []); }); it("range(start, stop, step) returns exactly [start + step * i, …] for fractional steps", () => { assert.deepStrictEqual(range(0, 0.5, 0.1), [0 + 0.1 * 0, 0 + 0.1 * 1, 0 + 0.1 * 2, 0 + 0.1 * 3, 0 + 0.1 * 4]); assert.deepStrictEqual(range(0.5, 0, -0.1), [0.5 - 0.1 * 0, 0.5 - 0.1 * 1, 0.5 - 0.1 * 2, 0.5 - 0.1 * 3, 0.5 - 0.1 * 4]); assert.deepStrictEqual(range(-2, -1.2, 0.1), [-2 + 0.1 * 0, -2 + 0.1 * 1, -2 + 0.1 * 2, -2 + 0.1 * 3, -2 + 0.1 * 4, -2 + 0.1 * 5, -2 + 0.1 * 6, -2 + 0.1 * 7]); assert.deepStrictEqual(range(-1.2, -2, -0.1), [-1.2 - 0.1 * 0, -1.2 - 0.1 * 1, -1.2 - 0.1 * 2, -1.2 - 0.1 * 3, -1.2 - 0.1 * 4, -1.2 - 0.1 * 5, -1.2 - 0.1 * 6, -1.2 - 0.1 * 7]); }); it("range(start, stop, step) returns exactly [start + step * i, …] for very small fractional steps", () => { assert.deepStrictEqual(range(2.1e-31, 5e-31, 1.1e-31), [2.1e-31 + 1.1e-31 * 0, 2.1e-31 + 1.1e-31 * 1, 2.1e-31 + 1.1e-31 * 2]); assert.deepStrictEqual(range(5e-31, 2.1e-31, -1.1e-31), [5e-31 - 1.1e-31 * 0, 5e-31 - 1.1e-31 * 1, 5e-31 - 1.1e-31 * 2]); }); it("range(start, stop, step) returns exactly [start + step * i, …] for very large fractional steps", () => { assert.deepStrictEqual(range(1e300, 2e300, 0.3e300), [1e300 + 0.3e300 * 0, 1e300 + 0.3e300 * 1, 1e300 + 0.3e300 * 2, 1e300 + 0.3e300 * 3]); assert.deepStrictEqual(range(2e300, 1e300, -0.3e300), [2e300 - 0.3e300 * 0, 2e300 - 0.3e300 * 1, 2e300 - 0.3e300 * 2, 2e300 - 0.3e300 * 3]); }); `` d3-array-3.1.1/test/rank-test.js000066400000000000000000000047631412622006300163710ustar00rootroot00000000000000import assert from "assert"; import ascending from "../src/ascending.js"; import descending from "../src/descending.js"; import rank from "../src/rank.js"; it("rank(numbers) returns the rank of numbers", () => { assert.deepStrictEqual(rank([1000, 10, 0]), Float64Array.of(2, 1, 0)); assert.deepStrictEqual(rank([1.2, 1.1, 1.2, 1.0, 1.5, 1.2]), Float64Array.of(2, 1, 2, 0, 5, 2)); }); it("rank(strings) returns the rank of letters", () => { assert.deepStrictEqual(rank([..."EDGFCBA"]), Float64Array.of(4, 3, 6, 5, 2, 1, 0)); assert.deepStrictEqual(rank("EDGFCBA"), Float64Array.of(4, 3, 6, 5, 2, 1, 0)); }); it("rank(dates) returns the rank of Dates", () => { assert.deepStrictEqual(rank([new Date("2000-01-01"), new Date("2000-01-01"), new Date("1999-01-01"), new Date("2001-01-01")]), Float64Array.of(1, 1, 0, 3)); }); it("rank(iterator) accepts an iterator", () => { assert.deepStrictEqual(rank(new Set(["B", "C", "A"])), Float64Array.of(1, 2, 0)); }); it("rank(undefineds) ranks undefined as NaN", () => { assert.deepStrictEqual(rank([1.2, 1.1, undefined, 1.0, undefined, 1.5]), Float64Array.of(2, 1, NaN, 0, NaN, 3)); assert.deepStrictEqual(rank([, null, , 1.2, 1.1, undefined, 1.0, NaN, 1.5]), Float64Array.of(NaN, NaN, NaN, 2, 1, NaN, 0, NaN, 3)); }); it("rank(values, valueof) accepts an accessor", () => { assert.deepStrictEqual(rank([{x: 3}, {x: 1}, {x: 2}, {x: 4}, {}], d => d.x), Float64Array.of(2, 0, 1, 3, NaN)); }); it("rank(values, compare) accepts a comparator", () => { assert.deepStrictEqual(rank([{x: 3}, {x: 1}, {x: 2}, {x: 4}, {}], (a, b) => a.x - b.x), Float64Array.of(2, 0, 1, 3, NaN)); assert.deepStrictEqual(rank([{x: 3}, {x: 1}, {x: 2}, {x: 4}, {}], (a, b) => b.x - a.x), Float64Array.of(1, 3, 2, 0, NaN)); assert.deepStrictEqual(rank(["aa", "ba", "bc", "bb", "ca"], (a, b) => ascending(a[0], b[0]) || ascending(a[1], b[1])), Float64Array.of(0, 1, 3, 2, 4)); assert.deepStrictEqual(rank(["A", null, "B", "C", "D"], descending), Float64Array.of(3, NaN, 2, 1, 0)); }); it("rank(values) computes the ties as expected", () => { assert.deepStrictEqual(rank(["a", "b", "b", "b", "c"]), Float64Array.of(0, 1, 1, 1, 4)); assert.deepStrictEqual(rank(["a", "b", "b", "b", "b", "c"]), Float64Array.of(0, 1, 1, 1, 1, 5)); }); it("rank(values) handles NaNs as expected", () => { assert.deepStrictEqual(rank(["a", "b", "b", "b", "c", null]), Float64Array.of(0, 1, 1, 1, 4, NaN)); assert.deepStrictEqual(rank(["a", "b", "b", "b", "b", "c", null]), Float64Array.of(0, 1, 1, 1, 1, 5, NaN)); }); d3-array-3.1.1/test/reduce-test.js000066400000000000000000000044671412622006300167060ustar00rootroot00000000000000import assert from "assert"; import {reduce} from "../src/index.js"; it("reduce(values, reducer) returns the reduced value", () => { assert.strictEqual(reduce([1, 2, 3, 2, 1], (p, v) => p + v), 9); assert.strictEqual(reduce([1, 2], (p, v) => p + v), 3); assert.strictEqual(reduce([1], (p, v) => p + v), 1); assert.strictEqual(reduce([], (p, v) => p + v), undefined); }); it("reduce(values, reducer, initial) returns the reduced value", () => { assert.strictEqual(reduce([1, 2, 3, 2, 1], (p, v) => p + v, 0), 9); assert.strictEqual(reduce([1], (p, v) => p + v, 0), 1); assert.strictEqual(reduce([], (p, v) => p + v, 0), 0); assert.deepStrictEqual(reduce([1, 2, 3, 2, 1], (p, v) => p.concat(v), []), [1, 2, 3, 2, 1]); }); it("reduce(values, reducer) accepts an iterable", () => { assert.strictEqual(reduce(new Set([1, 2, 3, 2, 1]), (p, v) => p + v), 6); assert.strictEqual(reduce((function*() { yield* [1, 2, 3, 2, 1]; })(), (p, v) => p + v), 9); assert.strictEqual(reduce(Uint8Array.of(1, 2, 3, 2, 1), (p, v) => p + v), 9); }); it("reduce(values, reducer) enforces that test is a function", () => { assert.throws(() => reduce([]), TypeError); }); it("reduce(values, reducer) enforces that values is iterable", () => { assert.throws(() => reduce({}, () => true), TypeError); }); it("reduce(values, reducer) passes reducer (reduced, value, index, values)", () => { const calls = []; const values = new Set([5, 4, 3, 2, 1]); reduce(values, function(p, v) { calls.push([this, ...arguments]); return p + v; }); assert.deepStrictEqual(calls, [ [undefined, 5, 4, 1, values], [undefined, 9, 3, 2, values], [undefined, 12, 2, 3, values], [undefined, 14, 1, 4, values] ]); }); it("reduce(values, reducer, initial) passes reducer (reduced, value, index, values)", () => { const calls = []; const values = new Set([5, 4, 3, 2, 1]); reduce(values, function(p, v) { calls.push([this, ...arguments]); return p + v; }, 0); assert.deepStrictEqual(calls, [ [undefined, 0, 5, 0, values], [undefined, 5, 4, 1, values], [undefined, 9, 3, 2, values], [undefined, 12, 2, 3, values], [undefined, 14, 1, 4, values] ]); }); it("reduce(values, reducer, initial) does not skip sparse elements", () => { assert.strictEqual(reduce([, 1, 2,, ], (p, v) => p + (v === undefined ? -1 : v), 0), 1); }); d3-array-3.1.1/test/reverse-test.js000066400000000000000000000017231412622006300171020ustar00rootroot00000000000000import assert from "assert"; import {reverse} from "../src/index.js"; it("reverse(values) returns a reversed copy", () => { const input = [1, 3, 2, 5, 4]; assert.deepStrictEqual(reverse(input), [4, 5, 2, 3, 1]); assert.deepStrictEqual(input, [1, 3, 2, 5, 4]); // does not mutate }); it("reverse(values) returns an array", () => { assert.strictEqual(Array.isArray(reverse(Uint8Array.of(1, 2))), true); }); it("reverse(values) accepts an iterable", () => { assert.deepStrictEqual(reverse(new Set([1, 2, 3, 2, 1])), [3, 2, 1]); assert.deepStrictEqual(reverse((function*() { yield* [1, 3, 2, 5, 4]; })()), [4, 5, 2, 3, 1]); assert.deepStrictEqual(reverse(Uint8Array.of(1, 3, 2, 5, 4)), [4, 5, 2, 3, 1]); }); it("reverse(values) enforces that values is iterable", () => { assert.throws(() => reverse({}), TypeError); }); it("reverse(values) does not skip sparse elements", () => { assert.deepStrictEqual(reverse([, 1, 2,, ]), [undefined, 2, 1, undefined]); }); d3-array-3.1.1/test/rollup-test.js000066400000000000000000000024621412622006300167450ustar00rootroot00000000000000import assert from "assert"; import {rollup, sum} from "../src/index.js"; const data = [ {name: "jim", amount: "3400", date: "11/12/2015"}, {name: "carl", amount: "12011", date: "11/12/2015"}, {name: "stacy", amount: "1201", date: "01/04/2016"}, {name: "stacy", amount: "3405", date: "01/04/2016"} ]; it("rollup(data, reduce, accessor) returns the expected map", () => { assert.deepStrictEqual( entries(rollup(data, v => v.length, d => d.name), 1), [ ["jim", 1], ["carl", 1], ["stacy", 2] ] ); assert.deepStrictEqual( entries(rollup(data, v => sum(v, d => d.amount), d => d.name), 1), [ ["jim", 3400], ["carl", 12011], ["stacy", 4606] ] ); }); it("rollup(data, reduce, accessor, accessor) returns the expected map", () => { assert.deepStrictEqual( entries(rollup(data, v => v.length, d => d.name, d => d.amount), 2), [ [ "jim", [ ["3400", 1] ] ], [ "carl", [ ["12011", 1] ] ], [ "stacy", [ ["1201", 1], ["3405", 1] ] ] ] ); }); function entries(map, depth) { if (depth > 0) { return Array.from(map, ([k, v]) => [k, entries(v, depth - 1)]); } else { return map; } } d3-array-3.1.1/test/rollups-test.js000066400000000000000000000022001412622006300171160ustar00rootroot00000000000000import assert from "assert"; import {rollups, sum} from "../src/index.js"; const data = [ {name: "jim", amount: "3400", date: "11/12/2015"}, {name: "carl", amount: "12011", date: "11/12/2015"}, {name: "stacy", amount: "1201", date: "01/04/2016"}, {name: "stacy", amount: "3405", date: "01/04/2016"} ]; it("rollups(data, reduce, accessor) returns the expected array", () => { assert.deepStrictEqual( rollups(data, v => v.length, d => d.name), [ ["jim", 1], ["carl", 1], ["stacy", 2] ] ); assert.deepStrictEqual( rollups(data, v => sum(v, d => d.amount), d => d.name), [ ["jim", 3400], ["carl", 12011], ["stacy", 4606] ] ); }); it("rollups(data, reduce, accessor, accessor) returns the expected array", () => { assert.deepStrictEqual( rollups(data, v => v.length, d => d.name, d => d.amount), [ [ "jim", [ ["3400", 1] ] ], [ "carl", [ ["12011", 1] ] ], [ "stacy", [ ["1201", 1], ["3405", 1] ] ] ] ); }); d3-array-3.1.1/test/scan-test.js000066400000000000000000000032311412622006300163470ustar00rootroot00000000000000import assert from "assert"; import {descending, scan} from "../src/index.js"; it("scan(array) compares using natural order", () => { assert.strictEqual(scan([0, 1]), 0); assert.strictEqual(scan([1, 0]), 1); assert.strictEqual(scan([0, "1"]), 0); assert.strictEqual(scan(["1", 0]), 1); assert.strictEqual(scan(["10", "2"]), 0); assert.strictEqual(scan(["2", "10"]), 1); assert.strictEqual(scan(["10", "2", NaN]), 0); assert.strictEqual(scan([NaN, "10", "2"]), 1); assert.strictEqual(scan(["2", NaN, "10"]), 2); assert.strictEqual(scan([2, NaN, 10]), 0); assert.strictEqual(scan([10, 2, NaN]), 1); assert.strictEqual(scan([NaN, 10, 2]), 2); }); it("scan(array, compare) compares using the specified compare function", () => { var a = {name: "a"}, b = {name: "b"}; assert.strictEqual(scan([a, b], (a, b) => a.name.localeCompare(b.name)), 0); assert.strictEqual(scan([1, 0], descending), 0); assert.strictEqual(scan(["1", 0], descending), 0); assert.strictEqual(scan(["2", "10"], descending), 0); assert.strictEqual(scan(["2", NaN, "10"], descending), 0); assert.strictEqual(scan([2, NaN, 10], descending), 2); }); it("scan(array) returns undefined if the array is empty", () => { assert.strictEqual(scan([]), undefined); }); it("scan(array) returns undefined if the array contains only incomparable values", () => { assert.strictEqual(scan([NaN, undefined]), undefined); assert.strictEqual(scan([NaN, "foo"], (a, b) => a - b), undefined); }); it("scan(array) returns the first of equal values", () => { assert.strictEqual(scan([2, 2, 1, 1, 0, 0, 0, 3, 0]), 4); assert.strictEqual(scan([3, 2, 2, 1, 1, 0, 0, 0, 3, 0], descending), 0); }); d3-array-3.1.1/test/shuffle-test.js000066400000000000000000000025021412622006300170570ustar00rootroot00000000000000import assert from "assert"; import {randomLcg} from "d3-random"; import {pairs, shuffler} from "../src/index.js"; it("shuffle(array) shuffles the array in-place", () => { const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; const shuffle = shuffler(randomLcg(0.9051667019185816)); assert.strictEqual(shuffle(numbers), numbers); assert(pairs(numbers).some(([a, b]) => a > b)); // shuffled }); it("shuffler(random)(array) shuffles the array in-place", () => { const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; const shuffle = shuffler(randomLcg(0.9051667019185816)); assert.strictEqual(shuffle(numbers), numbers); assert.deepStrictEqual(numbers, [7, 4, 5, 3, 9, 0, 6, 1, 2, 8]); }); it("shuffler(random)(array, start) shuffles the subset array[start:] in-place", () => { const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; const shuffle = shuffler(randomLcg(0.9051667019185816)); assert.strictEqual(shuffle(numbers, 4), numbers); assert.deepStrictEqual(numbers, [0, 1, 2, 3, 8, 7, 6, 4, 5, 9]); }); it("shuffler(random)(array, start, end) shuffles the subset array[start:end] in-place", () => { const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; const shuffle = shuffler(randomLcg(0.9051667019185816)); assert.strictEqual(shuffle(numbers, 3, 8), numbers); assert.deepStrictEqual(numbers, [0, 1, 2, 5, 6, 3, 4, 7, 8, 9]); }); d3-array-3.1.1/test/some-test.js000066400000000000000000000033401412622006300163670ustar00rootroot00000000000000import assert from "assert"; import {some} from "../src/index.js"; it("some(values, test) returns true if any test passes", () => { assert.strictEqual(some([1, 2, 3, 2, 1], x => x & 1), true); assert.strictEqual(some([1, 2, 3, 2, 1], x => x > 3), false); }); it("some(values, test) returns false if values is empty", () => { assert.strictEqual(some([], () => true), false); }); it("some(values, test) accepts an iterable", () => { assert.strictEqual(some(new Set([1, 2, 3, 2, 1]), x => x >= 3), true); assert.strictEqual(some((function*() { yield* [1, 2, 3, 2, 1]; })(), x => x >= 3), true); assert.strictEqual(some(Uint8Array.of(1, 2, 3, 2, 1), x => x >= 3), true); }); it("some(values, test) enforces that test is a function", () => { assert.throws(() => some([]), TypeError); }); it("some(values, test) enforces that values is iterable", () => { assert.throws(() => some({}, () => true), TypeError); }); it("some(values, test) passes test (value, index, values)", () => { const calls = []; const values = new Set([5, 4, 3, 2, 1]); some(values, function() { calls.push([this, ...arguments]); }); assert.deepStrictEqual(calls, [ [undefined, 5, 0, values], [undefined, 4, 1, values], [undefined, 3, 2, values], [undefined, 2, 3, values], [undefined, 1, 4, values] ]); }); it("some(values, test) short-circuts when test returns truthy", () => { let calls = 0; assert.strictEqual(some([1, 2, 3], x => (++calls, x >= 2)), true); assert.strictEqual(calls, 2); assert.strictEqual(some([1, 2, 3], x => (++calls, x - 1)), true); assert.strictEqual(calls, 4); }); it("some(values, test) does not skip sparse elements", () => { assert.deepStrictEqual(some([, 1, 2,, ], x => x === undefined), true); }); d3-array-3.1.1/test/sort-test.js000066400000000000000000000066421412622006300164230ustar00rootroot00000000000000import assert from "assert"; import {ascending, descending, sort} from "../src/index.js"; it("sort(values) returns a sorted copy", () => { const input = [1, 3, 2, 5, 4]; assert.deepStrictEqual(sort(input), [1, 2, 3, 4, 5]); assert.deepStrictEqual(input, [1, 3, 2, 5, 4]); // does not mutate }); it("sort(values) defaults to ascending, not lexicographic", () => { const input = [1, "10", 2]; assert.deepStrictEqual(sort(input), [1, 2, "10"]); }); // Per ECMAScript specification §23.1.3.27.1, undefined values are not passed to // the comparator; they are always put at the end of the sorted array. // https://262.ecma-international.org/12.0/#sec-sortcompare it("sort(values) puts non-orderable values last, followed by undefined", () => { const date = new Date(NaN); const input = [undefined, 1, null, 0, NaN, "10", date, 2]; assert.deepStrictEqual(sort(input), [0, 1, 2, "10", null, NaN, date, undefined]); }); it("sort(values, comparator) puts non-orderable values last, followed by undefined", () => { const date = new Date(NaN); const input = [undefined, 1, null, 0, NaN, "10", date, 2]; assert.deepStrictEqual(sort(input, ascending), [0, 1, 2, "10", null, NaN, date, undefined]); assert.deepStrictEqual(sort(input, descending), ["10", 2, 1, 0, null, NaN, date, undefined]); }); // However we don't implement this spec when using an accessor it("sort(values, accessor) puts non-orderable values last", () => { const date = new Date(NaN); const input = [undefined, 1, null, 0, NaN, "10", date, 2]; assert.deepStrictEqual(sort(input, d => d), [0, 1, 2, "10", undefined, null, NaN, date]); assert.deepStrictEqual(sort(input, d => d && -d), ["10", 2, 1, 0, undefined, null, NaN, date]); }); it("sort(values, accessor) uses the specified accessor in natural order", () => { assert.deepStrictEqual(sort([1, 3, 2, 5, 4], d => d), [1, 2, 3, 4, 5]); assert.deepStrictEqual(sort([1, 3, 2, 5, 4], d => -d), [5, 4, 3, 2, 1]); }); it("sort(values, ...accessors) accepts multiple accessors", () => { assert.deepStrictEqual(sort([[1, 0], [2, 1], [2, 0], [1, 1], [3, 0]], ([x]) => x, ([, y]) => y), [[1, 0], [1, 1], [2, 0], [2, 1], [3, 0]]); assert.deepStrictEqual(sort([{x: 1, y: 0}, {x: 2, y: 1}, {x: 2, y: 0}, {x: 1, y: 1}, {x: 3, y: 0}], ({x}) => x, ({y}) => y), [{x: 1, y: 0}, {x: 1, y: 1}, {x: 2, y: 0}, {x: 2, y: 1}, {x: 3, y: 0}]); }); it("sort(values, comparator) uses the specified comparator", () => { assert.deepStrictEqual(sort([1, 3, 2, 5, 4], descending), [5, 4, 3, 2, 1]); }); it("sort(values) returns an array", () => { assert.strictEqual(Array.isArray(sort(Uint8Array.of(1, 2))), true); }); it("sort(values) accepts an iterable", () => { assert.deepStrictEqual(sort(new Set([1, 3, 2, 1, 2])), [1, 2, 3]); assert.deepStrictEqual(sort((function*() { yield* [1, 3, 2, 5, 4]; })()), [1, 2, 3, 4, 5]); assert.deepStrictEqual(sort(Uint8Array.of(1, 3, 2, 5, 4)), [1, 2, 3, 4, 5]); }); it("sort(values) enforces that values is iterable", () => { assert.throws(() => sort({}), {name: "TypeError", message: /is not iterable/}); }); it("sort(values, comparator) enforces that comparator is a function", () => { assert.throws(() => sort([], {}), {name: "TypeError", message: /is not a function/}); assert.throws(() => sort([], null), {name: "TypeError", message: /is not a function/}); }); it("sort(values) does not skip sparse elements", () => { assert.deepStrictEqual(sort([, 1, 2,, ]), [1, 2, undefined, undefined]); }); d3-array-3.1.1/test/subset-test.js000066400000000000000000000012451412622006300167330ustar00rootroot00000000000000import assert from "assert"; import {subset} from "../src/index.js"; it("subset(values, other) returns true if values is a subset of others", () => { assert.strictEqual(subset([2], [1, 2]), true); assert.strictEqual(subset([3, 4], [2, 3]), false); assert.strictEqual(subset([], [1]), true); }); it("subset(values, other) performs interning", () => { assert.strictEqual(subset([new Date("2021-01-02")], [new Date("2021-01-01"), new Date("2021-01-02")]), true); assert.strictEqual(subset([new Date("2021-01-03"), new Date("2021-01-04")], [new Date("2021-01-02"), new Date("2021-01-03")]), false); assert.strictEqual(subset([], [new Date("2021-01-01")]), true); }); d3-array-3.1.1/test/sum-test.js000066400000000000000000000065341412622006300162400ustar00rootroot00000000000000import assert from "assert"; import {sum} from "../src/index.js"; it("sum(array) returns the sum of the specified numbers", () => { assert.strictEqual(sum([1]), 1); assert.strictEqual(sum([5, 1, 2, 3, 4]), 15); assert.strictEqual(sum([20, 3]), 23); assert.strictEqual(sum([3, 20]), 23); }); it("sum(array) observes values that can be coerced to numbers", () => { assert.strictEqual(sum(["20", "3"]), 23); assert.strictEqual(sum(["3", "20"]), 23); assert.strictEqual(sum(["3", 20]), 23); assert.strictEqual(sum([20, "3"]), 23); assert.strictEqual(sum([3, "20"]), 23); assert.strictEqual(sum(["20", 3]), 23); }); it("sum(array) ignores non-numeric values", () => { assert.strictEqual(sum(["a", "b", "c"]), 0); assert.strictEqual(sum(["a", 1, "2"]), 3); }); it("sum(array) ignores null, undefined and NaN", () => { assert.strictEqual(sum([NaN, 1, 2, 3, 4, 5]), 15); assert.strictEqual(sum([1, 2, 3, 4, 5, NaN]), 15); assert.strictEqual(sum([10, null, 3, undefined, 5, NaN]), 18); }); it("sum(array) returns zero if there are no numbers", () => { assert.strictEqual(sum([]), 0); assert.strictEqual(sum([NaN]), 0); assert.strictEqual(sum([undefined]), 0); assert.strictEqual(sum([undefined, NaN]), 0); assert.strictEqual(sum([undefined, NaN, {}]), 0); }); it("sum(array, f) returns the sum of the specified numbers", () => { assert.strictEqual(sum([1].map(box), unbox), 1); assert.strictEqual(sum([5, 1, 2, 3, 4].map(box), unbox), 15); assert.strictEqual(sum([20, 3].map(box), unbox), 23); assert.strictEqual(sum([3, 20].map(box), unbox), 23); }); it("sum(array, f) observes values that can be coerced to numbers", () => { assert.strictEqual(sum(["20", "3"].map(box), unbox), 23); assert.strictEqual(sum(["3", "20"].map(box), unbox), 23); assert.strictEqual(sum(["3", 20].map(box), unbox), 23); assert.strictEqual(sum([20, "3"].map(box), unbox), 23); assert.strictEqual(sum([3, "20"].map(box), unbox), 23); assert.strictEqual(sum(["20", 3].map(box), unbox), 23); }); it("sum(array, f) ignores non-numeric values", () => { assert.strictEqual(sum(["a", "b", "c"].map(box), unbox), 0); assert.strictEqual(sum(["a", 1, "2"].map(box), unbox), 3); }); it("sum(array, f) ignores null, undefined and NaN", () => { assert.strictEqual(sum([NaN, 1, 2, 3, 4, 5].map(box), unbox), 15); assert.strictEqual(sum([1, 2, 3, 4, 5, NaN].map(box), unbox), 15); assert.strictEqual(sum([10, null, 3, undefined, 5, NaN].map(box), unbox), 18); }); it("sum(array, f) returns zero if there are no numbers", () => { assert.strictEqual(sum([].map(box), unbox), 0); assert.strictEqual(sum([NaN].map(box), unbox), 0); assert.strictEqual(sum([undefined].map(box), unbox), 0); assert.strictEqual(sum([undefined, NaN].map(box), unbox), 0); assert.strictEqual(sum([undefined, NaN, {}].map(box), unbox), 0); }); it("sum(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; sum(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("sum(array, f) uses the undefined context", () => { const results = []; sum([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/superset-test.js000066400000000000000000000021261412622006300172770ustar00rootroot00000000000000import assert from "assert"; import {superset} from "../src/index.js"; it("superset(values, other) returns true if values is a superset of others", () => { assert.strictEqual(superset([1, 2], [2]), true); assert.strictEqual(superset([2, 3], [3, 4]), false); assert.strictEqual(superset([1], []), true); }); it("superset(values, other) allows values to be infinite", () => { assert.strictEqual(superset(odds(), [1, 3, 5]), true); }); it("superset(values, other) allows other to be infinite", () => { assert.strictEqual(superset([1, 3, 5], repeat(1, 3, 2)), false); }); it("superset(values, other) performs interning", () => { assert.strictEqual(superset([new Date("2021-01-01"), new Date("2021-01-02")], [new Date("2021-01-02")]), true); assert.strictEqual(superset([new Date("2021-01-02"), new Date("2021-01-03")], [new Date("2021-01-03"), new Date("2021-01-04")]), false); assert.strictEqual(superset([new Date("2021-01-01")], []), true); }); function* odds() { for (let i = 1; true; i += 2) { yield i; } } function* repeat(...values) { while (true) { yield* values; } } d3-array-3.1.1/test/threshold/000077500000000000000000000000001412622006300161055ustar00rootroot00000000000000d3-array-3.1.1/test/threshold/freedmanDiaconic-test.js000066400000000000000000000004031412622006300226300ustar00rootroot00000000000000import assert from "assert"; import {thresholdFreedmanDiaconis} from "../../src/index.js"; it("thresholdFreedmanDiaconis(values, min, max) returns the expected result", () => { assert.strictEqual(thresholdFreedmanDiaconis([4, 3, 2, 1, NaN], 1, 4), 2); }); d3-array-3.1.1/test/threshold/scott-test.js000066400000000000000000000003421412622006300205530ustar00rootroot00000000000000import assert from "assert"; import {thresholdScott} from "../../src/index.js"; it("thresholdScott(values, min, max) returns the expected result", () => { assert.strictEqual(thresholdScott([4, 3, 2, 1, NaN], 1, 4), 2); }); d3-array-3.1.1/test/threshold/sturges-test.js000066400000000000000000000003501412622006300211120ustar00rootroot00000000000000import assert from "assert"; import {thresholdSturges} from "../../src/index.js"; it("thresholdSturges(values, min, max) returns the expected result", () => { assert.strictEqual(thresholdSturges([4, 3, 2, 1, NaN], 1, 4), 3); }); d3-array-3.1.1/test/tickIncrement-test.js000066400000000000000000000055371412622006300202350ustar00rootroot00000000000000import assert from "assert"; import {tickIncrement} from "../src/index.js"; it("tickIncrement(start, stop, count) returns NaN if any argument is NaN", () => { assert(isNaN(tickIncrement(NaN, 1, 1))); assert(isNaN(tickIncrement(0, NaN, 1))); assert(isNaN(tickIncrement(0, 1, NaN))); assert(isNaN(tickIncrement(NaN, NaN, 1))); assert(isNaN(tickIncrement(0, NaN, NaN))); assert(isNaN(tickIncrement(NaN, 1, NaN))); assert(isNaN(tickIncrement(NaN, NaN, NaN))); }); it("tickIncrement(start, stop, count) returns NaN or -Infinity if start === stop", () => { assert(isNaN(tickIncrement(1, 1, -1))); assert(isNaN(tickIncrement(1, 1, 0))); assert(isNaN(tickIncrement(1, 1, NaN))); assert.strictEqual(tickIncrement(1, 1, 1), -Infinity); assert.strictEqual(tickIncrement(1, 1, 10), -Infinity); }); it("tickIncrement(start, stop, count) returns 0 or Infinity if count is not positive", () => { assert.strictEqual(tickIncrement(0, 1, -1), Infinity); assert.strictEqual(tickIncrement(0, 1, 0), Infinity); }); it("tickIncrement(start, stop, count) returns -Infinity if count is infinity", () => { assert.strictEqual(tickIncrement(0, 1, Infinity), -Infinity); }); it("tickIncrement(start, stop, count) returns approximately count + 1 tickIncrement when start < stop", () => { assert.strictEqual(tickIncrement( 0, 1, 10), -10); assert.strictEqual(tickIncrement( 0, 1, 9), -10); assert.strictEqual(tickIncrement( 0, 1, 8), -10); assert.strictEqual(tickIncrement( 0, 1, 7), -5); assert.strictEqual(tickIncrement( 0, 1, 6), -5); assert.strictEqual(tickIncrement( 0, 1, 5), -5); assert.strictEqual(tickIncrement( 0, 1, 4), -5); assert.strictEqual(tickIncrement( 0, 1, 3), -2); assert.strictEqual(tickIncrement( 0, 1, 2), -2); assert.strictEqual(tickIncrement( 0, 1, 1), 1); assert.strictEqual(tickIncrement( 0, 10, 10), 1); assert.strictEqual(tickIncrement( 0, 10, 9), 1); assert.strictEqual(tickIncrement( 0, 10, 8), 1); assert.strictEqual(tickIncrement( 0, 10, 7), 2); assert.strictEqual(tickIncrement( 0, 10, 6), 2); assert.strictEqual(tickIncrement( 0, 10, 5), 2); assert.strictEqual(tickIncrement( 0, 10, 4), 2); assert.strictEqual(tickIncrement( 0, 10, 3), 5); assert.strictEqual(tickIncrement( 0, 10, 2), 5); assert.strictEqual(tickIncrement( 0, 10, 1), 10); assert.strictEqual(tickIncrement(-10, 10, 10), 2); assert.strictEqual(tickIncrement(-10, 10, 9), 2); assert.strictEqual(tickIncrement(-10, 10, 8), 2); assert.strictEqual(tickIncrement(-10, 10, 7), 2); assert.strictEqual(tickIncrement(-10, 10, 6), 5); assert.strictEqual(tickIncrement(-10, 10, 5), 5); assert.strictEqual(tickIncrement(-10, 10, 4), 5); assert.strictEqual(tickIncrement(-10, 10, 3), 5); assert.strictEqual(tickIncrement(-10, 10, 2), 10); assert.strictEqual(tickIncrement(-10, 10, 1), 20); }); d3-array-3.1.1/test/tickStep-test.js000066400000000000000000000112471412622006300172170ustar00rootroot00000000000000import assert from "assert"; import {tickStep} from "../src/index.js"; it("tickStep(start, stop, count) returns NaN if any argument is NaN", () => { assert(isNaN(tickStep(NaN, 1, 1))); assert(isNaN(tickStep(0, NaN, 1))); assert(isNaN(tickStep(0, 1, NaN))); assert(isNaN(tickStep(NaN, NaN, 1))); assert(isNaN(tickStep(0, NaN, NaN))); assert(isNaN(tickStep(NaN, 1, NaN))); assert(isNaN(tickStep(NaN, NaN, NaN))); }); it("tickStep(start, stop, count) returns NaN or 0 if start === stop", () => { assert(isNaN(tickStep(1, 1, -1))); assert(isNaN(tickStep(1, 1, 0))); assert(isNaN(tickStep(1, 1, NaN))); assert.strictEqual(tickStep(1, 1, 1), 0); assert.strictEqual(tickStep(1, 1, 10), 0); }); it("tickStep(start, stop, count) returns 0 or Infinity if count is not positive", () => { assert.strictEqual(tickStep(0, 1, -1), Infinity); assert.strictEqual(tickStep(0, 1, 0), Infinity); }); it("tickStep(start, stop, count) returns 0 if count is infinity", () => { assert.strictEqual(tickStep(0, 1, Infinity), 0); }); it("tickStep(start, stop, count) returns approximately count + 1 tickStep when start < stop", () => { assert.strictEqual(tickStep( 0, 1, 10), 0.1); assert.strictEqual(tickStep( 0, 1, 9), 0.1); assert.strictEqual(tickStep( 0, 1, 8), 0.1); assert.strictEqual(tickStep( 0, 1, 7), 0.2); assert.strictEqual(tickStep( 0, 1, 6), 0.2); assert.strictEqual(tickStep( 0, 1, 5), 0.2); assert.strictEqual(tickStep( 0, 1, 4), 0.2); assert.strictEqual(tickStep( 0, 1, 3), 0.5); assert.strictEqual(tickStep( 0, 1, 2), 0.5); assert.strictEqual(tickStep( 0, 1, 1), 1.0); assert.strictEqual(tickStep( 0, 10, 10), 1); assert.strictEqual(tickStep( 0, 10, 9), 1); assert.strictEqual(tickStep( 0, 10, 8), 1); assert.strictEqual(tickStep( 0, 10, 7), 2); assert.strictEqual(tickStep( 0, 10, 6), 2); assert.strictEqual(tickStep( 0, 10, 5), 2); assert.strictEqual(tickStep( 0, 10, 4), 2); assert.strictEqual(tickStep( 0, 10, 3), 5); assert.strictEqual(tickStep( 0, 10, 2), 5); assert.strictEqual(tickStep( 0, 10, 1), 10); assert.strictEqual(tickStep(-10, 10, 10), 2); assert.strictEqual(tickStep(-10, 10, 9), 2); assert.strictEqual(tickStep(-10, 10, 8), 2); assert.strictEqual(tickStep(-10, 10, 7), 2); assert.strictEqual(tickStep(-10, 10, 6), 5); assert.strictEqual(tickStep(-10, 10, 5), 5); assert.strictEqual(tickStep(-10, 10, 4), 5); assert.strictEqual(tickStep(-10, 10, 3), 5); assert.strictEqual(tickStep(-10, 10, 2), 10); assert.strictEqual(tickStep(-10, 10, 1), 20); }); it("tickStep(start, stop, count) returns -tickStep(stop, start, count)", () => { assert.strictEqual(tickStep( 0, 1, 10), -tickStep( 1, 0, 10)); assert.strictEqual(tickStep( 0, 1, 9), -tickStep( 1, 0, 9)); assert.strictEqual(tickStep( 0, 1, 8), -tickStep( 1, 0, 8)); assert.strictEqual(tickStep( 0, 1, 7), -tickStep( 1, 0, 7)); assert.strictEqual(tickStep( 0, 1, 6), -tickStep( 1, 0, 6)); assert.strictEqual(tickStep( 0, 1, 5), -tickStep( 1, 0, 5)); assert.strictEqual(tickStep( 0, 1, 4), -tickStep( 1, 0, 4)); assert.strictEqual(tickStep( 0, 1, 3), -tickStep( 1, 0, 3)); assert.strictEqual(tickStep( 0, 1, 2), -tickStep( 1, 0, 2)); assert.strictEqual(tickStep( 0, 1, 1), -tickStep( 1, 0, 1)); assert.strictEqual(tickStep( 0, 10, 10), -tickStep(10, 0, 10)); assert.strictEqual(tickStep( 0, 10, 9), -tickStep(10, 0, 9)); assert.strictEqual(tickStep( 0, 10, 8), -tickStep(10, 0, 8)); assert.strictEqual(tickStep( 0, 10, 7), -tickStep(10, 0, 7)); assert.strictEqual(tickStep( 0, 10, 6), -tickStep(10, 0, 6)); assert.strictEqual(tickStep( 0, 10, 5), -tickStep(10, 0, 5)); assert.strictEqual(tickStep( 0, 10, 4), -tickStep(10, 0, 4)); assert.strictEqual(tickStep( 0, 10, 3), -tickStep(10, 0, 3)); assert.strictEqual(tickStep( 0, 10, 2), -tickStep(10, 0, 2)); assert.strictEqual(tickStep( 0, 10, 1), -tickStep(10, 0, 1)); assert.strictEqual(tickStep(-10, 10, 10), -tickStep(10, -10, 10)); assert.strictEqual(tickStep(-10, 10, 9), -tickStep(10, -10, 9)); assert.strictEqual(tickStep(-10, 10, 8), -tickStep(10, -10, 8)); assert.strictEqual(tickStep(-10, 10, 7), -tickStep(10, -10, 7)); assert.strictEqual(tickStep(-10, 10, 6), -tickStep(10, -10, 6)); assert.strictEqual(tickStep(-10, 10, 5), -tickStep(10, -10, 5)); assert.strictEqual(tickStep(-10, 10, 4), -tickStep(10, -10, 4)); assert.strictEqual(tickStep(-10, 10, 3), -tickStep(10, -10, 3)); assert.strictEqual(tickStep(-10, 10, 2), -tickStep(10, -10, 2)); assert.strictEqual(tickStep(-10, 10, 1), -tickStep(10, -10, 1)); }); d3-array-3.1.1/test/ticks-test.js000066400000000000000000000155051412622006300165470ustar00rootroot00000000000000import assert from "assert"; import {ticks} from "../src/index.js"; it("ticks(start, stop, count) returns the empty array if any argument is NaN", () => { assert.deepStrictEqual(ticks(NaN, 1, 1), []); assert.deepStrictEqual(ticks(0, NaN, 1), []); assert.deepStrictEqual(ticks(0, 1, NaN), []); assert.deepStrictEqual(ticks(NaN, NaN, 1), []); assert.deepStrictEqual(ticks(0, NaN, NaN), []); assert.deepStrictEqual(ticks(NaN, 1, NaN), []); assert.deepStrictEqual(ticks(NaN, NaN, NaN), []); }); it("ticks(start, stop, count) returns the empty array if start === stop and count is non-positive", () => { assert.deepStrictEqual(ticks(1, 1, -1), []); assert.deepStrictEqual(ticks(1, 1, 0), []); assert.deepStrictEqual(ticks(1, 1, NaN), []); }); it("ticks(start, stop, count) returns the empty array if start === stop and count is positive", () => { assert.deepStrictEqual(ticks(1, 1, 1), [1]); assert.deepStrictEqual(ticks(1, 1, 10), [1]); }); it("ticks(start, stop, count) returns the empty array if count is not positive", () => { assert.deepStrictEqual(ticks(0, 1, 0), []); assert.deepStrictEqual(ticks(0, 1, -1), []); assert.deepStrictEqual(ticks(0, 1, NaN), []); }); it("ticks(start, stop, count) returns the empty array if count is infinity", () => { assert.deepStrictEqual(ticks(0, 1, Infinity), []); }); it("ticks(start, stop, count) does not include negative zero", () => { assert.strictEqual(1 / ticks(-1, 0, 5).pop(), Infinity); }); it("ticks(start, stop, count) remains within the domain", () => { assert.deepStrictEqual(ticks(0, 2.2, 3), [0, 1, 2]); }); it("ticks(start, stop, count) returns approximately count + 1 ticks when start < stop", () => { assert.deepStrictEqual(ticks( 0, 1, 10), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 9), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 8), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 7), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 6), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 5), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 4), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 3), [0.0, 0.5, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 2), [0.0, 0.5, 1.0]); assert.deepStrictEqual(ticks( 0, 1, 1), [0.0, 1.0]); assert.deepStrictEqual(ticks( 0, 10, 10), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); assert.deepStrictEqual(ticks( 0, 10, 9), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); assert.deepStrictEqual(ticks( 0, 10, 8), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); assert.deepStrictEqual(ticks( 0, 10, 7), [0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks( 0, 10, 6), [0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks( 0, 10, 5), [0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks( 0, 10, 4), [0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks( 0, 10, 3), [0, 5, 10]); assert.deepStrictEqual(ticks( 0, 10, 2), [0, 5, 10]); assert.deepStrictEqual(ticks( 0, 10, 1), [0, 10]); assert.deepStrictEqual(ticks(-10, 10, 10), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks(-10, 10, 9), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks(-10, 10, 8), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks(-10, 10, 7), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]); assert.deepStrictEqual(ticks(-10, 10, 6), [-10, -5, 0, 5, 10]); assert.deepStrictEqual(ticks(-10, 10, 5), [-10, -5, 0, 5, 10]); assert.deepStrictEqual(ticks(-10, 10, 4), [-10, -5, 0, 5, 10]); assert.deepStrictEqual(ticks(-10, 10, 3), [-10, -5, 0, 5, 10]); assert.deepStrictEqual(ticks(-10, 10, 2), [-10, 0, 10]); assert.deepStrictEqual(ticks(-10, 10, 1), [ 0, ]); }); it("ticks(start, stop, count) returns the reverse of ticks(stop, start, count)", () => { assert.deepStrictEqual(ticks( 1, 0, 10), ticks( 0, 1, 10).reverse()); assert.deepStrictEqual(ticks( 1, 0, 9), ticks( 0, 1, 9).reverse()); assert.deepStrictEqual(ticks( 1, 0, 8), ticks( 0, 1, 8).reverse()); assert.deepStrictEqual(ticks( 1, 0, 7), ticks( 0, 1, 7).reverse()); assert.deepStrictEqual(ticks( 1, 0, 6), ticks( 0, 1, 6).reverse()); assert.deepStrictEqual(ticks( 1, 0, 5), ticks( 0, 1, 5).reverse()); assert.deepStrictEqual(ticks( 1, 0, 4), ticks( 0, 1, 4).reverse()); assert.deepStrictEqual(ticks( 1, 0, 3), ticks( 0, 1, 3).reverse()); assert.deepStrictEqual(ticks( 1, 0, 2), ticks( 0, 1, 2).reverse()); assert.deepStrictEqual(ticks( 1, 0, 1), ticks( 0, 1, 1).reverse()); assert.deepStrictEqual(ticks(10, 0, 10), ticks( 0, 10, 10).reverse()); assert.deepStrictEqual(ticks(10, 0, 9), ticks( 0, 10, 9).reverse()); assert.deepStrictEqual(ticks(10, 0, 8), ticks( 0, 10, 8).reverse()); assert.deepStrictEqual(ticks(10, 0, 7), ticks( 0, 10, 7).reverse()); assert.deepStrictEqual(ticks(10, 0, 6), ticks( 0, 10, 6).reverse()); assert.deepStrictEqual(ticks(10, 0, 5), ticks( 0, 10, 5).reverse()); assert.deepStrictEqual(ticks(10, 0, 4), ticks( 0, 10, 4).reverse()); assert.deepStrictEqual(ticks(10, 0, 3), ticks( 0, 10, 3).reverse()); assert.deepStrictEqual(ticks(10, 0, 2), ticks( 0, 10, 2).reverse()); assert.deepStrictEqual(ticks(10, 0, 1), ticks( 0, 10, 1).reverse()); assert.deepStrictEqual(ticks(10, -10, 10), ticks(-10, 10, 10).reverse()); assert.deepStrictEqual(ticks(10, -10, 9), ticks(-10, 10, 9).reverse()); assert.deepStrictEqual(ticks(10, -10, 8), ticks(-10, 10, 8).reverse()); assert.deepStrictEqual(ticks(10, -10, 7), ticks(-10, 10, 7).reverse()); assert.deepStrictEqual(ticks(10, -10, 6), ticks(-10, 10, 6).reverse()); assert.deepStrictEqual(ticks(10, -10, 5), ticks(-10, 10, 5).reverse()); assert.deepStrictEqual(ticks(10, -10, 4), ticks(-10, 10, 4).reverse()); assert.deepStrictEqual(ticks(10, -10, 3), ticks(-10, 10, 3).reverse()); assert.deepStrictEqual(ticks(10, -10, 2), ticks(-10, 10, 2).reverse()); assert.deepStrictEqual(ticks(10, -10, 1), ticks(-10, 10, 1).reverse()); }); it("ticks(start, stop, count) handles precision problems", () => { assert.deepStrictEqual(ticks(0.98, 1.14, 10), [0.98, 1, 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14]); }); d3-array-3.1.1/test/transpose-test.js000066400000000000000000000024241412622006300174440ustar00rootroot00000000000000import assert from "assert"; import {transpose} from "../src/index.js"; it("transpose([]) and transpose([[]]) return an empty array", () => { assert.deepStrictEqual(transpose([]), []); assert.deepStrictEqual(transpose([[]]), []); }); it("transpose([[a, b, …]]) returns [[a], [b], …]", () => { assert.deepStrictEqual(transpose([[1, 2, 3, 4, 5]]), [[1], [2], [3], [4], [5]]); }); it("transpose([[a1, b1, …], [a2, b2, …]]) returns [[a1, a2], [b1, b2], …]", () => { assert.deepStrictEqual(transpose([[1, 2], [3, 4]]), [[1, 3], [2, 4]]); assert.deepStrictEqual(transpose([[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]]), [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]); }); it("transpose([[a1, b1, …], [a2, b2, …], [a3, b3, …]]) returns [[a1, a2, a3], [b1, b2, b3], …]", () => { assert.deepStrictEqual(transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), [[1, 4, 7], [2, 5, 8], [3, 6, 9]]); }); it("transpose(…) ignores extra elements given an irregular matrix", () => { assert.deepStrictEqual(transpose([[1, 2], [3, 4], [5, 6, 7]]), [[1, 3, 5], [2, 4, 6]]); }); it("transpose(…) returns a copy", () => { const matrix = [[1, 2], [3, 4]]; const t = transpose(matrix); matrix[0][0] = matrix[0][1] = matrix[1][0] = matrix[1][1] = 0; assert.deepStrictEqual(t, [[1, 3], [2, 4]]); }); d3-array-3.1.1/test/union-test.js000066400000000000000000000017551412622006300165640ustar00rootroot00000000000000import {union} from "../src/index.js"; import {assertSetEqual} from "./asserts.js"; it("union(values) returns a set of values", () => { assertSetEqual(union([1, 2, 3, 2, 1]), [1, 2, 3]); }); it("union(values, other) returns a set of values", () => { assertSetEqual(union([1, 2], [2, 3, 1]), [1, 2, 3]); }); it("union(...values) returns a set of values", () => { assertSetEqual(union([1], [2], [2, 3], [1]), [1, 2, 3]); }); it("union(...values) accepts iterables", () => { assertSetEqual(union(new Set([1, 2, 3])), [1, 2, 3]); assertSetEqual(union(Uint8Array.of(1, 2, 3)), [1, 2, 3]); }); it("union(...values) performs interning", () => { assertSetEqual(union([new Date("2021-01-01"), new Date("2021-01-01"), new Date("2021-01-02")]), [new Date("2021-01-01"), new Date("2021-01-02")]); assertSetEqual(union([new Date("2021-01-01"), new Date("2021-01-03")], [new Date("2021-01-01"), new Date("2021-01-02")]), [new Date("2021-01-01"), new Date("2021-01-02"), new Date("2021-01-03")]); }); d3-array-3.1.1/test/variance-test.js000066400000000000000000000060521412622006300172170ustar00rootroot00000000000000import assert from "assert"; import {variance} from "../src/index.js"; it("variance(array) returns the variance of the specified numbers", () => { assert.strictEqual(variance([5, 1, 2, 3, 4]), 2.5); assert.strictEqual(variance([20, 3]), 144.5); assert.strictEqual(variance([3, 20]), 144.5); }); it("variance(array) ignores null, undefined and NaN", () => { assert.strictEqual(variance([NaN, 1, 2, 3, 4, 5]), 2.5); assert.strictEqual(variance([1, 2, 3, 4, 5, NaN]), 2.5); assert.strictEqual(variance([10, null, 3, undefined, 5, NaN]), 13); }); it("variance(array) can handle large numbers without overflowing", () => { assert.strictEqual(variance([Number.MAX_VALUE, Number.MAX_VALUE]), 0); assert.strictEqual(variance([-Number.MAX_VALUE, -Number.MAX_VALUE]), 0); }); it("variance(array) returns undefined if the array has fewer than two numbers", () => { assert.strictEqual(variance([1]), undefined); assert.strictEqual(variance([]), undefined); assert.strictEqual(variance([null]), undefined); assert.strictEqual(variance([undefined]), undefined); assert.strictEqual(variance([NaN]), undefined); assert.strictEqual(variance([NaN, NaN]), undefined); }); it("variance(array, f) returns the variance of the specified numbers", () => { assert.strictEqual(variance([5, 1, 2, 3, 4].map(box), unbox), 2.5); assert.strictEqual(variance([20, 3].map(box), unbox), 144.5); assert.strictEqual(variance([3, 20].map(box), unbox), 144.5); }); it("variance(array, f) ignores null, undefined and NaN", () => { assert.strictEqual(variance([NaN, 1, 2, 3, 4, 5].map(box), unbox), 2.5); assert.strictEqual(variance([1, 2, 3, 4, 5, NaN].map(box), unbox), 2.5); assert.strictEqual(variance([10, null, 3, undefined, 5, NaN].map(box), unbox), 13); }); it("variance(array, f) can handle large numbers without overflowing", () => { assert.strictEqual(variance([Number.MAX_VALUE, Number.MAX_VALUE].map(box), unbox), 0); assert.strictEqual(variance([-Number.MAX_VALUE, -Number.MAX_VALUE].map(box), unbox), 0); }); it("variance(array, f) returns undefined if the array has fewer than two numbers", () => { assert.strictEqual(variance([1].map(box), unbox), undefined); assert.strictEqual(variance([].map(box), unbox), undefined); assert.strictEqual(variance([null].map(box), unbox), undefined); assert.strictEqual(variance([undefined].map(box), unbox), undefined); assert.strictEqual(variance([NaN].map(box), unbox), undefined); assert.strictEqual(variance([NaN, NaN].map(box), unbox), undefined); }); it("variance(array, f) passes the accessor d, i, and array", () => { const results = []; const array = ["a", "b", "c"]; variance(array, (d, i, array) => results.push([d, i, array])); assert.deepStrictEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]); }); it("variance(array, f) uses the undefined context", () => { const results = []; variance([1, 2], function() { results.push(this); }); assert.deepStrictEqual(results, [undefined, undefined]); }); function box(value) { return {value: value}; } function unbox(box) { return box.value; } d3-array-3.1.1/test/zip-test.js000066400000000000000000000017051412622006300162310ustar00rootroot00000000000000import assert from "assert"; import {zip} from "../src/index.js"; it("zip() and zip([]) return an empty array", () => { assert.deepStrictEqual(zip(), []); assert.deepStrictEqual(zip([]), []); }); it("zip([a, b, …]) returns [[a], [b], …]", () => { assert.deepStrictEqual(zip([1, 2, 3, 4, 5]), [[1], [2], [3], [4], [5]]); }); it("zip([a1, b1, …], [a2, b2, …]) returns [[a1, a2], [b1, b2], …]", () => { assert.deepStrictEqual(zip([1, 2], [3, 4]), [[1, 3], [2, 4]]); assert.deepStrictEqual(zip([1, 2, 3, 4, 5], [2, 4, 6, 8, 10]), [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]); }); it("zip([a1, b1, …], [a2, b2, …], [a3, b3, …]) returns [[a1, a2, a3], [b1, b2, b3], …]", () => { assert.deepStrictEqual(zip([1, 2, 3], [4, 5, 6], [7, 8, 9]), [[1, 4, 7], [2, 5, 8], [3, 6, 9]]); }); it("zip(…) ignores extra elements given an irregular matrix", () => { assert.deepStrictEqual(zip([1, 2], [3, 4], [5, 6, 7]), [[1, 3, 5], [2, 4, 6]]); }); d3-array-3.1.1/yarn.lock000066400000000000000000002156141412622006300147660ustar00rootroot00000000000000# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" "@babel/code-frame@^7.10.4": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.14.5.tgz#23b08d740e83f49c5e59945fbf1b43e80bbf4edb" integrity sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw== dependencies: "@babel/highlight" "^7.14.5" "@babel/helper-validator-identifier@^7.14.5": version "7.15.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== "@babel/highlight@^7.10.4", "@babel/highlight@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9" integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg== dependencies: "@babel/helper-validator-identifier" "^7.14.5" chalk "^2.0.0" js-tokens "^4.0.0" "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== dependencies: ajv "^6.12.4" debug "^4.1.1" espree "^7.3.0" globals "^13.9.0" ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" minimatch "^3.0.4" strip-json-comments "^3.1.1" "@humanwhocodes/config-array@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== dependencies: "@humanwhocodes/object-schema" "^1.2.0" debug "^4.1.1" minimatch "^3.0.4" "@humanwhocodes/object-schema@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf" integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w== "@rollup/plugin-node-resolve@13": version "13.0.5" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.0.5.tgz#016abe58796a4ff544d6beac7818921e3d3777fc" integrity sha512-mVaw6uxtvuGx/XCI4qBQXsDZJUfyx5vp39iE0J/7Hd6wDhEbjHr6aES7Nr9yWbuE0BY+oKp6N7Bq6jX5NCGNmQ== dependencies: "@rollup/pluginutils" "^3.1.0" "@types/resolve" "1.17.1" builtin-modules "^3.1.0" deepmerge "^4.2.2" is-module "^1.0.0" resolve "^1.19.0" "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== dependencies: "@types/estree" "0.0.39" estree-walker "^1.0.1" picomatch "^2.2.2" "@tootallnate/once@1": version "1.1.2" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== "@types/node@*": version "16.10.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.2.tgz#5764ca9aa94470adb4e1185fe2e9f19458992b2e" integrity sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ== "@types/resolve@1.17.1": version "1.17.1" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== dependencies: "@types/node" "*" "@ungap/promise-all-settled@1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== abab@^2.0.3, abab@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== acorn-globals@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== dependencies: acorn "^7.1.1" acorn-walk "^7.1.1" acorn-jsx@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^7.1.1: version "7.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== acorn@^7.1.1, acorn@^7.4.0: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== acorn@^8.4.1: version "8.5.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== dependencies: debug "4" ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" ajv@^8.0.1: version "8.6.3" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.3.tgz#11a66527761dc3e9a3845ea775d2d3c0414e8764" integrity sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" require-from-string "^2.0.2" uri-js "^4.2.2" ansi-colors@4.1.1, ansi-colors@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" anymatch@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== dependencies: normalize-path "^3.0.0" picomatch "^2.0.4" argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" argparse@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== dependencies: fill-range "^7.0.1" browser-process-hrtime@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== builtin-modules@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA== callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase@^6.0.0: version "6.2.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== chalk@^2.0.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" supports-color "^5.3.0" chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" chokidar@3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== dependencies: anymatch "~3.1.2" braces "~3.0.2" glob-parent "~5.1.2" is-binary-path "~2.1.0" is-glob "~4.0.1" normalize-path "~3.0.0" readdirp "~3.6.0" optionalDependencies: fsevents "~2.3.2" cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== dependencies: string-width "^4.2.0" strip-ansi "^6.0.0" wrap-ansi "^7.0.0" color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-convert@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: color-name "~1.1.4" color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== dependencies: path-key "^3.1.0" shebang-command "^2.0.0" which "^2.0.1" cssom@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== cssom@~0.3.6: version "0.3.8" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== cssstyle@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== dependencies: cssom "~0.3.6" "d3-random@2 - 3": version "3.0.1" resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-3.0.1.tgz#d4926378d333d9c0bfd1e6fa0194d30aebaa20f4" integrity sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ== data-urls@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.0.tgz#3ff551c986d7c6234a0ac4bbf20a269e1cd6b378" integrity sha512-4AefxbTTdFtxDUdh0BuMBs2qJVL25Mow2zlcuuePegQwgD6GEmQao42LLEeksOui8nL4RcNEugIpFP7eRd33xg== dependencies: abab "^2.0.3" whatwg-mimetype "^2.3.0" whatwg-url "^9.0.0" debug@4, debug@4.3.2, debug@^4.0.1, debug@^4.1.1: version "4.3.2" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== dependencies: ms "2.1.2" decamelize@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== decimal.js@^10.3.1: version "10.3.1" resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.3.1.tgz#d8c3a444a9c6774ba60ca6ad7261c3a94fd5e783" integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ== deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= diff@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== doctrine@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== dependencies: esutils "^2.0.2" domexception@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" integrity sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg== dependencies: webidl-conversions "^5.0.0" emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== enquirer@^2.3.5: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== dependencies: ansi-colors "^4.1.1" escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= escodegen@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" integrity sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw== dependencies: esprima "^4.0.1" estraverse "^5.2.0" esutils "^2.0.2" optionator "^0.8.1" optionalDependencies: source-map "~0.6.1" eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== dependencies: esrecurse "^4.3.0" estraverse "^4.1.1" eslint-utils@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== dependencies: eslint-visitor-keys "^1.1.0" eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== eslint-visitor-keys@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== eslint@7: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== dependencies: "@babel/code-frame" "7.12.11" "@eslint/eslintrc" "^0.4.3" "@humanwhocodes/config-array" "^0.5.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" enquirer "^2.3.5" escape-string-regexp "^4.0.0" eslint-scope "^5.1.1" eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" espree "^7.3.1" esquery "^1.4.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.1.2" globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" progress "^2.0.0" regexpp "^3.1.0" semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" table "^6.0.9" text-table "^0.2.0" v8-compile-cache "^2.0.3" espree@^7.3.0, espree@^7.3.1: version "7.3.1" resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== dependencies: acorn "^7.4.0" acorn-jsx "^5.3.1" eslint-visitor-keys "^1.3.0" esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: estraverse "^5.2.0" estraverse@^4.1.1: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== estraverse@^5.1.0, estraverse@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== estree-walker@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== dependencies: to-regex-range "^5.0.1" find-up@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: locate-path "^6.0.0" path-exists "^4.0.0" flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: flatted "^3.1.0" rimraf "^3.0.2" flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== flatted@^3.1.0: version "3.2.2" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561" integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA== form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" mime-types "^2.1.12" fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@~2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" glob@7.1.7: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" glob@^7.1.3: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" globals@^13.6.0, globals@^13.9.0: version "13.11.0" resolved "https://registry.yarnpkg.com/globals/-/globals-13.11.0.tgz#40ef678da117fe7bd2e28f1fab24951bd0255be7" integrity sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g== dependencies: type-fest "^0.20.2" growl@1.10.5: version "1.10.5" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: function-bind "^1.1.1" he@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== html-encoding-sniffer@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3" integrity sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ== dependencies: whatwg-encoding "^1.0.5" http-proxy-agent@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== dependencies: "@tootallnate/once" "1" agent-base "6" debug "4" https-proxy-agent@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== dependencies: agent-base "6" debug "4" iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" inherits@2: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== "internmap@1 - 2": version "2.0.3" resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== dependencies: binary-extensions "^2.0.0" is-core-module@^2.2.0: version "2.7.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.7.0.tgz#3c0ef7d31b4acfc574f80c58409d568a836848e3" integrity sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ== dependencies: has "^1.0.3" is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== is-potential-custom-element-name@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== is-unicode-supported@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= jest-worker@^26.2.1: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== dependencies: "@types/node" "*" merge-stream "^2.0.0" supports-color "^7.0.0" js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" js-yaml@^3.13.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" esprima "^4.0.0" jsdom@17: version "17.0.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-17.0.0.tgz#3ec82d1d30030649c8defedc45fff6aa3e5d06ae" integrity sha512-MUq4XdqwtNurZDVeKScENMPHnkgmdIvMzZ1r1NSwHkDuaqI6BouPjr+17COo4/19oLNnmdpFDPOHVpgIZmZ+VA== dependencies: abab "^2.0.5" acorn "^8.4.1" acorn-globals "^6.0.0" cssom "^0.5.0" cssstyle "^2.3.0" data-urls "^3.0.0" decimal.js "^10.3.1" domexception "^2.0.1" escodegen "^2.0.0" form-data "^4.0.0" html-encoding-sniffer "^2.0.1" http-proxy-agent "^4.0.1" https-proxy-agent "^5.0.0" is-potential-custom-element-name "^1.0.1" nwsapi "^2.2.0" parse5 "6.0.1" saxes "^5.0.1" symbol-tree "^3.2.4" tough-cookie "^4.0.0" w3c-hr-time "^1.0.2" w3c-xmlserializer "^2.0.0" webidl-conversions "^6.1.0" whatwg-encoding "^1.0.5" whatwg-mimetype "^2.3.0" whatwg-url "^9.0.0" ws "^8.0.0" xml-name-validator "^3.0.0" json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-schema-traverse@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= levn@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: prelude-ls "^1.2.1" type-check "~0.4.0" levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== dependencies: p-locate "^5.0.0" lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= log-symbols@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== dependencies: chalk "^4.1.0" is-unicode-supported "^0.1.0" lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== dependencies: yallist "^4.0.0" merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== mime-db@1.49.0: version "1.49.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.49.0.tgz#f3dfde60c99e9cf3bc9701d687778f537001cbed" integrity sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA== mime-types@^2.1.12: version "2.1.32" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.32.tgz#1d00e89e7de7fe02008db61001d9e02852670fd5" integrity sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A== dependencies: mime-db "1.49.0" minimatch@3.0.4, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" mocha@9: version "9.1.2" resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.1.2.tgz#93f53175b0f0dc4014bd2d612218fccfcf3534d3" integrity sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w== dependencies: "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" browser-stdout "1.3.1" chokidar "3.5.2" debug "4.3.2" diff "5.0.0" escape-string-regexp "4.0.0" find-up "5.0.0" glob "7.1.7" growl "1.10.5" he "1.2.0" js-yaml "4.1.0" log-symbols "4.1.0" minimatch "3.0.4" ms "2.1.3" nanoid "3.1.25" serialize-javascript "6.0.0" strip-json-comments "3.1.1" supports-color "8.1.1" which "2.0.2" workerpool "6.1.5" yargs "16.2.0" yargs-parser "20.2.4" yargs-unparser "2.0.0" ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== ms@2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== nanoid@3.1.25: version "3.1.25" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152" integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q== natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== nwsapi@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== dependencies: deep-is "~0.1.3" fast-levenshtein "~2.0.6" levn "~0.3.0" prelude-ls "~1.1.2" type-check "~0.3.2" word-wrap "~1.2.3" optionator@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== dependencies: deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" word-wrap "^1.2.3" p-limit@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: yocto-queue "^0.1.0" p-locate@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== dependencies: p-limit "^3.0.2" parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" parse5@6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2: version "2.3.0" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= progress@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== psl@^1.1.33: version "1.8.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== dependencies: picomatch "^2.2.1" regexpp@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-from-string@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve@^1.19.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== dependencies: is-core-module "^2.2.0" path-parse "^1.0.6" rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" rollup-plugin-terser@7: version "7.0.2" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ== dependencies: "@babel/code-frame" "^7.10.4" jest-worker "^26.2.1" serialize-javascript "^4.0.0" terser "^5.0.0" rollup@2: version "2.58.0" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.58.0.tgz#a643983365e7bf7f5b7c62a8331b983b7c4c67fb" integrity sha512-NOXpusKnaRpbS7ZVSzcEXqxcLDOagN6iFS8p45RkoiMqPHDLwJm758UF05KlMoCRbLBTZsPOIa887gZJ1AiXvw== optionalDependencies: fsevents "~2.3.2" safe-buffer@^5.1.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== dependencies: xmlchars "^2.2.0" semver@^7.2.1: version "7.3.5" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== dependencies: lru-cache "^6.0.0" serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== dependencies: randombytes "^2.1.0" serialize-javascript@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== dependencies: randombytes "^2.1.0" shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: shebang-regex "^3.0.0" shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== slice-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: ansi-styles "^4.0.0" astral-regex "^2.0.0" is-fullwidth-code-point "^3.0.0" source-map-support@~0.5.20: version "0.5.20" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.20.tgz#12166089f8f5e5e8c56926b377633392dd2cb6c9" integrity sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" source-map@^0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== source-map@~0.7.2: version "0.7.3" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: ansi-regex "^5.0.1" strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== supports-color@8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: has-flag "^4.0.0" supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== table@^6.0.9: version "6.7.2" resolved "https://registry.yarnpkg.com/table/-/table-6.7.2.tgz#a8d39b9f5966693ca8b0feba270a78722cbaf3b0" integrity sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g== dependencies: ajv "^8.0.1" lodash.clonedeep "^4.5.0" lodash.truncate "^4.4.2" slice-ansi "^4.0.0" string-width "^4.2.3" strip-ansi "^6.0.1" terser@^5.0.0: version "5.9.0" resolved "https://registry.yarnpkg.com/terser/-/terser-5.9.0.tgz#47d6e629a522963240f2b55fcaa3c99083d2c351" integrity sha512-h5hxa23sCdpzcye/7b8YqbE5OwKca/ni0RQz1uRX3tGh8haaGHqcuSqbGRybuAKNdntZ0mDgFNXPJ48xQ2RXKQ== dependencies: commander "^2.20.0" source-map "~0.7.2" source-map-support "~0.5.20" text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: is-number "^7.0.0" tough-cookie@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.0.0.tgz#d822234eeca882f991f0f908824ad2622ddbece4" integrity sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg== dependencies: psl "^1.1.33" punycode "^2.1.1" universalify "^0.1.2" tr46@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240" integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw== dependencies: punycode "^2.1.1" type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: prelude-ls "^1.2.1" type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= dependencies: prelude-ls "~1.1.2" type-fest@^0.20.2: version "0.20.2" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== universalify@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" v8-compile-cache@^2.0.3: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== w3c-hr-time@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== dependencies: browser-process-hrtime "^1.0.0" w3c-xmlserializer@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz#3e7104a05b75146cc60f564380b7f683acf1020a" integrity sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA== dependencies: xml-name-validator "^3.0.0" webidl-conversions@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== webidl-conversions@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== whatwg-encoding@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== dependencies: iconv-lite "0.4.24" whatwg-mimetype@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== whatwg-url@^9.0.0: version "9.1.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-9.1.0.tgz#1b112cf237d72cd64fa7882b9c3f6234a1c3050d" integrity sha512-CQ0UcrPHyomtlOCot1TL77WyMIm/bCwrJ2D6AOKGwEczU9EpyoqAokfqrf/MioU9kHcMsmJZcg1egXix2KYEsA== dependencies: tr46 "^2.1.0" webidl-conversions "^6.1.0" which@2.0.2, which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: isexe "^2.0.0" word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== workerpool@6.1.5: version "6.1.5" resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.5.tgz#0f7cf076b6215fd7e1da903ff6f22ddd1886b581" integrity sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw== wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: ansi-styles "^4.0.0" string-width "^4.1.0" strip-ansi "^6.0.0" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= ws@^8.0.0: version "8.2.2" resolved "https://registry.yarnpkg.com/ws/-/ws-8.2.2.tgz#ca684330c6dd6076a737250ed81ac1606cb0a63e" integrity sha512-Q6B6H2oc8QY3llc3cB8kVmQ6pnJWVQbP7Q5algTcIxx7YEpc0oU4NBVHlztA7Ekzfhw2r0rPducMUiCGWKQRzw== xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== xmlchars@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== yargs-parser@^20.2.2: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== yargs-unparser@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== dependencies: camelcase "^6.0.0" decamelize "^4.0.0" flat "^5.0.2" is-plain-obj "^2.1.0" yargs@16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== dependencies: cliui "^7.0.2" escalade "^3.1.1" get-caller-file "^2.0.5" require-directory "^2.1.1" string-width "^4.2.0" y18n "^5.0.5" yargs-parser "^20.2.2" yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==