pax_global_header00006660000000000000000000000064133400717540014516gustar00rootroot0000000000000052 comment=fda02e084d50c880c695a3fe0e59cdf1a1ba5ea9
d3-array-1.2.4/000077500000000000000000000000001334007175400131445ustar00rootroot00000000000000d3-array-1.2.4/.eslintrc.json000066400000000000000000000003421334007175400157370ustar00rootroot00000000000000{
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"rules": {
"no-cond-assign": 0
}
}
d3-array-1.2.4/.gitignore000066400000000000000000000000771334007175400151400ustar00rootroot00000000000000*.sublime-workspace
.DS_Store
dist/
node_modules
npm-debug.log
d3-array-1.2.4/.npmignore000066400000000000000000000000421334007175400151370ustar00rootroot00000000000000*.sublime-*
dist/*.zip
img/
test/
d3-array-1.2.4/LICENSE000066400000000000000000000027031334007175400141530ustar00rootroot00000000000000Copyright 2010-2016 Mike Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
d3-array-1.2.4/README.md000066400000000000000000000764061334007175400144400ustar00rootroot00000000000000# d3-array
Data in JavaScript is often represented by an array, and so one tends to manipulate arrays when visualizing or analyzing data. Some common forms of manipulation include taking a contiguous slice (subset) of an array, filtering an array using a predicate function, and mapping an array to a parallel set of values using a transform function. Before looking at the set of utilities that this module provides, familiarize yourself with the powerful [array methods built-in to JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype).
JavaScript includes **mutation methods** that modify the array:
* [*array*.pop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) - Remove the last element from the array.
* [*array*.push](https://developer.mozilla.org/en-US/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/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) - Reverse the order of the elements of the array.
* [*array*.shift](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) - Remove the first element from the array.
* [*array*.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) - Sort the elements of the array.
* [*array*.splice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) - Add or remove elements from the array.
* [*array*.unshift](https://developer.mozilla.org/en-US/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/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) - Join the array with other array(s) or value(s).
* [*array*.join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join) - Join all elements of the array into a string.
* [*array*.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) - Extract a section of the array.
* [*array*.indexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) - Find the first occurrence of a value within the array.
* [*array*.lastIndexOf](https://developer.mozilla.org/en-US/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/en-US/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/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) - Call a function for each element in the array.
* [*array*.every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) - See if every element in the array satisfies a predicate.
* [*array*.map](https://developer.mozilla.org/en-US/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/en-US/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/en-US/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/en-US/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`. Otherwise, download the [latest release](https://github.com/d3/d3-array/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-array.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
```html
```
[Try d3-array in your browser.](https://tonicdev.com/npm/d3-array)
## API Reference
* [Statistics](#statistics)
* [Search](#search)
* [Transformations](#transformations)
* [Histograms](#histograms)
* [Histogram Thresholds](#histogram-thresholds)
### Statistics
Methods for computing basic summary statistics.
# d3.min(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/min.js "Source")
Returns the minimum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the minimum value.
Unlike the built-in [Math.min](https://developer.mozilla.org/en/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 [scan](#scan) and [extent](#extent).
# d3.max(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/max.js "Source")
Returns the maximum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the maximum value.
Unlike the built-in [Math.max](https://developer.mozilla.org/en/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 [scan](#scan) and [extent](#extent).
# d3.extent(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/extent.js "Source")
Returns the [minimum](#min) and [maximum](#max) value in the given *array* using natural order. If the array is empty, returns [undefined, undefined]. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the extent.
# d3.sum(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/sum.js "Source")
Returns the sum of the given *array* of numbers. If the array is empty, returns 0. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the sum. This method ignores undefined and NaN values; this is useful for ignoring missing data.
# d3.mean(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/mean.js "Source")
Returns the mean of the given *array* of numbers. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the mean. This method ignores undefined and NaN values; this is useful for ignoring missing data.
# d3.median(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/median.js "Source")
Returns the median of the given *array* of numbers using the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample). If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the median. This method ignores undefined and NaN values; this is useful for ignoring missing data.
# d3.quantile(array, p[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/quantile.js "Source")
Returns the *p*-quantile of the given **sorted** *array* 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.variance(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/variance.js "Source")
Returns an [unbiased estimator of the population variance](http://mathworld.wolfram.com/SampleVariance.html) of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data.
# d3.deviation(array[, accessor]) [<>](https://github.com/d3/d3-array/blob/master/src/deviation.js "Source")
Returns the standard deviation, defined as the square root of the [bias-corrected variance](#variance), of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the standard deviation. This method ignores undefined and NaN values; this is useful for ignoring missing data.
### Search
Methods for searching arrays for a specific element.
# d3.scan(array[, comparator]) [<>](https://github.com/d3/d3-array/blob/master/src/scan.js "Source")
Performs a linear scan of the specified *array*, returning the index of the least element according to the specified *comparator*. If the given *array* 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
var array = [{foo: 42}, {foo: 91}];
d3.scan(array, function(a, b) { return a.foo - b.foo; }); // 0
d3.scan(array, function(a, b) { return b.foo - a.foo; }); // 1
```
This function is similar to [min](#min), except it allows the use of a comparator rather than an accessor and it returns the index instead of the accessed value. See also [bisect](#bisect).
# d3.bisectLeft(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js#L6 "Source")
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/en/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]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js "Source")
# d3.bisectRight(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisect.js#L6 "Source")
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.bisector(accessor) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js "Source")
# d3.bisector(comparator) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js "Source")
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]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js#L6 "Source")
Equivalent to [bisectLeft](#bisectLeft), but uses this bisector’s associated comparator.
# bisector.right(array, x[, lo[, hi]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js#L16 "Source")
Equivalent to [bisectRight](#bisectRight), but uses this bisector’s associated comparator.
# d3.ascending(a, b) [<>](https://github.com/d3/d3-array/blob/master/src/ascending.js "Source")
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/en-US/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 < 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) [<>](https://github.com/d3/d3-array/blob/master/src/descending.js "Source")
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 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.cross(a, b[, reducer]) [<>](https://github.com/d3/d3-array/blob/master/src/cross.js "Source")
Returns the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of the two arrays *a* and *b*. For each element *i* in the specified array *a* and each element *j* in the specified array *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(arrays) [<>](https://github.com/d3/d3-array/blob/master/src/merge.js "Source")
Merges the specified *arrays* 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(array[, reducer]) [<>](https://github.com/d3/d3-array/blob/master/src/pairs.js "Source")
For each adjacent pair of elements in the specified *array*, 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 array has fewer than two elements, returns the empty array.
# d3.permute(array, indexes) [<>](https://github.com/d3/d3-array/blob/master/src/permute.js "Source")
Returns a permutation of the specified *array* using the specified array of *indexes*. The returned array contains the corresponding element in array for each index in indexes, in order. For example, permute(["a", "b", "c"], [1, 2, 0])
returns ["b", "c", "a"]. It is acceptable for the array of indexes to be a different length from the array of elements, and for indexes 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
var object = {yield: 27, variety: "Manchuria", year: 1931, site: "University Farm"},
fields = ["site", "variety", "yield"];
d3.permute(object, fields); // returns ["University Farm", "Manchuria", 27]
```
# d3.shuffle(array[, start[, stop]]) [<>](https://github.com/d3/d3-array/blob/master/src/shuffle.js "Source")
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.ticks(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js "Source")
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/master/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) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js#L16 "Source")
Like [d3.tickStep](#tickStep), except requires that *start* is always less than or equal to *step*, 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 avoid guarantee that the returned tick values are represented as precisely as possible in IEEE 754 floating point.
# d3.tickStep(start, stop, count) [<>](https://github.com/d3/d3-array/blob/master/src/ticks.js#L16 "Source")
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.range([start, ]stop[, step]) [<>](https://github.com/d3/d3-array/blob/master/src/range.js "Source")
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/master/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/en-US/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) [<>](https://github.com/d3/d3-array/blob/master/src/transpose.js "Source")
Uses the [zip](#zip) operator as a two-dimensional [matrix transpose](http://en.wikipedia.org/wiki/Transpose).
# d3.zip(arrays…) [<>](https://github.com/d3/d3-array/blob/master/src/zip.js "Source")
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]]
```
### Histograms
[
](http://bl.ocks.org/mbostock/3048450)
Histograms bin many discrete samples into a smaller number of consecutive, non-overlapping intervals. They are often used to visualize the distribution of numerical data.
# d3.histogram() [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js "Source")
Constructs a new histogram generator with the default settings.
# histogram(data) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L14 "Source")
Computes the histogram for the given array 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).
# histogram.value([value]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L58 "Source")
If *value* is specified, sets the value accessor to the specified function or constant and returns this histogram generator. If *value* is not specified, returns the current value accessor, which defaults to the identity function.
When a histogram is [generated](#_histogram), 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 histogram 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.
# histogram.domain([domain]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L62 "Source")
If *domain* is specified, sets the domain accessor to the specified function or array and returns this histogram generator. If *domain* is not specified, returns the current domain accessor, which defaults to [extent](#extent). The histogram 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 histogram is [generated](#_histogram).
For example, if you are using the the histogram in conjunction with a [linear scale](https://github.com/d3/d3-scale/blob/master/README.md#linear-scales) `x`, you might say:
```js
var histogram = d3.histogram()
.domain(x.domain())
.thresholds(x.ticks(20));
```
You can then compute the bins from an array of numbers like so:
```js
var bins = histogram(numbers);
```
Note that the domain accessor is invoked on the materialized array of [values](#histogram_value), not on the input data array.
# histogram.thresholds([count]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L66 "Source")
# histogram.thresholds([thresholds]) [<>](https://github.com/d3/d3-array/blob/master/src/histogram.js#L66 "Source")
If *thresholds* is specified, sets the [threshold generator](#histogram-thresholds) to the specified function or array and returns this histogram generator. If *thresholds* is not specified, returns the current threshold generator, which by default implements [Sturges’ formula](#thresholdSturges). (Thus by default, the histogram values 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 histogram](#_histogram) will have *thresholds*.length + 1 bins. See [histogram thresholds](#histogram-thresholds) for more information.
Any threshold values outside the [domain](#histogram_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](#histogram_domain) will be uniformly divided into approximately *count* bins; see [ticks](#ticks).
### Histogram Thresholds
These functions are typically not used directly; instead, pass them to [*histogram*.thresholds](#histogram_thresholds). You may also implement your own threshold generator taking three arguments: the array of input [*values*](#histogram_value) derived from the data, and the [observable domain](#histogram_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).
# d3.thresholdFreedmanDiaconis(values, min, max) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/freedmanDiaconis.js "Source")
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) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/scott.js "Source")
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) [<>](https://github.com/d3/d3-array/blob/master/src/threshold/sturges.js "Source")
Returns the number of bins according to [Sturges’ formula](https://en.wikipedia.org/wiki/Histogram#Mathematical_definition); the input *values* must be numbers.
d3-array-1.2.4/d3-array.sublime-project000066400000000000000000000005241334007175400176150ustar00rootroot00000000000000{
"folders": [
{
"path": ".",
"file_exclude_patterns": ["*.sublime-workspace"],
"folder_exclude_patterns": ["dist"]
}
],
"build_systems": [
{
"name": "yarn test",
"cmd": ["yarn", "test"],
"file_regex": "\\((...*?):([0-9]*):([0-9]*)\\)",
"working_dir": "$project_path"
}
]
}
d3-array-1.2.4/img/000077500000000000000000000000001334007175400137205ustar00rootroot00000000000000d3-array-1.2.4/img/histogram.png000066400000000000000000000235561334007175400164360ustar00rootroot00000000000000�PNG
IHDR��}��^
�iCCPICC ProfileH���PS��Ͻ�Bc���**!�J��bG\*"��TV����"���,*�X���#�}o�{��3ߜ�|���|�䜙 _f����i�,A��=*:���
�8�)�a�2��AA����w}�����l��_%�N�d!��d�!|
�_����5Ve�gy���A��g�3�-�?Ͻss�B����d
8�~G��l�CF#l�csy["��Jb"됑g�0--}�� ��Ou8�/��drD<�-s�{p3���5��v�o��
�PG��$� �]ٳ��t?��.0�=��,' }������l���S�]�)X|���[`Az��>/u���~C� ������b,pNRX�gs#�.pfJ���wQ^ ��(�}cZ�bo,��ZYIa>�=D��a'xx��p�|~���&?5h��ToQ>3;T�nr�8���X'H�?���VϞ+���_#�r����-I�3x,cC�����wn�'}O��K��b.��$�Y�15�|��bN�rvpf�%d��f�:���fi T��F�X�<�/a �,�Ҁ���f�
�n���
pԁ��h��yp \��6x��x&�G0
A�@THR�� ���� O�
���8�� !��BEP)T �C?C��y�
4݇F�q��F�dXV��a�v���0x9́3�8� ��U�1�
>_�o���+xP$
��2B٢�Q��T"J�ڀ*@��PM�.T�&j���ES�t���G���
��Rt�
��AO��c(%����Da8�U�|L1�ӊ�����|�b�4��냍�&c�bw`a����!�(v����p��@�����Ý�����>�IxU�9����s����Y�
�s�4A��E�'5�]�jB�:a�0M�$��a�d�fb ��x�����D"���H�$.i���B�L!}&K�����X����\K�&�'��P(�J%���RO�@yB�$F3c���6������{#N�w_!�#^,~R���k �����Sb�D�D��]�II���d�d����+�/�pR�R�Rl�<��R�F�(�՝ʢn�VS/RǤ��:��d�B����2R2�22�e�d���P4m��J�E;A�C�"�,�*� �]�I��씜���\�\�\��m�/�tyO��=����
�
�
�+\Tx�(���R,P<��@ V�W
QZ�tT�_iRYE�[��|P���k���J��>��*�TU'U��>�s�/�2tWz*���K�PSR�Q�U�
�M�먇��7�?� j�j$j���ј�T��\�٨�@��e���u@�OkJ[G;R{�v��9�N�N��#]���n�n��-=���^��!�A}X�J?I�L��l`m�58d0d�1�3�V�5"�e5�ӌ��s�ۍߘh�Ę�1�3�nje�jZm��L���,�읹�9˼������b�E��[K��Ö���VV[�z��Y�X����m4m�l�m��J��l��s��hw��}�� �?�R^,�Y���zɨ��#ӱ�q؉��t�i�Y͙�\���EÅ�R���U�5����7S7�[�۔���z�n���G�ǀ��g�g��/u/�W�ׄ���Z�n������e�QϘ��]���G��+�{��/��
�|�� ��%\�,�,d]H_(5tehC��0��]a�uÅ�=���S��E��Q&Q룮E+Ds�;bp1151��<��_6k�{g����˯�PX����J�̕'�0q�q
q_���*�d<#�<~���:�z�va�c�'8&%u�}��a��M��_�p�ܫ��l�Ү*>�=�}�YuDu�O�?��(��|���ׅ������7(5�j�����b�
�8��d�T�Lk.l-�?��|�߉���'�Ni�*o���Amk�&ړڇ;�;�:};{��Z1������32gv�%��;;s.��d7���y��ў�=/D]���;p����K^�.������x���+�Wm��_����o����կ��m�m�w�
v
-:{�����7/�bܺv{���;�w�ݍ�;|�}�����od?�~���Q�c���O��T���[��������O��F_����ױ�g�g��U�0qz�k|�岗c����_��!�G��7��t��"jb���̻����~���34��c��驂O��>�~����������%���u}���h&mf��0�
81�w�P��0Ql�� ���s����9YP�@�&��r -���8k��\la!�(3��|�q��O33��u�M033}hf�[5��}�3�����?��,��l�����5����iTXtXML:com.adobe.xmp
960
500
��2�IDATx���l�����/R�6� =��Qy<�u���[B��rW��1��d�Mg�$;�x��F��sK�.KV��
��@n�=�C!JI8�Bd��+T%�=U(������>-��k��^����<��>��~}�����088���%F4h� �@@h�0�2��s��v��5U~�
4h�p�����-���f�l�y��ٗ�r�B�ޮ�VvY��3��<�8q���4@t�=���kC�h�T}[�֍/��'wތ��ʫ/?�oɦ#e���쾁S�/͊M��|�_�jj ����ă�;������J
ʎ|�4;+����[wޱ5�1�_�/
?R���=��������_7��܈__��9ٿw��%Olmz������EO�xž���y�
0�uu��
��ڗ����{�������3�����fd%�~d� �Q��w��s�����8����&��J�Y�'�p�{e��~���/��ųg~�L�;�m\��
4��7%kb���z�ݧw�8���MG���;�5�\�M�p�&���Se��1�k�� ��� �@@��
h� �@@��
h� �@@��
h� �@@��
h� �@@��
h� �@@��
h� �@@��
h� �@@��
h� �@@��
h� �`�e��U�n����s�
4h� �@@��`$eE�����-�5~K�{/�+�/*�3%������g:����.������R�|���4+����R��ӾK�蚼�d"��<^��K
F0�Y�8��n-�W89�S�w����"q`��/��@2��ҫ�'��<��h슲��@���G�_y7<�@���Mm��+�U^����vmz�2��w�t{�ʩ������g༥�yh:\�79��c�ޣ�{��o��̘8)����峳M`��
0��%�&�ܸ�Gm!���xW�c�x���~�i�����U�3�Þ�0�Y����ɾ���QVpY��.�rS�f��*ȏ�w��7)���
4���������}�e���7xb_�?|}F}MUz?y�~S�Ih��kk��vxs��ٱ1/o��]ow�jO�����y�s/O�h��mT���jx�B�m�{���4h� �@@4h� �@@4h� �@@4h� �@@4\F�ǫ��<��CcM��9a4h� �@@�_��(����E�-,�>�?�<��$ϔ���c��t.(+��]|ɓ�۷��Kn��]W��?�/]����y������H&B����O��`d�� �r�ZϚB�����*q`Ͻ��C(|�k��(�jz�����!䭯)++
�
�DW�#�/��� ���%�aj��ƚ�!��|a�3;�?��;o�=~�ԁ�����
��J���판�x�����u���n���k�'�ߚ\>;۴
g�;���:���fkg_Ȩ�Ǜ��7��w���''�Ѐ���~��8�S��O�(�yJf8~���J�03�VA~,��n�I�{�uC�p�x�����uuc�թ��}��8��_�Q_S�~3y�~S�I��kk�������{��ϛ=5�ZǮt-YR���ٹ�'O4��6*@@�����c�=4-�2:Nl�sb�]���=� �@@��
)O�Ʒ��ܽm�D�ϝ:����{��e��%�6��8dRh ��\PV����'k�oK��9�_K���.�{�Ȓ��>����Bg2T������?k734]��n-�gM
�wh���K�v�.yf8����"��c�;��0��J�rC���
DW�#�/��� gh�ڜ˦N+n�)���/7oΚ¥��Te��x����U��"Ƴt<���s{�+k7o���/]3����{yO���´��yg�i0*�@��_l��ɋ]���%^���魂�+�B�2%Οh�⸎������sS[�fOM�����ee�u�k�ML��0)F�h`����Ȏ?�]�ͳoN����W���j*��Uw���ǟ�d�
��|G�����?���p��#{:��~��~�E%��7�W�h���jx*j;�P`t�4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� �@@4h� ��"�a�����c�=4�T�A�9g4h�0��!p>��熷��N�v��g�8�8y�� ��(�a�]We&�!���o��b�Ë
2N��ɌM�8�X�K{M
0��7�MM�Q�z��������_XR�j������ߺQ= ����+�w�5�7ߝr���zs����?�����?��݄�8�!�)-�&+3�{,q�X��̜��~q�חƒ�>�f>h��)�gm}�����_�z4�Ң��ES�:�6���
��Ӧ����Y!���
������
���{��O�ٗ;�+�7�LOm����m!���]<�
�!���rǞ�y�����lk�N���\Yk0h��ض�z3��h� �@@��
x��Ce��1�k�� +� �@@����ć�H��e��N�<�ubj<��G'u�0$@@��e_-�ʟ�7�ڼ$+6����ה���8��όM�8�X�K{� �0d��֜���w���ӆW���+y�����3�)���������O=��3�����}����l
��l�DG��g{���Kc�g�i3@@�����6m}o���hJ_g�F�4|ؼҩa�gs��
������M����[����������^�O��U�����ok��5�|Y�
4h���
4h���
4h���
4h���
4h���
4h���
4h���
4h����O �`�U�n����V�@@��
.R����̢���#��BY<��G'u�0�����XW~灰k_�Ë
2N�^ˌM�8�X�K{�4p��_V��џ�_��K�^M��W���[7�g���
����+��v�} Lz��sz_�k?i7��9~�+�o��!�zq�חƒ�>�f> ��s�^|Y��McM���Kg��μԫ�ES�:�6\`q�������X�J^��w]:?�ۮTUO�/�n: ��ڵ���?s�K�;oJm���]<�40���k7o�5W�|�
4hO|�>�ʳ�;�5U~0��@��
4h�S�]X�W�}vfQ������Tv�M��o�ɐU����{~���wn�?m��d�ﶿo���u�O��/V���wݕ�{�Y��=���ʟ:/|�����'��D��;_�[Y��=dU�/1��Y���ѱ|u����m��3&�\��@�y(���f�w�қg\�� \��@ç�7��ߓ{�U��w�����&��]���1���ßm�YTPrEh�s�d�Ͻ�=�>ef1+� �@@��s4c��v��5U~�'e>+����?'MV���
�o���Y�f�,*/�%� �10app�B��'L0_��
��M��?�L�`�a�a�a�a��4.п�- �@@����ĝ�� X��1
螞�d��H�߉�dG�Fz ��ޱ����c�i$�)1��i�a�i�n|���8�7z\E����i�Y��v�:��TŬ�k֭X0멦�s��hzj��֭�U�TGDN𑧑>�;ZO^��k��
+&,X�aê9*�D��q��k��Y�jݚ�f�hq��ֲf���뒑?SZ7,���i���p��t���C��a���3o�6���Co�--]{p0F������k���R3i������ӻÇI]�k��4����5ו�5���rz$kKSW���{#~��Z���c��2�4W���_$�7t�ɽᡃ�Q?6:sl���?��U4]_�{�|MD�k���ں7�ܸϙ��p�9�r����>f��?�Z�bn��K�ӈ���R|�K��ztna,�Ә�Բ,�Ӻe�SK���8'�gJH�^�<�pp}ؑ������~��)Җn�LF{ɞ�o�uK+��X��ЙrZ��ks��(�E�L)\�����+֭Y~ãK#l����s�D�2+\�b�S+�~��Ѣ���Ζg?���ٱ��o�qr�4"v$��i�b����'L��a}��b�F�z�9�W-�=ўFϚ+VnY\K:SRo�/�o�S��`�sa���hO#�v.ߐ����%�Z]7B疯��neE~�ϔ�֦g�ΚUX8�:4�tD�*+^V��)K�ڰf���ˉH
'V�i�Q �X�p=��v��8�f���곇vGK4neyQ�q��iY3�oo��|xp�✈O#u���rf-]�bˮ���!8:�H�nxpǎ�*f]���5yy����3%g��e��S��!K�3�dO��H/��*����ўFZ�U��#r ���h˒_�bqł��v-^���c#�xC�����s����ΏR@�Ӣ�sG,?��U[�[-?
c��\Gz�<�����O��l���9��8�G�F4z�it,�����S��Y��y,������-+�����[B4�F�F�x�c��li�^��ëƢ|l$[&LX:tl�4<�#}l��X��8� ��Bq~���?Q4}k�ҊH�n���Qv}>���%�Wѐl]�0�ѻ}u�����S�{�)C4]J�G��ѻ�>�Fi�ؘ��p䏍c�OÙ2������h}�t�i4����U���cQ�Ʈ��C'J����:>z�W�~,�m�����==�X�G��/��I&srr"����?��_���%rcrl��W���8��p��x��rb1ӈ��4�-���O�_�
4h� �
4h� ����f�[Z�IEND�B`�d3-array-1.2.4/package.json000066400000000000000000000030041334007175400154270ustar00rootroot00000000000000{
"name": "d3-array",
"version": "1.2.4",
"description": "Array manipulation, ordering, searching, summarizing, etc.",
"keywords": [
"d3",
"d3-module",
"histogram",
"bisect",
"shuffle",
"statistics",
"search",
"sort",
"array"
],
"homepage": "https://d3js.org/d3-array/",
"license": "BSD-3-Clause",
"author": {
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"main": "dist/d3-array.js",
"unpkg": "dist/d3-array.min.js",
"module": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-array.git"
},
"scripts": {
"pretest": "rollup -c",
"test": "tape 'test/**/*-test.js' && eslint src",
"prepublishOnly": "rm -rf dist && yarn test",
"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 - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
},
"devDependencies": {
"eslint": "5",
"rollup": "0.64",
"rollup-plugin-terser": "1",
"seedrandom": "2",
"tape": "4"
}
}
d3-array-1.2.4/rollup.config.js000066400000000000000000000015451334007175400162700ustar00rootroot00000000000000import {terser} from "rollup-plugin-terser";
import * as meta from "./package.json";
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 ${(new Date).getFullYear()} ${meta.author.name}`,
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"})))
},
plugins: []
};
export default [
config,
{
...config,
output: {
...config.output,
file: `dist/${meta.name}.min.js`
},
plugins: [
...config.plugins,
terser({
output: {
preamble: config.output.banner
}
})
]
}
];
d3-array-1.2.4/src/000077500000000000000000000000001334007175400137335ustar00rootroot00000000000000d3-array-1.2.4/src/array.js000066400000000000000000000001321334007175400154030ustar00rootroot00000000000000var array = Array.prototype;
export var slice = array.slice;
export var map = array.map;
d3-array-1.2.4/src/ascending.js000066400000000000000000000001261334007175400162230ustar00rootroot00000000000000export default function(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
d3-array-1.2.4/src/bisect.js000066400000000000000000000003561334007175400155460ustar00rootroot00000000000000import ascending from "./ascending";
import bisector from "./bisector";
var ascendingBisect = bisector(ascending);
export var bisectRight = ascendingBisect.right;
export var bisectLeft = ascendingBisect.left;
export default bisectRight;
d3-array-1.2.4/src/bisector.js000066400000000000000000000014221334007175400161020ustar00rootroot00000000000000import ascending from "./ascending";
export default function(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
};
}
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
d3-array-1.2.4/src/constant.js000066400000000000000000000001101334007175400161120ustar00rootroot00000000000000export default function(x) {
return function() {
return x;
};
}
d3-array-1.2.4/src/cross.js000066400000000000000000000006541334007175400154270ustar00rootroot00000000000000import {pair} from "./pairs";
export default function(values0, values1, reduce) {
var n0 = values0.length,
n1 = values1.length,
values = new Array(n0 * n1),
i0,
i1,
i,
value0;
if (reduce == null) reduce = pair;
for (i0 = i = 0; i0 < n0; ++i0) {
for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {
values[i] = reduce(value0, values1[i1]);
}
}
return values;
}
d3-array-1.2.4/src/descending.js000066400000000000000000000001261334007175400163730ustar00rootroot00000000000000export default function(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}
d3-array-1.2.4/src/deviation.js000066400000000000000000000002071334007175400162520ustar00rootroot00000000000000import variance from "./variance";
export default function(array, f) {
var v = variance(array, f);
return v ? Math.sqrt(v) : v;
}
d3-array-1.2.4/src/extent.js000066400000000000000000000017011334007175400155770ustar00rootroot00000000000000export default function(values, valueof) {
var n = values.length,
i = -1,
value,
min,
max;
if (valueof == null) {
while (++i < n) { // Find the first comparable value.
if ((value = values[i]) != null && value >= value) {
min = max = value;
while (++i < n) { // Compare the remaining values.
if ((value = values[i]) != null) {
if (min > value) min = value;
if (max < value) max = value;
}
}
}
}
}
else {
while (++i < n) { // Find the first comparable value.
if ((value = valueof(values[i], i, values)) != null && value >= value) {
min = max = value;
while (++i < n) { // Compare the remaining values.
if ((value = valueof(values[i], i, values)) != null) {
if (min > value) min = value;
if (max < value) max = value;
}
}
}
}
}
return [min, max];
}
d3-array-1.2.4/src/histogram.js000066400000000000000000000037061334007175400162740ustar00rootroot00000000000000import {slice} from "./array";
import bisect from "./bisect";
import constant from "./constant";
import extent from "./extent";
import identity from "./identity";
import range from "./range";
import {tickStep} from "./ticks";
import sturges from "./threshold/sturges";
export default function() {
var value = identity,
domain = extent,
threshold = sturges;
function histogram(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.
if (!Array.isArray(tz)) {
tz = tickStep(x0, x1, tz);
tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive
}
// 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 (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-1.2.4/src/identity.js000066400000000000000000000000531334007175400161200ustar00rootroot00000000000000export default function(x) {
return x;
}
d3-array-1.2.4/src/index.js000066400000000000000000000024511334007175400154020ustar00rootroot00000000000000export {default as bisect, bisectRight, bisectLeft} from "./bisect";
export {default as ascending} from "./ascending";
export {default as bisector} from "./bisector";
export {default as cross} from "./cross";
export {default as descending} from "./descending";
export {default as deviation} from "./deviation";
export {default as extent} from "./extent";
export {default as histogram} from "./histogram";
export {default as thresholdFreedmanDiaconis} from "./threshold/freedmanDiaconis";
export {default as thresholdScott} from "./threshold/scott";
export {default as thresholdSturges} from "./threshold/sturges";
export {default as max} from "./max";
export {default as mean} from "./mean";
export {default as median} from "./median";
export {default as merge} from "./merge";
export {default as min} from "./min";
export {default as pairs} from "./pairs";
export {default as permute} from "./permute";
export {default as quantile} from "./quantile";
export {default as range} from "./range";
export {default as scan} from "./scan";
export {default as shuffle} from "./shuffle";
export {default as sum} from "./sum";
export {default as ticks, tickIncrement, tickStep} from "./ticks";
export {default as transpose} from "./transpose";
export {default as variance} from "./variance";
export {default as zip} from "./zip";
d3-array-1.2.4/src/max.js000066400000000000000000000015131334007175400150560ustar00rootroot00000000000000export default function(values, valueof) {
var n = values.length,
i = -1,
value,
max;
if (valueof == null) {
while (++i < n) { // Find the first comparable value.
if ((value = values[i]) != null && value >= value) {
max = value;
while (++i < n) { // Compare the remaining values.
if ((value = values[i]) != null && value > max) {
max = value;
}
}
}
}
}
else {
while (++i < n) { // Find the first comparable value.
if ((value = valueof(values[i], i, values)) != null && value >= value) {
max = value;
while (++i < n) { // Compare the remaining values.
if ((value = valueof(values[i], i, values)) != null && value > max) {
max = value;
}
}
}
}
}
return max;
}
d3-array-1.2.4/src/mean.js000066400000000000000000000007051334007175400152130ustar00rootroot00000000000000import number from "./number";
export default function(values, valueof) {
var n = values.length,
m = n,
i = -1,
value,
sum = 0;
if (valueof == null) {
while (++i < n) {
if (!isNaN(value = number(values[i]))) sum += value;
else --m;
}
}
else {
while (++i < n) {
if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value;
else --m;
}
}
if (m) return sum / m;
}
d3-array-1.2.4/src/median.js000066400000000000000000000010571334007175400155310ustar00rootroot00000000000000import ascending from "./ascending";
import number from "./number";
import quantile from "./quantile";
export default function(values, valueof) {
var n = values.length,
i = -1,
value,
numbers = [];
if (valueof == null) {
while (++i < n) {
if (!isNaN(value = number(values[i]))) {
numbers.push(value);
}
}
}
else {
while (++i < n) {
if (!isNaN(value = number(valueof(values[i], i, values)))) {
numbers.push(value);
}
}
}
return quantile(numbers.sort(ascending), 0.5);
}
d3-array-1.2.4/src/merge.js000066400000000000000000000005231334007175400153700ustar00rootroot00000000000000export default function(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
}
d3-array-1.2.4/src/min.js000066400000000000000000000015131334007175400150540ustar00rootroot00000000000000export default function(values, valueof) {
var n = values.length,
i = -1,
value,
min;
if (valueof == null) {
while (++i < n) { // Find the first comparable value.
if ((value = values[i]) != null && value >= value) {
min = value;
while (++i < n) { // Compare the remaining values.
if ((value = values[i]) != null && min > value) {
min = value;
}
}
}
}
}
else {
while (++i < n) { // Find the first comparable value.
if ((value = valueof(values[i], i, values)) != null && value >= value) {
min = value;
while (++i < n) { // Compare the remaining values.
if ((value = valueof(values[i], i, values)) != null && min > value) {
min = value;
}
}
}
}
}
return min;
}
d3-array-1.2.4/src/number.js000066400000000000000000000000771334007175400155650ustar00rootroot00000000000000export default function(x) {
return x === null ? NaN : +x;
}
d3-array-1.2.4/src/pairs.js000066400000000000000000000004061334007175400154070ustar00rootroot00000000000000export default function(array, f) {
if (f == null) f = pair;
var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = f(p, p = array[++i]);
return pairs;
}
export function pair(a, b) {
return [a, b];
}
d3-array-1.2.4/src/permute.js000066400000000000000000000002411334007175400157470ustar00rootroot00000000000000export default function(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
}
d3-array-1.2.4/src/quantile.js000066400000000000000000000007631334007175400161210ustar00rootroot00000000000000import number from "./number";
export default function(values, p, valueof) {
if (valueof == null) 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-1.2.4/src/range.js000066400000000000000000000005301334007175400153630ustar00rootroot00000000000000export default function(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-1.2.4/src/scan.js000066400000000000000000000006101334007175400152120ustar00rootroot00000000000000import ascending from "./ascending";
export default function(values, compare) {
if (!(n = values.length)) return;
var n,
i = 0,
j = 0,
xi,
xj = values[j];
if (compare == null) compare = ascending;
while (++i < n) {
if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) {
xj = xi, j = i;
}
}
if (compare(xj, xj) === 0) return j;
}
d3-array-1.2.4/src/shuffle.js000066400000000000000000000004351334007175400157270ustar00rootroot00000000000000export default function(array, i0, i1) {
var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
t,
i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0];
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return array;
}
d3-array-1.2.4/src/sum.js000066400000000000000000000005661334007175400151040ustar00rootroot00000000000000export default function(values, valueof) {
var n = values.length,
i = -1,
value,
sum = 0;
if (valueof == null) {
while (++i < n) {
if (value = +values[i]) sum += value; // Note: zero and null are equivalent.
}
}
else {
while (++i < n) {
if (value = +valueof(values[i], i, values)) sum += value;
}
}
return sum;
}
d3-array-1.2.4/src/threshold/000077500000000000000000000000001334007175400157275ustar00rootroot00000000000000d3-array-1.2.4/src/threshold/freedmanDiaconis.js000066400000000000000000000005511334007175400215210ustar00rootroot00000000000000import {map} from "../array";
import ascending from "../ascending";
import number from "../number";
import quantile from "../quantile";
export default function(values, min, max) {
values = map.call(values, number).sort(ascending);
return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3)));
}
d3-array-1.2.4/src/threshold/scott.js000066400000000000000000000002641334007175400174230ustar00rootroot00000000000000import deviation from "../deviation";
export default function(values, min, max) {
return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
}
d3-array-1.2.4/src/threshold/sturges.js000066400000000000000000000001401334007175400177540ustar00rootroot00000000000000export default function(values) {
return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
}
d3-array-1.2.4/src/ticks.js000066400000000000000000000031431334007175400154070ustar00rootroot00000000000000var e10 = Math.sqrt(50),
e5 = Math.sqrt(10),
e2 = Math.sqrt(2);
export default function(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) {
start = Math.ceil(start / step);
stop = Math.floor(stop / step);
ticks = new Array(n = Math.ceil(stop - start + 1));
while (++i < n) ticks[i] = (start + i) * step;
} else {
start = Math.floor(start * step);
stop = Math.ceil(stop * step);
ticks = new Array(n = Math.ceil(start - stop + 1));
while (++i < n) ticks[i] = (start - 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-1.2.4/src/transpose.js000066400000000000000000000005441334007175400163120ustar00rootroot00000000000000import min from "./min";
export default function(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-1.2.4/src/variance.js000066400000000000000000000012101334007175400160530ustar00rootroot00000000000000import number from "./number";
export default function(values, valueof) {
var n = values.length,
m = 0,
i = -1,
mean = 0,
value,
delta,
sum = 0;
if (valueof == null) {
while (++i < n) {
if (!isNaN(value = number(values[i]))) {
delta = value - mean;
mean += delta / ++m;
sum += delta * (value - mean);
}
}
}
else {
while (++i < n) {
if (!isNaN(value = number(valueof(values[i], i, values)))) {
delta = value - mean;
mean += delta / ++m;
sum += delta * (value - mean);
}
}
}
if (m > 1) return sum / (m - 1);
}
d3-array-1.2.4/src/zip.js000066400000000000000000000001431334007175400150710ustar00rootroot00000000000000import transpose from "./transpose";
export default function() {
return transpose(arguments);
}
d3-array-1.2.4/test/000077500000000000000000000000001334007175400141235ustar00rootroot00000000000000d3-array-1.2.4/test/OneTimeNumber.js000066400000000000000000000003021334007175400171650ustar00rootroot00000000000000module.exports = OneTimeNumber;
function OneTimeNumber(value) {
this.value = value;
}
OneTimeNumber.prototype.valueOf = function() {
var v = this.value;
this.value = NaN;
return v;
};
d3-array-1.2.4/test/ascending-test.js000066400000000000000000000020541334007175400173720ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
require("./isNaN");
tape("ascending(a, b) returns a negative number if a < b", function(test) {
test.ok(arrays.ascending(0, 1) < 0);
test.ok(arrays.ascending("a", "b") < 0);
test.end();
});
tape("ascending(a, b) returns a positive number if a > b", function(test) {
test.ok(arrays.ascending(1, 0) > 0);
test.ok(arrays.ascending("b", "a") > 0);
test.end();
});
tape("ascending(a, b) returns zero if a >= b and a <= b", function(test) {
test.equal(arrays.ascending(0, 0), 0);
test.equal(arrays.ascending("a", "a"), 0);
test.equal(arrays.ascending("0", 0), 0);
test.equal(arrays.ascending(0, "0"), 0);
test.end();
});
tape("ascending(a, b) returns NaN if a and b are not comparable", function(test) {
test.isNaN(arrays.ascending(0, undefined));
test.isNaN(arrays.ascending(undefined, 0));
test.isNaN(arrays.ascending(undefined, undefined));
test.isNaN(arrays.ascending(0, NaN));
test.isNaN(arrays.ascending(NaN, 0));
test.isNaN(arrays.ascending(NaN, NaN));
test.end();
});
d3-array-1.2.4/test/bisect-test.js000066400000000000000000000131201334007175400167040ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("bisect is an alias for bisectRight", function(test) {
test.equal(arrays.bisect, arrays.bisectRight);
test.end();
});
tape("bisectLeft(array, value) returns the index of an exact match", function(test) {
var numbers = [1, 2, 3];
test.equal(arrays.bisectLeft(numbers, 1), 0);
test.equal(arrays.bisectLeft(numbers, 2), 1);
test.equal(arrays.bisectLeft(numbers, 3), 2);
test.end();
});
tape("bisectLeft(array, value) returns the index of the first match", function(test) {
var numbers = [1, 2, 2, 3];
test.equal(arrays.bisectLeft(numbers, 1), 0);
test.equal(arrays.bisectLeft(numbers, 2), 1);
test.equal(arrays.bisectLeft(numbers, 3), 3);
test.end();
});
tape("bisectLeft(array, value) returns the insertion point of a non-exact match", function(test) {
var numbers = [1, 2, 3];
test.equal(arrays.bisectLeft(numbers, 0.5), 0);
test.equal(arrays.bisectLeft(numbers, 1.5), 1);
test.equal(arrays.bisectLeft(numbers, 2.5), 2);
test.equal(arrays.bisectLeft(numbers, 3.5), 3);
test.end();
});
tape("bisectLeft(array, value) has undefined behavior if the search value is unorderable", function(test) {
var numbers = [1, 2, 3];
arrays.bisectLeft(numbers, new Date(NaN)); // who knows what this will return!
arrays.bisectLeft(numbers, undefined);
arrays.bisectLeft(numbers, NaN);
test.end();
});
tape("bisectLeft(array, value, lo) observes the specified lower bound", function(test) {
var numbers = [1, 2, 3, 4, 5];
test.equal(arrays.bisectLeft(numbers, 0, 2), 2);
test.equal(arrays.bisectLeft(numbers, 1, 2), 2);
test.equal(arrays.bisectLeft(numbers, 2, 2), 2);
test.equal(arrays.bisectLeft(numbers, 3, 2), 2);
test.equal(arrays.bisectLeft(numbers, 4, 2), 3);
test.equal(arrays.bisectLeft(numbers, 5, 2), 4);
test.equal(arrays.bisectLeft(numbers, 6, 2), 5);
test.end();
});
tape("bisectLeft(array, value, lo, hi) observes the specified bounds", function(test) {
var numbers = [1, 2, 3, 4, 5];
test.equal(arrays.bisectLeft(numbers, 0, 2, 3), 2);
test.equal(arrays.bisectLeft(numbers, 1, 2, 3), 2);
test.equal(arrays.bisectLeft(numbers, 2, 2, 3), 2);
test.equal(arrays.bisectLeft(numbers, 3, 2, 3), 2);
test.equal(arrays.bisectLeft(numbers, 4, 2, 3), 3);
test.equal(arrays.bisectLeft(numbers, 5, 2, 3), 3);
test.equal(arrays.bisectLeft(numbers, 6, 2, 3), 3);
test.end();
});
tape("bisectLeft(array, value) handles large sparse arrays", function(test) {
var numbers = [],
i = 1 << 30;
numbers[i++] = 1;
numbers[i++] = 2;
numbers[i++] = 3;
numbers[i++] = 4;
numbers[i++] = 5;
test.equal(arrays.bisectLeft(numbers, 0, i - 5, i), i - 5);
test.equal(arrays.bisectLeft(numbers, 1, i - 5, i), i - 5);
test.equal(arrays.bisectLeft(numbers, 2, i - 5, i), i - 4);
test.equal(arrays.bisectLeft(numbers, 3, i - 5, i), i - 3);
test.equal(arrays.bisectLeft(numbers, 4, i - 5, i), i - 2);
test.equal(arrays.bisectLeft(numbers, 5, i - 5, i), i - 1);
test.equal(arrays.bisectLeft(numbers, 6, i - 5, i), i - 0);
test.end();
});
tape("bisectRight(array, value) returns the index after an exact match", function(test) {
var numbers = [1, 2, 3];
test.equal(arrays.bisectRight(numbers, 1), 1);
test.equal(arrays.bisectRight(numbers, 2), 2);
test.equal(arrays.bisectRight(numbers, 3), 3);
test.end();
});
tape("bisectRight(array, value) returns the index after the last match", function(test) {
var numbers = [1, 2, 2, 3];
test.equal(arrays.bisectRight(numbers, 1), 1);
test.equal(arrays.bisectRight(numbers, 2), 3);
test.equal(arrays.bisectRight(numbers, 3), 4);
test.end();
});
tape("bisectRight(array, value) returns the insertion point of a non-exact match", function(test) {
var numbers = [1, 2, 3];
test.equal(arrays.bisectRight(numbers, 0.5), 0);
test.equal(arrays.bisectRight(numbers, 1.5), 1);
test.equal(arrays.bisectRight(numbers, 2.5), 2);
test.equal(arrays.bisectRight(numbers, 3.5), 3);
test.end();
});
tape("bisectRight(array, value, lo) observes the specified lower bound", function(test) {
var numbers = [1, 2, 3, 4, 5];
test.equal(arrays.bisectRight(numbers, 0, 2), 2);
test.equal(arrays.bisectRight(numbers, 1, 2), 2);
test.equal(arrays.bisectRight(numbers, 2, 2), 2);
test.equal(arrays.bisectRight(numbers, 3, 2), 3);
test.equal(arrays.bisectRight(numbers, 4, 2), 4);
test.equal(arrays.bisectRight(numbers, 5, 2), 5);
test.equal(arrays.bisectRight(numbers, 6, 2), 5);
test.end();
});
tape("bisectRight(array, value, lo, hi) observes the specified bounds", function(test) {
var numbers = [1, 2, 3, 4, 5];
test.equal(arrays.bisectRight(numbers, 0, 2, 3), 2);
test.equal(arrays.bisectRight(numbers, 1, 2, 3), 2);
test.equal(arrays.bisectRight(numbers, 2, 2, 3), 2);
test.equal(arrays.bisectRight(numbers, 3, 2, 3), 3);
test.equal(arrays.bisectRight(numbers, 4, 2, 3), 3);
test.equal(arrays.bisectRight(numbers, 5, 2, 3), 3);
test.equal(arrays.bisectRight(numbers, 6, 2, 3), 3);
test.end();
});
tape("bisectRight(array, value) handles large sparse arrays", function(test) {
var numbers = [],
i = 1 << 30;
numbers[i++] = 1;
numbers[i++] = 2;
numbers[i++] = 3;
numbers[i++] = 4;
numbers[i++] = 5;
test.equal(arrays.bisectRight(numbers, 0, i - 5, i), i - 5);
test.equal(arrays.bisectRight(numbers, 1, i - 5, i), i - 4);
test.equal(arrays.bisectRight(numbers, 2, i - 5, i), i - 3);
test.equal(arrays.bisectRight(numbers, 3, i - 5, i), i - 2);
test.equal(arrays.bisectRight(numbers, 4, i - 5, i), i - 1);
test.equal(arrays.bisectRight(numbers, 5, i - 5, i), i - 0);
test.equal(arrays.bisectRight(numbers, 6, i - 5, i), i - 0);
test.end();
});
d3-array-1.2.4/test/bisector-test.js000066400000000000000000000301241334007175400172500ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("bisector(comparator).left(array, value) returns the index of an exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectLeft = arrays.bisector(ascendingBox).left;
test.equal(bisectLeft(boxes, box(1)), 0);
test.equal(bisectLeft(boxes, box(2)), 1);
test.equal(bisectLeft(boxes, box(3)), 2);
test.end();
});
tape("bisector(comparator).left(array, value) returns the index of the first match", function(test) {
var boxes = [1, 2, 2, 3].map(box),
bisectLeft = arrays.bisector(ascendingBox).left;
test.equal(bisectLeft(boxes, box(1)), 0);
test.equal(bisectLeft(boxes, box(2)), 1);
test.equal(bisectLeft(boxes, box(3)), 3);
test.end();
});
tape("bisector(comparator).left(array, value) returns the insertion point of a non-exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectLeft = arrays.bisector(ascendingBox).left;
test.equal(bisectLeft(boxes, box(0.5)), 0);
test.equal(bisectLeft(boxes, box(1.5)), 1);
test.equal(bisectLeft(boxes, box(2.5)), 2);
test.equal(bisectLeft(boxes, box(3.5)), 3);
test.end();
});
tape("bisector(comparator).left(array, value) has undefined behavior if the search value is unorderable", function(test) {
var boxes = [1, 2, 3].map(box),
bisectLeft = arrays.bisector(ascendingBox).left;
bisectLeft(boxes, box(new Date(NaN))); // who knows what this will return!
bisectLeft(boxes, box(undefined));
bisectLeft(boxes, box(NaN));
test.end();
});
tape("bisector(comparator).left(array, value, lo) observes the specified lower bound", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectLeft = arrays.bisector(ascendingBox).left;
test.equal(bisectLeft(boxes, box(0), 2), 2);
test.equal(bisectLeft(boxes, box(1), 2), 2);
test.equal(bisectLeft(boxes, box(2), 2), 2);
test.equal(bisectLeft(boxes, box(3), 2), 2);
test.equal(bisectLeft(boxes, box(4), 2), 3);
test.equal(bisectLeft(boxes, box(5), 2), 4);
test.equal(bisectLeft(boxes, box(6), 2), 5);
test.end();
});
tape("bisector(comparator).left(array, value, lo, hi) observes the specified bounds", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectLeft = arrays.bisector(ascendingBox).left;
test.equal(bisectLeft(boxes, box(0), 2, 3), 2);
test.equal(bisectLeft(boxes, box(1), 2, 3), 2);
test.equal(bisectLeft(boxes, box(2), 2, 3), 2);
test.equal(bisectLeft(boxes, box(3), 2, 3), 2);
test.equal(bisectLeft(boxes, box(4), 2, 3), 3);
test.equal(bisectLeft(boxes, box(5), 2, 3), 3);
test.equal(bisectLeft(boxes, box(6), 2, 3), 3);
test.end();
});
tape("bisector(comparator).left(array, value) handles large sparse arrays", function(test) {
var boxes = [],
bisectLeft = arrays.bisector(ascendingBox).left,
i = 1 << 30;
boxes[i++] = box(1);
boxes[i++] = box(2);
boxes[i++] = box(3);
boxes[i++] = box(4);
boxes[i++] = box(5);
test.equal(bisectLeft(boxes, box(0), i - 5, i), i - 5);
test.equal(bisectLeft(boxes, box(1), i - 5, i), i - 5);
test.equal(bisectLeft(boxes, box(2), i - 5, i), i - 4);
test.equal(bisectLeft(boxes, box(3), i - 5, i), i - 3);
test.equal(bisectLeft(boxes, box(4), i - 5, i), i - 2);
test.equal(bisectLeft(boxes, box(5), i - 5, i), i - 1);
test.equal(bisectLeft(boxes, box(6), i - 5, i), i - 0);
test.end();
});
tape("bisector(comparator).right(array, value) returns the index after an exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectRight = arrays.bisector(ascendingBox).right;
test.equal(bisectRight(boxes, box(1)), 1);
test.equal(bisectRight(boxes, box(2)), 2);
test.equal(bisectRight(boxes, box(3)), 3);
test.end();
});
tape("bisector(comparator).right(array, value) returns the index after the last match", function(test) {
var boxes = [1, 2, 2, 3].map(box),
bisectRight = arrays.bisector(ascendingBox).right;
test.equal(bisectRight(boxes, box(1)), 1);
test.equal(bisectRight(boxes, box(2)), 3);
test.equal(bisectRight(boxes, box(3)), 4);
test.end();
});
tape("bisector(comparator).right(array, value) returns the insertion point of a non-exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectRight = arrays.bisector(ascendingBox).right;
test.equal(bisectRight(boxes, box(0.5)), 0);
test.equal(bisectRight(boxes, box(1.5)), 1);
test.equal(bisectRight(boxes, box(2.5)), 2);
test.equal(bisectRight(boxes, box(3.5)), 3);
test.end();
});
tape("bisector(comparator).right(array, value, lo) observes the specified lower bound", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectRight = arrays.bisector(ascendingBox).right;
test.equal(bisectRight(boxes, box(0), 2), 2);
test.equal(bisectRight(boxes, box(1), 2), 2);
test.equal(bisectRight(boxes, box(2), 2), 2);
test.equal(bisectRight(boxes, box(3), 2), 3);
test.equal(bisectRight(boxes, box(4), 2), 4);
test.equal(bisectRight(boxes, box(5), 2), 5);
test.equal(bisectRight(boxes, box(6), 2), 5);
test.end();
});
tape("bisector(comparator).right(array, value, lo, hi) observes the specified bounds", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectRight = arrays.bisector(ascendingBox).right;
test.equal(bisectRight(boxes, box(0), 2, 3), 2);
test.equal(bisectRight(boxes, box(1), 2, 3), 2);
test.equal(bisectRight(boxes, box(2), 2, 3), 2);
test.equal(bisectRight(boxes, box(3), 2, 3), 3);
test.equal(bisectRight(boxes, box(4), 2, 3), 3);
test.equal(bisectRight(boxes, box(5), 2, 3), 3);
test.equal(bisectRight(boxes, box(6), 2, 3), 3);
test.end();
});
tape("bisector(comparator).right(array, value) handles large sparse arrays", function(test) {
var boxes = [],
bisectRight = arrays.bisector(ascendingBox).right,
i = 1 << 30;
boxes[i++] = box(1);
boxes[i++] = box(2);
boxes[i++] = box(3);
boxes[i++] = box(4);
boxes[i++] = box(5);
test.equal(bisectRight(boxes, box(0), i - 5, i), i - 5);
test.equal(bisectRight(boxes, box(1), i - 5, i), i - 4);
test.equal(bisectRight(boxes, box(2), i - 5, i), i - 3);
test.equal(bisectRight(boxes, box(3), i - 5, i), i - 2);
test.equal(bisectRight(boxes, box(4), i - 5, i), i - 1);
test.equal(bisectRight(boxes, box(5), i - 5, i), i - 0);
test.equal(bisectRight(boxes, box(6), i - 5, i), i - 0);
test.end();
});
tape("bisector(accessor).left(array, value) returns the index of an exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectLeft = arrays.bisector(unbox).left;
test.equal(bisectLeft(boxes, 1), 0);
test.equal(bisectLeft(boxes, 2), 1);
test.equal(bisectLeft(boxes, 3), 2);
test.end();
});
tape("bisector(accessor).left(array, value) returns the index of the first match", function(test) {
var boxes = [1, 2, 2, 3].map(box),
bisectLeft = arrays.bisector(unbox).left;
test.equal(bisectLeft(boxes, 1), 0);
test.equal(bisectLeft(boxes, 2), 1);
test.equal(bisectLeft(boxes, 3), 3);
test.end();
});
tape("bisector(accessor).left(array, value) returns the insertion point of a non-exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectLeft = arrays.bisector(unbox).left;
test.equal(bisectLeft(boxes, 0.5), 0);
test.equal(bisectLeft(boxes, 1.5), 1);
test.equal(bisectLeft(boxes, 2.5), 2);
test.equal(bisectLeft(boxes, 3.5), 3);
test.end();
});
tape("bisector(accessor).left(array, value) has undefined behavior if the search value is unorderable", function(test) {
var boxes = [1, 2, 3].map(box),
bisectLeft = arrays.bisector(unbox).left;
bisectLeft(boxes, new Date(NaN)); // who knows what this will return!
bisectLeft(boxes, undefined);
bisectLeft(boxes, NaN);
test.end();
});
tape("bisector(accessor).left(array, value, lo) observes the specified lower bound", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectLeft = arrays.bisector(unbox).left;
test.equal(bisectLeft(boxes, 0, 2), 2);
test.equal(bisectLeft(boxes, 1, 2), 2);
test.equal(bisectLeft(boxes, 2, 2), 2);
test.equal(bisectLeft(boxes, 3, 2), 2);
test.equal(bisectLeft(boxes, 4, 2), 3);
test.equal(bisectLeft(boxes, 5, 2), 4);
test.equal(bisectLeft(boxes, 6, 2), 5);
test.end();
});
tape("bisector(accessor).left(array, value, lo, hi) observes the specified bounds", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectLeft = arrays.bisector(unbox).left;
test.equal(bisectLeft(boxes, 0, 2, 3), 2);
test.equal(bisectLeft(boxes, 1, 2, 3), 2);
test.equal(bisectLeft(boxes, 2, 2, 3), 2);
test.equal(bisectLeft(boxes, 3, 2, 3), 2);
test.equal(bisectLeft(boxes, 4, 2, 3), 3);
test.equal(bisectLeft(boxes, 5, 2, 3), 3);
test.equal(bisectLeft(boxes, 6, 2, 3), 3);
test.end();
});
tape("bisector(accessor).left(array, value) handles large sparse arrays", function(test) {
var boxes = [],
bisectLeft = arrays.bisector(unbox).left,
i = 1 << 30;
boxes[i++] = box(1);
boxes[i++] = box(2);
boxes[i++] = box(3);
boxes[i++] = box(4);
boxes[i++] = box(5);
test.equal(bisectLeft(boxes, 0, i - 5, i), i - 5);
test.equal(bisectLeft(boxes, 1, i - 5, i), i - 5);
test.equal(bisectLeft(boxes, 2, i - 5, i), i - 4);
test.equal(bisectLeft(boxes, 3, i - 5, i), i - 3);
test.equal(bisectLeft(boxes, 4, i - 5, i), i - 2);
test.equal(bisectLeft(boxes, 5, i - 5, i), i - 1);
test.equal(bisectLeft(boxes, 6, i - 5, i), i - 0);
test.end();
});
tape("bisector(accessor).right(array, value) returns the index after an exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectRight = arrays.bisector(unbox).right;
test.equal(bisectRight(boxes, 1), 1);
test.equal(bisectRight(boxes, 2), 2);
test.equal(bisectRight(boxes, 3), 3);
test.end();
});
tape("bisector(accessor).right(array, value) returns the index after the last match", function(test) {
var boxes = [1, 2, 2, 3].map(box),
bisectRight = arrays.bisector(unbox).right;
test.equal(bisectRight(boxes, 1), 1);
test.equal(bisectRight(boxes, 2), 3);
test.equal(bisectRight(boxes, 3), 4);
test.end();
});
tape("bisector(accessor).right(array, value) returns the insertion point of a non-exact match", function(test) {
var boxes = [1, 2, 3].map(box),
bisectRight = arrays.bisector(unbox).right;
test.equal(bisectRight(boxes, 0.5), 0);
test.equal(bisectRight(boxes, 1.5), 1);
test.equal(bisectRight(boxes, 2.5), 2);
test.equal(bisectRight(boxes, 3.5), 3);
test.end();
});
tape("bisector(accessor).right(array, value, lo) observes the specified lower bound", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectRight = arrays.bisector(unbox).right;
test.equal(bisectRight(boxes, 0, 2), 2);
test.equal(bisectRight(boxes, 1, 2), 2);
test.equal(bisectRight(boxes, 2, 2), 2);
test.equal(bisectRight(boxes, 3, 2), 3);
test.equal(bisectRight(boxes, 4, 2), 4);
test.equal(bisectRight(boxes, 5, 2), 5);
test.equal(bisectRight(boxes, 6, 2), 5);
test.end();
});
tape("bisector(accessor).right(array, value, lo, hi) observes the specified bounds", function(test) {
var boxes = [1, 2, 3, 4, 5].map(box),
bisectRight = arrays.bisector(unbox).right;
test.equal(bisectRight(boxes, 0, 2, 3), 2);
test.equal(bisectRight(boxes, 1, 2, 3), 2);
test.equal(bisectRight(boxes, 2, 2, 3), 2);
test.equal(bisectRight(boxes, 3, 2, 3), 3);
test.equal(bisectRight(boxes, 4, 2, 3), 3);
test.equal(bisectRight(boxes, 5, 2, 3), 3);
test.equal(bisectRight(boxes, 6, 2, 3), 3);
test.end();
});
tape("bisector(accessor).right(array, value) handles large sparse arrays", function(test) {
var boxes = [],
bisectRight = arrays.bisector(unbox).right,
i = 1 << 30;
boxes[i++] = box(1);
boxes[i++] = box(2);
boxes[i++] = box(3);
boxes[i++] = box(4);
boxes[i++] = box(5);
test.equal(bisectRight(boxes, 0, i - 5, i), i - 5);
test.equal(bisectRight(boxes, 1, i - 5, i), i - 4);
test.equal(bisectRight(boxes, 2, i - 5, i), i - 3);
test.equal(bisectRight(boxes, 3, i - 5, i), i - 2);
test.equal(bisectRight(boxes, 4, i - 5, i), i - 1);
test.equal(bisectRight(boxes, 5, i - 5, i), i - 0);
test.equal(bisectRight(boxes, 6, i - 5, i), i - 0);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
function ascendingBox(a, b) {
return arrays.ascending(a.value, b.value);
}
d3-array-1.2.4/test/cross-test.js000066400000000000000000000006651334007175400165760ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("cross(a, b) returns Cartesian product a×b", function(test) {
test.deepEqual(arrays.cross([1, 2], ["x", "y"]), [[1, "x"], [1, "y"], [2, "x"], [2, "y"]]);
test.end();
});
tape("cross(a, b, f) invokes the specified function for each pair", function(test) {
test.deepEqual(arrays.cross([1, 2], ["x", "y"], (a, b) => a + b), ["1x", "1y", "2x", "2y"]);
test.end();
});
d3-array-1.2.4/test/descending-test.js000066400000000000000000000020761334007175400175460ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
require("./isNaN");
tape("descending(a, b) returns a positive number if a < b", function(test) {
test.ok(arrays.descending(0, 1) > 0);
test.ok(arrays.descending("a", "b") > 0);
test.end();
});
tape("descending(a, b) returns a negative number if a > b", function(test) {
test.ok(arrays.descending(1, 0) < 0);
test.ok(arrays.descending("b", "a") < 0);
test.end();
});
tape("descending(a, b) returns zero if a >= b and a <= b", function(test) {
test.equal(arrays.descending(0, 0), 0);
test.equal(arrays.descending("a", "a"), 0);
test.equal(arrays.descending("0", 0), 0);
test.equal(arrays.descending(0, "0"), 0);
test.end();
});
tape("descending(a, b) returns NaN if a and b are not comparable", function(test) {
test.isNaN(arrays.descending(0, undefined));
test.isNaN(arrays.descending(undefined, 0));
test.isNaN(arrays.descending(undefined, undefined));
test.isNaN(arrays.descending(0, NaN));
test.isNaN(arrays.descending(NaN, 0));
test.isNaN(arrays.descending(NaN, NaN));
test.end();
});
d3-array-1.2.4/test/deviation-test.js000066400000000000000000000056271334007175400174320ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("deviation(array) returns the standard deviation of the specified numbers", function(test) {
test.equal(arrays.deviation([5, 1, 2, 3, 4]), Math.sqrt(2.5));
test.equal(arrays.deviation([20, 3]), Math.sqrt(144.5));
test.equal(arrays.deviation([3, 20]), Math.sqrt(144.5));
test.end();
});
tape("deviation(array) ignores null, undefined and NaN", function(test) {
test.equal(arrays.deviation([NaN, 1, 2, 3, 4, 5]), Math.sqrt(2.5));
test.equal(arrays.deviation([1, 2, 3, 4, 5, NaN]), Math.sqrt(2.5));
test.equal(arrays.deviation([10, null, 3, undefined, 5, NaN]), Math.sqrt(13));
test.end();
});
tape("deviation(array) can handle large numbers without overflowing", function(test) {
test.equal(arrays.deviation([Number.MAX_VALUE, Number.MAX_VALUE]), 0);
test.equal(arrays.deviation([-Number.MAX_VALUE, -Number.MAX_VALUE]), 0);
test.end();
});
tape("deviation(array) returns undefined if the array has fewer than two numbers", function(test) {
test.equal(arrays.deviation([1]), undefined);
test.equal(arrays.deviation([]), undefined);
test.equal(arrays.deviation([null]), undefined);
test.equal(arrays.deviation([undefined]), undefined);
test.equal(arrays.deviation([NaN]), undefined);
test.equal(arrays.deviation([NaN, NaN]), undefined);
test.end();
});
tape("deviation(array, f) returns the deviation of the specified numbers", function(test) {
test.equal(arrays.deviation([5, 1, 2, 3, 4].map(box), unbox), Math.sqrt(2.5));
test.equal(arrays.deviation([20, 3].map(box), unbox), Math.sqrt(144.5));
test.equal(arrays.deviation([3, 20].map(box), unbox), Math.sqrt(144.5));
test.end();
});
tape("deviation(array, f) ignores null, undefined and NaN", function(test) {
test.equal(arrays.deviation([NaN, 1, 2, 3, 4, 5].map(box), unbox), Math.sqrt(2.5));
test.equal(arrays.deviation([1, 2, 3, 4, 5, NaN].map(box), unbox), Math.sqrt(2.5));
test.equal(arrays.deviation([10, null, 3, undefined, 5, NaN].map(box), unbox), Math.sqrt(13));
test.end();
});
tape("deviation(array, f) can handle large numbers without overflowing", function(test) {
test.equal(arrays.deviation([Number.MAX_VALUE, Number.MAX_VALUE].map(box), unbox), 0);
test.equal(arrays.deviation([-Number.MAX_VALUE, -Number.MAX_VALUE].map(box), unbox), 0);
test.end();
});
tape("deviation(array, f) returns undefined if the array has fewer than two numbers", function(test) {
test.equal(arrays.deviation([1].map(box), unbox), undefined);
test.equal(arrays.deviation([].map(box), unbox), undefined);
test.equal(arrays.deviation([null].map(box), unbox), undefined);
test.equal(arrays.deviation([undefined].map(box), unbox), undefined);
test.equal(arrays.deviation([NaN].map(box), unbox), undefined);
test.equal(arrays.deviation([NaN, NaN].map(box), unbox), undefined);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/extent-test.js000066400000000000000000000114171334007175400167510ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("extent(array) returns the least and greatest numeric values for numbers", function(test) {
test.deepEqual(arrays.extent([1]), [1, 1]);
test.deepEqual(arrays.extent([5, 1, 2, 3, 4]), [1, 5]);
test.deepEqual(arrays.extent([20, 3]), [3, 20]);
test.deepEqual(arrays.extent([3, 20]), [3, 20]);
test.end();
});
tape("extent(array) returns the least and greatest lexicographic value for strings", function(test) {
test.deepEqual(arrays.extent(["c", "a", "b"]), ["a", "c"]);
test.deepEqual(arrays.extent(["20", "3"]), ["20", "3"]);
test.deepEqual(arrays.extent(["3", "20"]), ["20", "3"]);
test.end();
});
tape("extent(array) ignores null, undefined and NaN", function(test) {
var o = {valueOf: function() { return NaN; }};
test.deepEqual(arrays.extent([NaN, 1, 2, 3, 4, 5]), [1, 5]);
test.deepEqual(arrays.extent([o, 1, 2, 3, 4, 5]), [1, 5]);
test.deepEqual(arrays.extent([1, 2, 3, 4, 5, NaN]), [1, 5]);
test.deepEqual(arrays.extent([1, 2, 3, 4, 5, o]), [1, 5]);
test.deepEqual(arrays.extent([10, null, 3, undefined, 5, NaN]), [3, 10]);
test.deepEqual(arrays.extent([-1, null, -3, undefined, -5, NaN]), [-5, -1]);
test.end();
});
tape("extent(array) compares heterogenous types as numbers", function(test) {
test.deepEqual(arrays.extent([20, "3"]), ["3", 20]);
test.deepEqual(arrays.extent(["20", 3]), [3, "20"]);
test.deepEqual(arrays.extent([3, "20"]), [3, "20"]);
test.deepEqual(arrays.extent(["3", 20]), ["3", 20]);
test.end();
});
tape("extent(array) returns undefined if the array contains no numbers", function(test) {
test.deepEqual(arrays.extent([]), [undefined, undefined]);
test.deepEqual(arrays.extent([null]), [undefined, undefined]);
test.deepEqual(arrays.extent([undefined]), [undefined, undefined]);
test.deepEqual(arrays.extent([NaN]), [undefined, undefined]);
test.deepEqual(arrays.extent([NaN, NaN]), [undefined, undefined]);
test.end();
});
tape("extent(array, f) returns the least and greatest numeric value for numbers", function(test) {
test.deepEqual(arrays.extent([1].map(box), unbox), [1, 1]);
test.deepEqual(arrays.extent([5, 1, 2, 3, 4].map(box), unbox), [1, 5]);
test.deepEqual(arrays.extent([20, 3].map(box), unbox), [3, 20]);
test.deepEqual(arrays.extent([3, 20].map(box), unbox), [3, 20]);
test.end();
});
tape("extent(array, f) returns the least and greatest lexicographic value for strings", function(test) {
test.deepEqual(arrays.extent(["c", "a", "b"].map(box), unbox), ["a", "c"]);
test.deepEqual(arrays.extent(["20", "3"].map(box), unbox), ["20", "3"]);
test.deepEqual(arrays.extent(["3", "20"].map(box), unbox), ["20", "3"]);
test.end();
});
tape("extent(array, f) ignores null, undefined and NaN", function(test) {
var o = {valueOf: function() { return NaN; }};
test.deepEqual(arrays.extent([NaN, 1, 2, 3, 4, 5].map(box), unbox), [1, 5]);
test.deepEqual(arrays.extent([o, 1, 2, 3, 4, 5].map(box), unbox), [1, 5]);
test.deepEqual(arrays.extent([1, 2, 3, 4, 5, NaN].map(box), unbox), [1, 5]);
test.deepEqual(arrays.extent([1, 2, 3, 4, 5, o].map(box), unbox), [1, 5]);
test.deepEqual(arrays.extent([10, null, 3, undefined, 5, NaN].map(box), unbox), [3, 10]);
test.deepEqual(arrays.extent([-1, null, -3, undefined, -5, NaN].map(box), unbox), [-5, -1]);
test.end();
});
tape("extent(array, f) compares heterogenous types as numbers", function(test) {
test.deepEqual(arrays.extent([20, "3"].map(box), unbox), ["3", 20]);
test.deepEqual(arrays.extent(["20", 3].map(box), unbox), [3, "20"]);
test.deepEqual(arrays.extent([3, "20"].map(box), unbox), [3, "20"]);
test.deepEqual(arrays.extent(["3", 20].map(box), unbox), ["3", 20]);
test.end();
});
tape("extent(array, f) returns undefined if the array contains no observed values", function(test) {
test.deepEqual(arrays.extent([].map(box), unbox), [undefined, undefined]);
test.deepEqual(arrays.extent([null].map(box), unbox), [undefined, undefined]);
test.deepEqual(arrays.extent([undefined].map(box), unbox), [undefined, undefined]);
test.deepEqual(arrays.extent([NaN].map(box), unbox), [undefined, undefined]);
test.deepEqual(arrays.extent([NaN, NaN].map(box), unbox), [undefined, undefined]);
test.end();
});
tape("extent(array, f) passes the accessor d, i, and array", function(test) {
var results = [], array = ["a", "b", "c"];
arrays.extent(array, function(d, i, array) { results.push([d, i, array]); });
test.deepEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]);
test.end();
});
tape("extent(array, f) uses the global context", function(test) {
var results = [];
arrays.extent([1, 2], function() { results.push(this); });
test.deepEqual(results, [global, global]);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/histogram-test.js000066400000000000000000000100771334007175400174400ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("histogram() returns a default histogram generator", function(test) {
var h = arrays.histogram();
test.equal(h.value()(42), 42);
test.equal(h.domain(), arrays.extent);
test.deepEqual(h.thresholds(), arrays.thresholdSturges);
test.end();
});
tape("histogram(data) computes a histogram of the specified array of data", function(test) {
var h = arrays.histogram();
test.deepEqual(h([0, 0, 0, 10, 20, 20]), [
bin([0, 0, 0], 0, 5),
bin([], 5, 10),
bin([10], 10, 15),
bin([20, 20], 15, 20) // Note: inclusive upper bound for last bin.
]);
test.end();
});
tape("histogram.value(number) sets the constant value", function(test) {
var h = arrays.histogram().value(12); // Pointless, but for consistency.
test.deepEqual(h([0, 0, 0, 1, 2, 2]), [
bin([0, 0, 0, 1, 2, 2], 12, 12),
]);
test.end();
});
tape("histogram.value(function) sets the value accessor", function(test) {
var h = arrays.histogram().value(function(d) { return d.value; }),
a = {value: 0},
b = {value: 10},
c = {value: 20};
test.deepEqual(h([a, a, a, b, c, c]), [
bin([a, a, a], 0, 5),
bin([], 5, 10),
bin([b], 10, 15),
bin([c, c], 15, 20)
]);
test.end();
});
tape("histogram.domain(array) sets the domain", function(test) {
var h = arrays.histogram().domain([0, 20]);
test.deepEqual(h.domain()(), [0, 20]);
test.deepEqual(h([1, 2, 2, 10, 18, 18]), [
bin([1, 2, 2], 0, 5),
bin([], 5, 10),
bin([10], 10, 15),
bin([18, 18], 15, 20)
]);
test.end();
});
tape("histogram.domain(function) sets the domain accessor", function(test) {
var values = [1, 2, 2, 10, 18, 18],
actual,
domain = function(values) { actual = values; return [0, 20]; },
h = arrays.histogram().domain(domain);
test.equal(h.domain(), domain);
test.deepEqual(h(values), [
bin([1, 2, 2], 0, 5),
bin([], 5, 10),
bin([10], 10, 15),
bin([18, 18], 15, 20)
]);
test.deepEqual(actual, values);
test.end();
});
tape("histogram.thresholds(number) sets the approximate number of bin thresholds", function(test) {
var h = arrays.histogram().thresholds(3);
test.deepEqual(h([0, 0, 0, 10, 30, 30]), [
bin([0, 0, 0], 0, 10),
bin([10], 10, 20),
bin([30, 30], 20, 30) // Note: inclusive upper bound for last bin.
]);
test.end();
});
tape("histogram.thresholds(array) sets the bin thresholds", function(test) {
var h = arrays.histogram().thresholds([10, 20]);
test.deepEqual(h([0, 0, 0, 10, 30, 30]), [
bin([0, 0, 0], 0, 10),
bin([10], 10, 20),
bin([30, 30], 20, 30) // Note: inclusive upper bound for last bin.
]);
test.end();
});
tape("histogram.thresholds(array) ignores thresholds outside the domain", function(test) {
var h = arrays.histogram().thresholds([0, 1, 2, 3]);
test.deepEqual(h([0, 1, 2, 3]), [
bin([0], 0, 1),
bin([1], 1, 2),
bin([2], 2, 3),
bin([3], 3, 3) // Note: inclusive upper bound for last bin.
]);
test.end();
});
tape("histogram.thresholds(function) sets the bin thresholds accessor", function(test) {
var actual,
values = [0, 0, 0, 10, 30, 30],
h = arrays.histogram().thresholds(function(values, x0, x1) { actual = [values, x0, x1]; return [10, 20]; });
test.deepEqual(h(values), [
bin([0, 0, 0], 0, 10),
bin([10], 10, 20),
bin([30, 30], 20, 30) // Note: inclusive upper bound for last bin.
]);
test.deepEqual(actual, [values, 0, 30]);
test.deepEqual(h.thresholds(function() { return 5; })(values), [
bin([0, 0, 0], 0, 5),
bin([], 5, 10),
bin([10], 10, 15),
bin([], 15, 20),
bin([], 20, 25),
bin([30, 30], 25, 30) // Note: inclusive upper bound for last bin.
]);
test.end();
});
tape("histogram()() returns bins whose rightmost bin is not too wide", function(test) {
var h = arrays.histogram();
test.deepEqual(h([9.8, 10, 11, 12, 13, 13.2]), [
bin([9.8], 9.8, 10),
bin([10], 10, 11),
bin([11], 11, 12),
bin([12], 12, 13),
bin([13, 13.2], 13, 13.2),
]);
test.end();
});
function bin(bin, x0, x1) {
bin.x0 = x0;
bin.x1 = x1;
return bin;
}
d3-array-1.2.4/test/isNaN.js000066400000000000000000000003451334007175400154730ustar00rootroot00000000000000var tape = require("tape");
tape.Test.prototype.isNaN = function(actual) {
this._assert(isNaN(actual) && actual !== actual, {
message: "should be NaN",
operator: "isNaN",
actual: actual,
expected: NaN
});
};
d3-array-1.2.4/test/max-test.js000066400000000000000000000102521334007175400162230ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("max(array) returns the greatest numeric value for numbers", function(test) {
test.deepEqual(arrays.max([1]), 1);
test.deepEqual(arrays.max([5, 1, 2, 3, 4]), 5);
test.deepEqual(arrays.max([20, 3]), 20);
test.deepEqual(arrays.max([3, 20]), 20);
test.end();
});
tape("max(array) returns the greatest lexicographic value for strings", function(test) {
test.deepEqual(arrays.max(["c", "a", "b"]), "c");
test.deepEqual(arrays.max(["20", "3"]), "3");
test.deepEqual(arrays.max(["3", "20"]), "3");
test.end();
});
tape("max(array) ignores null, undefined and NaN", function(test) {
var o = {valueOf: function() { return NaN; }};
test.deepEqual(arrays.max([NaN, 1, 2, 3, 4, 5]), 5);
test.deepEqual(arrays.max([o, 1, 2, 3, 4, 5]), 5);
test.deepEqual(arrays.max([1, 2, 3, 4, 5, NaN]), 5);
test.deepEqual(arrays.max([1, 2, 3, 4, 5, o]), 5);
test.deepEqual(arrays.max([10, null, 3, undefined, 5, NaN]), 10);
test.deepEqual(arrays.max([-1, null, -3, undefined, -5, NaN]), -1);
test.end();
});
tape("max(array) compares heterogenous types as numbers", function(test) {
test.equal(arrays.max([20, "3"]), 20);
test.equal(arrays.max(["20", 3]), "20");
test.equal(arrays.max([3, "20"]), "20");
test.equal(arrays.max(["3", 20]), 20);
test.end();
});
tape("max(array) returns undefined if the array contains no numbers", function(test) {
test.equal(arrays.max([]), undefined);
test.equal(arrays.max([null]), undefined);
test.equal(arrays.max([undefined]), undefined);
test.equal(arrays.max([NaN]), undefined);
test.equal(arrays.max([NaN, NaN]), undefined);
test.end();
});
tape("max(array, f) returns the greatest numeric value for numbers", function(test) {
test.deepEqual(arrays.max([1].map(box), unbox), 1);
test.deepEqual(arrays.max([5, 1, 2, 3, 4].map(box), unbox), 5);
test.deepEqual(arrays.max([20, 3].map(box), unbox), 20);
test.deepEqual(arrays.max([3, 20].map(box), unbox), 20);
test.end();
});
tape("max(array, f) returns the greatest lexicographic value for strings", function(test) {
test.deepEqual(arrays.max(["c", "a", "b"].map(box), unbox), "c");
test.deepEqual(arrays.max(["20", "3"].map(box), unbox), "3");
test.deepEqual(arrays.max(["3", "20"].map(box), unbox), "3");
test.end();
});
tape("max(array, f) ignores null, undefined and NaN", function(test) {
var o = {valueOf: function() { return NaN; }};
test.deepEqual(arrays.max([NaN, 1, 2, 3, 4, 5].map(box), unbox), 5);
test.deepEqual(arrays.max([o, 1, 2, 3, 4, 5].map(box), unbox), 5);
test.deepEqual(arrays.max([1, 2, 3, 4, 5, NaN].map(box), unbox), 5);
test.deepEqual(arrays.max([1, 2, 3, 4, 5, o].map(box), unbox), 5);
test.deepEqual(arrays.max([10, null, 3, undefined, 5, NaN].map(box), unbox), 10);
test.deepEqual(arrays.max([-1, null, -3, undefined, -5, NaN].map(box), unbox), -1);
test.end();
});
tape("max(array, f) compares heterogenous types as numbers", function(test) {
test.equal(arrays.max([20, "3"].map(box), unbox), 20);
test.equal(arrays.max(["20", 3].map(box), unbox), "20");
test.equal(arrays.max([3, "20"].map(box), unbox), "20");
test.equal(arrays.max(["3", 20].map(box), unbox), 20);
test.end();
});
tape("max(array, f) returns undefined if the array contains no observed values", function(test) {
test.equal(arrays.max([].map(box), unbox), undefined);
test.equal(arrays.max([null].map(box), unbox), undefined);
test.equal(arrays.max([undefined].map(box), unbox), undefined);
test.equal(arrays.max([NaN].map(box), unbox), undefined);
test.equal(arrays.max([NaN, NaN].map(box), unbox), undefined);
test.end();
});
tape("max(array, f) passes the accessor d, i, and array", function(test) {
var results = [], array = ["a", "b", "c"];
arrays.max(array, function(d, i, array) { results.push([d, i, array]); });
test.deepEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]);
test.end();
});
tape("max(array, f) uses the global context", function(test) {
var results = [];
arrays.max([1, 2], function() { results.push(this); });
test.deepEqual(results, [global, global]);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/mean-test.js000066400000000000000000000071371334007175400163660ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../"),
OneTimeNumber = require("./OneTimeNumber");
tape("mean(array) returns the mean value for numbers", function(test) {
test.equal(arrays.mean([1]), 1);
test.equal(arrays.mean([5, 1, 2, 3, 4]), 3);
test.equal(arrays.mean([20, 3]), 11.5);
test.equal(arrays.mean([3, 20]), 11.5);
test.end();
});
tape("mean(array) ignores null, undefined and NaN", function(test) {
test.equal(arrays.mean([NaN, 1, 2, 3, 4, 5]), 3);
test.equal(arrays.mean([1, 2, 3, 4, 5, NaN]), 3);
test.equal(arrays.mean([10, null, 3, undefined, 5, NaN]), 6);
test.end();
});
tape("mean(array) returns undefined if the array contains no observed values", function(test) {
test.equal(arrays.mean([]), undefined);
test.equal(arrays.mean([null]), undefined);
test.equal(arrays.mean([undefined]), undefined);
test.equal(arrays.mean([NaN]), undefined);
test.equal(arrays.mean([NaN, NaN]), undefined);
test.end();
});
tape("mean(array) coerces values to numbers", function(test) {
test.equal(arrays.mean(["1"]), 1);
test.equal(arrays.mean(["5", "1", "2", "3", "4"]), 3);
test.equal(arrays.mean(["20", "3"]), 11.5);
test.equal(arrays.mean(["3", "20"]), 11.5);
test.end();
});
tape("mean(array) coerces values exactly once", function(test) {
var numbers = [1, new OneTimeNumber(3)];
test.equal(arrays.mean(numbers), 2);
test.equal(arrays.mean(numbers), 1);
test.end();
});
tape("mean(array, f) returns the mean value for numbers", function(test) {
test.equal(arrays.mean([1].map(box), unbox), 1);
test.equal(arrays.mean([5, 1, 2, 3, 4].map(box), unbox), 3);
test.equal(arrays.mean([20, 3].map(box), unbox), 11.5);
test.equal(arrays.mean([3, 20].map(box), unbox), 11.5);
test.end();
});
tape("mean(array, f) ignores null, undefined and NaN", function(test) {
test.equal(arrays.mean([NaN, 1, 2, 3, 4, 5].map(box), unbox), 3);
test.equal(arrays.mean([1, 2, 3, 4, 5, NaN].map(box), unbox), 3);
test.equal(arrays.mean([10, null, 3, undefined, 5, NaN].map(box), unbox), 6);
test.end();
});
tape("mean(array, f) returns undefined if the array contains no observed values", function(test) {
test.equal(arrays.mean([].map(box), unbox), undefined);
test.equal(arrays.mean([null].map(box), unbox), undefined);
test.equal(arrays.mean([undefined].map(box), unbox), undefined);
test.equal(arrays.mean([NaN].map(box), unbox), undefined);
test.equal(arrays.mean([NaN, NaN].map(box), unbox), undefined);
test.end();
});
tape("mean(array, f) coerces values to numbers", function(test) {
test.equal(arrays.mean(["1"].map(box), unbox), 1);
test.equal(arrays.mean(["5", "1", "2", "3", "4"].map(box), unbox), 3);
test.equal(arrays.mean(["20", "3"].map(box), unbox), 11.5);
test.equal(arrays.mean(["3", "20"].map(box), unbox), 11.5);
test.end();
});
tape("mean(array, f) coerces values exactly once", function(test) {
var numbers = [1, new OneTimeNumber(3)].map(box);
test.equal(arrays.mean(numbers, unbox), 2);
test.equal(arrays.mean(numbers, unbox), 1);
test.end();
});
tape("mean(array, f) passes the accessor d, i, and array", function(test) {
var results = [], strings = ["a", "b", "c"];
arrays.mean(strings, function(d, i, array) { results.push([d, i, array]); });
test.deepEqual(results, [["a", 0, strings], ["b", 1, strings], ["c", 2, strings]]);
test.end();
});
tape("mean(array, f) uses the global context", function(test) {
var results = [];
arrays.mean([1, 2], function() { results.push(this); });
test.deepEqual(results, [global, global]);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/median-test.js000066400000000000000000000107461334007175400167030ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../"),
OneTimeNumber = require("./OneTimeNumber");
tape("median(array) returns the median value for numbers", function(test) {
test.equal(arrays.median([1]), 1);
test.equal(arrays.median([5, 1, 2, 3, 4]), 3);
test.equal(arrays.median([20, 3]), 11.5);
test.equal(arrays.median([3, 20]), 11.5);
test.end();
});
tape("median(array) ignores null, undefined and NaN", function(test) {
test.equal(arrays.median([NaN, 1, 2, 3, 4, 5]), 3);
test.equal(arrays.median([1, 2, 3, 4, 5, NaN]), 3);
test.equal(arrays.median([10, null, 3, undefined, 5, NaN]), 5);
test.end();
});
tape("median(array) can handle large numbers without overflowing", function(test) {
test.equal(arrays.median([Number.MAX_VALUE, Number.MAX_VALUE]), Number.MAX_VALUE);
test.equal(arrays.median([-Number.MAX_VALUE, -Number.MAX_VALUE]), -Number.MAX_VALUE);
test.end();
});
tape("median(array) returns undefined if the array contains no observed values", function(test) {
test.equal(arrays.median([]), undefined);
test.equal(arrays.median([null]), undefined);
test.equal(arrays.median([undefined]), undefined);
test.equal(arrays.median([NaN]), undefined);
test.equal(arrays.median([NaN, NaN]), undefined);
test.end();
});
tape("median(array) coerces strings to numbers", function(test) {
test.equal(arrays.median(["1"]), 1);
test.equal(arrays.median(["5", "1", "2", "3", "4"]), 3);
test.equal(arrays.median(["20", "3"]), 11.5);
test.equal(arrays.median(["3", "20"]), 11.5);
test.equal(arrays.median(["2", "3", "20"]), 3);
test.equal(arrays.median(["20", "3", "2"]), 3);
test.end();
});
tape("median(array) coerces values exactly once", function(test) {
var array = [1, new OneTimeNumber(3)];
test.equal(arrays.median(array), 2);
test.equal(arrays.median(array), 1);
test.end();
});
tape("median(array, f) returns the median value for numbers", function(test) {
test.equal(arrays.median([1].map(box), unbox), 1);
test.equal(arrays.median([5, 1, 2, 3, 4].map(box), unbox), 3);
test.equal(arrays.median([20, 3].map(box), unbox), 11.5);
test.equal(arrays.median([3, 20].map(box), unbox), 11.5);
test.end();
});
tape("median(array, f) ignores null, undefined and NaN", function(test) {
test.equal(arrays.median([NaN, 1, 2, 3, 4, 5].map(box), unbox), 3);
test.equal(arrays.median([1, 2, 3, 4, 5, NaN].map(box), unbox), 3);
test.equal(arrays.median([10, null, 3, undefined, 5, NaN].map(box), unbox), 5);
test.end();
});
tape("median(array, f) can handle large numbers without overflowing", function(test) {
test.equal(arrays.median([Number.MAX_VALUE, Number.MAX_VALUE].map(box), unbox), Number.MAX_VALUE);
test.equal(arrays.median([-Number.MAX_VALUE, -Number.MAX_VALUE].map(box), unbox), -Number.MAX_VALUE);
test.end();
});
tape("median(array, f) returns undefined if the array contains no observed values", function(test) {
test.equal(arrays.median([].map(box), unbox), undefined);
test.equal(arrays.median([null].map(box), unbox), undefined);
test.equal(arrays.median([undefined].map(box), unbox), undefined);
test.equal(arrays.median([NaN].map(box), unbox), undefined);
test.equal(arrays.median([NaN, NaN].map(box), unbox), undefined);
test.end();
});
tape("median(array, f) coerces strings to numbers", function(test) {
test.equal(arrays.median(["1"].map(box), unbox), 1);
test.equal(arrays.median(["5", "1", "2", "3", "4"].map(box), unbox), 3);
test.equal(arrays.median(["20", "3"].map(box), unbox), 11.5);
test.equal(arrays.median(["3", "20"].map(box), unbox), 11.5);
test.equal(arrays.median(["2", "3", "20"].map(box), unbox), 3);
test.equal(arrays.median(["20", "3", "2"].map(box), unbox), 3);
test.end();
});
tape("median(array, f) coerces values exactly once", function(test) {
var array = [1, new OneTimeNumber(3)].map(box);
test.equal(arrays.median(array, unbox), 2);
test.equal(arrays.median(array, unbox), 1);
test.end();
});
tape("median(array, f) passes the accessor d, i, and array", function(test) {
var results = [], array = ["a", "b", "c"];
arrays.median(array, function(d, i, array) { results.push([d, i, array]); });
test.deepEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]);
test.end();
});
tape("median(array, f) uses the global context", function(test) {
var results = [];
arrays.median([1, 2], function() { results.push(this); });
test.deepEqual(results, [global, global]);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/merge-test.js000066400000000000000000000027671334007175400165510ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("merge(arrays) merges an array of arrays", function(test) {
var a = {}, b = {}, c = {}, d = {}, e = {}, f = {};
test.deepEqual(arrays.merge([[a], [b, c], [d, e, f]]), [a, b, c, d, e, f]);
test.end();
});
tape("merge(arrays) returns a new array when zero arrays are passed", function(test) {
var input = [],
output = arrays.merge(input);
test.deepEqual(output, []);
input.push([0.1]);
test.deepEqual(input, [[0.1]]);
test.deepEqual(output, []);
test.end();
});
tape("merge(arrays) returns a new array when one array is passed", function(test) {
var input = [[1, 2, 3]],
output = arrays.merge(input);
test.deepEqual(output, [1, 2, 3]);
input.push([4.1]);
input[0].push(3.1);
test.deepEqual(input, [[1, 2, 3, 3.1], [4.1]]);
test.deepEqual(output, [1, 2, 3]);
test.end();
});
tape("merge(arrays) returns a new array when two or more arrays are passed", function(test) {
var input = [[1, 2, 3], [4, 5], [6]],
output = arrays.merge(input);
test.deepEqual(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);
test.deepEqual(input, [[1, 2, 3, 3.1], [4, 5, 5.1], [6, 6.1], [7.1]]);
test.deepEqual(output, [1, 2, 3, 4, 5, 6]);
test.end();
});
tape("merge(arrays) does not modify the input arrays", function(test) {
var input = [[1, 2, 3], [4, 5], [6]];
arrays.merge(input);
test.deepEqual(input, [[1, 2, 3], [4, 5], [6]]);
test.end();
});
d3-array-1.2.4/test/min-test.js000066400000000000000000000102241334007175400162200ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("min(array) returns the least numeric value for numbers", function(test) {
test.deepEqual(arrays.min([1]), 1);
test.deepEqual(arrays.min([5, 1, 2, 3, 4]), 1);
test.deepEqual(arrays.min([20, 3]), 3);
test.deepEqual(arrays.min([3, 20]), 3);
test.end();
});
tape("min(array) returns the least lexicographic value for strings", function(test) {
test.deepEqual(arrays.min(["c", "a", "b"]), "a");
test.deepEqual(arrays.min(["20", "3"]), "20");
test.deepEqual(arrays.min(["3", "20"]), "20");
test.end();
});
tape("min(array) ignores null, undefined and NaN", function(test) {
var o = {valueOf: function() { return NaN; }};
test.deepEqual(arrays.min([NaN, 1, 2, 3, 4, 5]), 1);
test.deepEqual(arrays.min([o, 1, 2, 3, 4, 5]), 1);
test.deepEqual(arrays.min([1, 2, 3, 4, 5, NaN]), 1);
test.deepEqual(arrays.min([1, 2, 3, 4, 5, o]), 1);
test.deepEqual(arrays.min([10, null, 3, undefined, 5, NaN]), 3);
test.deepEqual(arrays.min([-1, null, -3, undefined, -5, NaN]), -5);
test.end();
});
tape("min(array) compares heterogenous types as numbers", function(test) {
test.equal(arrays.min([20, "3"]), "3");
test.equal(arrays.min(["20", 3]), 3);
test.equal(arrays.min([3, "20"]), 3);
test.equal(arrays.min(["3", 20]), "3");
test.end();
});
tape("min(array) returns undefined if the array contains no numbers", function(test) {
test.equal(arrays.min([]), undefined);
test.equal(arrays.min([null]), undefined);
test.equal(arrays.min([undefined]), undefined);
test.equal(arrays.min([NaN]), undefined);
test.equal(arrays.min([NaN, NaN]), undefined);
test.end();
});
tape("min(array, f) returns the least numeric value for numbers", function(test) {
test.deepEqual(arrays.min([1].map(box), unbox), 1);
test.deepEqual(arrays.min([5, 1, 2, 3, 4].map(box), unbox), 1);
test.deepEqual(arrays.min([20, 3].map(box), unbox), 3);
test.deepEqual(arrays.min([3, 20].map(box), unbox), 3);
test.end();
});
tape("min(array, f) returns the least lexicographic value for strings", function(test) {
test.deepEqual(arrays.min(["c", "a", "b"].map(box), unbox), "a");
test.deepEqual(arrays.min(["20", "3"].map(box), unbox), "20");
test.deepEqual(arrays.min(["3", "20"].map(box), unbox), "20");
test.end();
});
tape("min(array, f) ignores null, undefined and NaN", function(test) {
var o = {valueOf: function() { return NaN; }};
test.deepEqual(arrays.min([NaN, 1, 2, 3, 4, 5].map(box), unbox), 1);
test.deepEqual(arrays.min([o, 1, 2, 3, 4, 5].map(box), unbox), 1);
test.deepEqual(arrays.min([1, 2, 3, 4, 5, NaN].map(box), unbox), 1);
test.deepEqual(arrays.min([1, 2, 3, 4, 5, o].map(box), unbox), 1);
test.deepEqual(arrays.min([10, null, 3, undefined, 5, NaN].map(box), unbox), 3);
test.deepEqual(arrays.min([-1, null, -3, undefined, -5, NaN].map(box), unbox), -5);
test.end();
});
tape("min(array, f) compares heterogenous types as numbers", function(test) {
test.equal(arrays.min([20, "3"].map(box), unbox), "3");
test.equal(arrays.min(["20", 3].map(box), unbox), 3);
test.equal(arrays.min([3, "20"].map(box), unbox), 3);
test.equal(arrays.min(["3", 20].map(box), unbox), "3");
test.end();
});
tape("min(array, f) returns undefined if the array contains no observed values", function(test) {
test.equal(arrays.min([].map(box), unbox), undefined);
test.equal(arrays.min([null].map(box), unbox), undefined);
test.equal(arrays.min([undefined].map(box), unbox), undefined);
test.equal(arrays.min([NaN].map(box), unbox), undefined);
test.equal(arrays.min([NaN, NaN].map(box), unbox), undefined);
test.end();
});
tape("min(array, f) passes the accessor d, i, and array", function(test) {
var results = [], array = ["a", "b", "c"];
arrays.min(array, function(d, i, array) { results.push([d, i, array]); });
test.deepEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]);
test.end();
});
tape("min(array, f) uses the global context", function(test) {
var results = [];
arrays.min([1, 2], function() { results.push(this); });
test.deepEqual(results, [global, global]);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/pairs-test.js000066400000000000000000000020051334007175400165510ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("pairs(array) returns the empty array if input array has fewer than two elements", function(test) {
test.deepEqual(arrays.pairs([]), []);
test.deepEqual(arrays.pairs([1]), []);
test.end();
});
tape("pairs(array) returns pairs of adjacent elements in the given array", function(test) {
var a = {}, b = {}, c = {}, d = {};
test.deepEqual(arrays.pairs([1, 2]), [[1, 2]]);
test.deepEqual(arrays.pairs([1, 2, 3]), [[1, 2], [2, 3]]);
test.deepEqual(arrays.pairs([a, b, c, d]), [[a, b], [b, c], [c, d]]);
test.end();
});
tape("pairs(array, f) invokes the function f for each pair of adjacent elements", function(test) {
test.deepEqual(arrays.pairs([1, 3, 7], (a, b) => b - a), [2, 4]);
test.end();
});
tape("pairs(array) includes null or undefined elements in pairs", function(test) {
test.deepEqual(arrays.pairs([1, null, 2]), [[1, null], [null, 2]]);
test.deepEqual(arrays.pairs([1, 2, undefined]), [[1, 2], [2, undefined]]);
test.end();
});
d3-array-1.2.4/test/permute-test.js000066400000000000000000000031051334007175400171160ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("permute(array) permutes according to the specified index", function(test) {
test.deepEqual(arrays.permute([3, 4, 5], [2, 1, 0]), [5, 4, 3]);
test.deepEqual(arrays.permute([3, 4, 5], [2, 0, 1]), [5, 3, 4]);
test.deepEqual(arrays.permute([3, 4, 5], [0, 1, 2]), [3, 4, 5]);
test.end();
});
tape("permute(array) does not modify the input array", function(test) {
var input = [3, 4, 5];
arrays.permute(input, [2, 1, 0]);
test.deepEqual(input, [3, 4, 5]);
test.end();
});
tape("permute(array) can duplicate input values", function(test) {
test.deepEqual(arrays.permute([3, 4, 5], [0, 1, 0]), [3, 4, 3]);
test.deepEqual(arrays.permute([3, 4, 5], [2, 2, 2]), [5, 5, 5]);
test.deepEqual(arrays.permute([3, 4, 5], [0, 1, 1]), [3, 4, 4]);
test.end();
});
tape("permute(array) can return more elements", function(test) {
test.deepEqual(arrays.permute([3, 4, 5], [0, 0, 1, 2]), [3, 3, 4, 5]);
test.deepEqual(arrays.permute([3, 4, 5], [0, 1, 1, 1]), [3, 4, 4, 4]);
test.end();
});
tape("permute(array) can return fewer elements", function(test) {
test.deepEqual(arrays.permute([3, 4, 5], [0]), [3]);
test.deepEqual(arrays.permute([3, 4, 5], [1, 2]), [4, 5]);
test.deepEqual(arrays.permute([3, 4, 5], []), []);
test.end();
});
tape("permute(array) can return undefined elements", function(test) {
test.deepEqual(arrays.permute([3, 4, 5], [10]), [undefined]);
test.deepEqual(arrays.permute([3, 4, 5], [-1]), [undefined]);
test.deepEqual(arrays.permute([3, 4, 5], [0, -1]), [3, undefined]);
test.end();
});
d3-array-1.2.4/test/quantile-test.js000066400000000000000000000055051334007175400172650ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("quantile(array, p) requires sorted numeric input", function(test) {
test.equal(arrays.quantile([1, 2, 3, 4], 0), 1);
test.equal(arrays.quantile([1, 2, 3, 4], 1), 4);
test.equal(arrays.quantile([4, 3, 2, 1], 0), 4);
test.equal(arrays.quantile([4, 3, 2, 1], 1), 1);
test.end();
});
tape("quantile(array, p) uses the R-7 method", function(test) {
var even = [3, 6, 7, 8, 8, 10, 13, 15, 16, 20];
test.equal(arrays.quantile(even, 0), 3);
test.equal(arrays.quantile(even, 0.25), 7.25);
test.equal(arrays.quantile(even, 0.5), 9);
test.equal(arrays.quantile(even, 0.75), 14.5);
test.equal(arrays.quantile(even, 1), 20);
var odd = [3, 6, 7, 8, 8, 9, 10, 13, 15, 16, 20];
test.equal(arrays.quantile(odd, 0), 3);
test.equal(arrays.quantile(odd, 0.25), 7.5);
test.equal(arrays.quantile(odd, 0.5), 9);
test.equal(arrays.quantile(odd, 0.75), 14);
test.equal(arrays.quantile(odd, 1), 20);
test.end();
});
tape("quantile(array, p) coerces values to numbers", function(test) {
var strings = ["1", "2", "3", "4"];
test.equal(arrays.quantile(strings, 1 / 3), 2);
test.equal(arrays.quantile(strings, 1 / 2), 2.5);
test.equal(arrays.quantile(strings, 2 / 3), 3);
var dates = [new Date(Date.UTC(2011, 0, 1)), new Date(Date.UTC(2012, 0, 1))];
test.equal(arrays.quantile(dates, 0), +new Date(Date.UTC(2011, 0, 1)));
test.equal(arrays.quantile(dates, 1 / 2), +new Date(Date.UTC(2011, 6, 2, 12)));
test.equal(arrays.quantile(dates, 1), +new Date(Date.UTC(2012, 0, 1)));
test.end();
});
tape("quantile(array, p) returns an exact value for integer p-values", function(test) {
var data = [1, 2, 3, 4];
test.equal(arrays.quantile(data, 1 / 3), 2);
test.equal(arrays.quantile(data, 2 / 3), 3);
test.end();
});
tape("quantile(array, p) returns the first value for p = 0", function(test) {
var data = [1, 2, 3, 4];
test.equal(arrays.quantile(data, 0), 1);
test.end();
});
tape("quantile(array, p) returns the last value for p = 1", function(test) {
var data = [1, 2, 3, 4];
test.equal(arrays.quantile(data, 1), 4);
test.end();
});
tape("quantile(array, p, f) observes the specified accessor", function(test) {
test.equal(arrays.quantile([1, 2, 3, 4].map(box), 0.5, unbox), 2.5);
test.equal(arrays.quantile([1, 2, 3, 4].map(box), 0, unbox), 1);
test.equal(arrays.quantile([1, 2, 3, 4].map(box), 1, unbox), 4);
test.equal(arrays.quantile([2].map(box), 0, unbox), 2);
test.equal(arrays.quantile([2].map(box), 0.5, unbox), 2);
test.equal(arrays.quantile([2].map(box), 1, unbox), 2);
test.equal(arrays.quantile([], 0, unbox), undefined);
test.equal(arrays.quantile([], 0.5, unbox), undefined);
test.equal(arrays.quantile([], 1, unbox), undefined);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/range-test.js000066400000000000000000000140521334007175400165340ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("range(stop) returns [0, 1, 2, … stop - 1]", function(test) {
test.deepEqual(arrays.range(5), [0, 1, 2, 3, 4]);
test.deepEqual(arrays.range(2.01), [0, 1, 2]);
test.deepEqual(arrays.range(1), [0]);
test.deepEqual(arrays.range(.5), [0]);
test.end();
});
tape("range(stop) returns an empty array if stop <= 0", function(test) {
test.deepEqual(arrays.range(0), []);
test.deepEqual(arrays.range(-0.5), []);
test.deepEqual(arrays.range(-1), []);
test.end();
});
tape("range(stop) returns an empty array if stop is NaN", function(test) {
test.deepEqual(arrays.range(NaN), []);
test.deepEqual(arrays.range(), []);
test.end();
});
tape("range(start, stop) returns [start, start + 1, … stop - 1]", function(test) {
test.deepEqual(arrays.range(0, 5), [0, 1, 2, 3, 4]);
test.deepEqual(arrays.range(2, 5), [2, 3, 4]);
test.deepEqual(arrays.range(2.5, 5), [2.5, 3.5, 4.5]);
test.deepEqual(arrays.range(-1, 3), [-1, 0, 1, 2]);
test.end();
});
tape("range(start, stop) returns an empty array if start or stop is NaN", function(test) {
test.deepEqual(arrays.range(0, NaN), []);
test.deepEqual(arrays.range(1, NaN), []);
test.deepEqual(arrays.range(-1, NaN), []);
test.deepEqual(arrays.range(0, undefined), []);
test.deepEqual(arrays.range(1, undefined), []);
test.deepEqual(arrays.range(-1, undefined), []);
test.deepEqual(arrays.range(NaN, 0), []);
test.deepEqual(arrays.range(NaN, 1), []);
test.deepEqual(arrays.range(NaN, -1), []);
test.deepEqual(arrays.range(undefined, 0), []);
test.deepEqual(arrays.range(undefined, 1), []);
test.deepEqual(arrays.range(undefined, -1), []);
test.deepEqual(arrays.range(NaN, NaN), []);
test.deepEqual(arrays.range(undefined, undefined), []);
test.end();
});
tape("range(start, stop) returns an empty array if start >= stop", function(test) {
test.deepEqual(arrays.range(0, 0), []);
test.deepEqual(arrays.range(5, 5), []);
test.deepEqual(arrays.range(6, 5), []);
test.deepEqual(arrays.range(10, 10), []);
test.deepEqual(arrays.range(20, 10), []);
test.end();
});
tape("range(start, stop, step) returns [start, start + step, start + 2 * step, … stop - step]", function(test) {
test.deepEqual(arrays.range(0, 5, 1), [0, 1, 2, 3, 4]);
test.deepEqual(arrays.range(0, 5, 2), [0, 2, 4]);
test.deepEqual(arrays.range(2, 5, 2), [2, 4]);
test.deepEqual(arrays.range(-1, 3, 2), [-1, 1]);
test.end();
});
tape("range(start, stop, step) allows a negative step", function(test) {
test.deepEqual(arrays.range(5, 0, -1), [5, 4, 3, 2, 1]);
test.deepEqual(arrays.range(5, 0, -2), [5, 3, 1]);
test.deepEqual(arrays.range(5, 2, -2), [5, 3]);
test.deepEqual(arrays.range(3, -1, -2), [3, 1]);
test.end();
});
tape("range(start, stop, step) returns an empty array if start >= stop and step > 0", function(test) {
test.deepEqual(arrays.range(5, 5, 2), []);
test.deepEqual(arrays.range(6, 5, 2), []);
test.deepEqual(arrays.range(10, 10, 1), []);
test.deepEqual(arrays.range(10, 10, 0.5), []);
test.deepEqual(arrays.range(0, 0, 1), []);
test.deepEqual(arrays.range(0, 0, 0.5), []);
test.deepEqual(arrays.range(20, 10, 2), []);
test.deepEqual(arrays.range(20, 10, 1), []);
test.deepEqual(arrays.range(20, 10, 0.5), []);
test.end();
});
tape("range(start, stop, step) returns an empty array if start >= stop and step < 0", function(test) {
test.deepEqual(arrays.range(5, 5, -2), []);
test.deepEqual(arrays.range(5, 6, -2), []);
test.deepEqual(arrays.range(10, 10, -1), []);
test.deepEqual(arrays.range(10, 10, -0.5), []);
test.deepEqual(arrays.range(0, 0, -1), []);
test.deepEqual(arrays.range(0, 0, -0.5), []);
test.deepEqual(arrays.range(10, 20, -2), []);
test.deepEqual(arrays.range(10, 20, -1), []);
test.deepEqual(arrays.range(10, 20, -0.5), []);
test.end();
});
tape("range(start, stop, step) returns an empty array if start, stop or step is NaN", function(test) {
test.deepEqual(arrays.range(NaN, 3, 2), []);
test.deepEqual(arrays.range(3, NaN, 2), []);
test.deepEqual(arrays.range(0, 5, NaN), []);
test.deepEqual(arrays.range(NaN, NaN, NaN), []);
test.deepEqual(arrays.range(NaN, NaN, NaN), []);
test.deepEqual(arrays.range(undefined, undefined, undefined), []);
test.deepEqual(arrays.range(0, 10, NaN), []);
test.deepEqual(arrays.range(10, 0, NaN), []);
test.deepEqual(arrays.range(0, 10, undefined), []);
test.deepEqual(arrays.range(10, 0, undefined), []);
test.end();
});
tape("range(start, stop, step) returns an empty array if step is zero", function(test) {
test.deepEqual(arrays.range(0, 5, 0), []);
test.end();
});
tape("range(start, stop, step) returns exactly [start + step * i, …] for fractional steps", function(test) {
test.deepEqual(arrays.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]);
test.deepEqual(arrays.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]);
test.deepEqual(arrays.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]);
test.deepEqual(arrays.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]);
test.end();
});
tape("range(start, stop, step) returns exactly [start + step * i, …] for very small fractional steps", function(test) {
test.deepEqual(arrays.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]);
test.deepEqual(arrays.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]);
test.end();
});
tape("range(start, stop, step) returns exactly [start + step * i, …] for very large fractional steps", function(test) {
test.deepEqual(arrays.range(1e300, 2e300, 0.3e300), [1e300 + 0.3e300 * 0, 1e300 + 0.3e300 * 1, 1e300 + 0.3e300 * 2, 1e300 + 0.3e300 * 3]);
test.deepEqual(arrays.range(2e300, 1e300, -0.3e300), [2e300 - 0.3e300 * 0, 2e300 - 0.3e300 * 1, 2e300 - 0.3e300 * 2, 2e300 - 0.3e300 * 3]);
test.end();
});
d3-array-1.2.4/test/scan-test.js000066400000000000000000000036771334007175400163770ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("scan(array) compares using natural order", function(test) {
test.strictEqual(arrays.scan([0, 1]), 0);
test.strictEqual(arrays.scan([1, 0]), 1);
test.strictEqual(arrays.scan([0, "1"]), 0);
test.strictEqual(arrays.scan(["1", 0]), 1);
test.strictEqual(arrays.scan(["10", "2"]), 0);
test.strictEqual(arrays.scan(["2", "10"]), 1);
test.strictEqual(arrays.scan(["10", "2", NaN]), 0);
test.strictEqual(arrays.scan([NaN, "10", "2"]), 1);
test.strictEqual(arrays.scan(["2", NaN, "10"]), 2);
test.strictEqual(arrays.scan([2, NaN, 10]), 0);
test.strictEqual(arrays.scan([10, 2, NaN]), 1);
test.strictEqual(arrays.scan([NaN, 10, 2]), 2);
test.end();
});
tape("scan(array, compare) compares using the specified compare function", function(test) {
var a = {name: "a"}, b = {name: "b"};
test.strictEqual(arrays.scan([a, b], function(a, b) { return a.name.localeCompare(b.name); }), 0);
test.strictEqual(arrays.scan([1, 0], arrays.descending), 0);
test.strictEqual(arrays.scan(["1", 0], arrays.descending), 0);
test.strictEqual(arrays.scan(["2", "10"], arrays.descending), 0);
test.strictEqual(arrays.scan(["2", NaN, "10"], arrays.descending), 0);
test.strictEqual(arrays.scan([2, NaN, 10], arrays.descending), 2);
test.end();
});
tape("scan(array) returns undefined if the array is empty", function(test) {
test.strictEqual(arrays.scan([]), undefined);
test.end();
});
tape("scan(array) returns undefined if the array contains only incomparable values", function(test) {
test.strictEqual(arrays.scan([NaN, undefined]), undefined);
test.strictEqual(arrays.scan([NaN, "foo"], function(a, b) { return a - b; }), undefined);
test.end();
});
tape("scan(array) returns the first of equal values", function(test) {
test.strictEqual(arrays.scan([2, 2, 1, 1, 0, 0, 0, 3, 0]), 4);
test.strictEqual(arrays.scan([3, 2, 2, 1, 1, 0, 0, 0, 3, 0], arrays.descending), 0);
test.end();
});
d3-array-1.2.4/test/shuffle-test.js000066400000000000000000000021331334007175400170710ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../"),
random = (require("seedrandom"), Math.random);
tape.test("shuffle(array) shuffles the array in-place", function(test) {
Math.seedrandom("a random seed.");
var numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
test.equal(arrays.shuffle(numbers), numbers);
test.deepEqual(numbers, [6, 4, 7, 9, 3, 1, 5, 8, 0, 2]);
test.end();
});
tape.test("shuffle(array, start) shuffles the subset array[start:] in-place", function(test) {
Math.seedrandom("a random seed.");
var numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
test.equal(arrays.shuffle(numbers, 4), numbers);
test.deepEqual(numbers, [0, 1, 2, 3, 9, 7, 6, 8, 4, 5]);
test.end();
});
tape.test("shuffle(array, start, end) shuffles the subset array[start:end] in-place", function(test) {
Math.seedrandom("a random seed.");
var numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
test.equal(arrays.shuffle(numbers, 3, 8), numbers);
test.deepEqual(numbers, [0, 1, 2, 5, 7, 6, 3, 4, 8, 9]);
test.end();
});
tape.test("shuffle() [teardown]", function(test) {
Math.random = random;
test.end();
});
d3-array-1.2.4/test/sum-test.js000066400000000000000000000071121334007175400162430ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("sum(array) returns the sum of the specified numbers", function(test) {
test.equal(arrays.sum([1]), 1);
test.equal(arrays.sum([5, 1, 2, 3, 4]), 15);
test.equal(arrays.sum([20, 3]), 23);
test.equal(arrays.sum([3, 20]), 23);
test.end();
});
tape("sum(array) observes values that can be coerced to numbers", function(test) {
test.equal(arrays.sum(["20", "3"]), 23);
test.equal(arrays.sum(["3", "20"]), 23);
test.equal(arrays.sum(["3", 20]), 23);
test.equal(arrays.sum([20, "3"]), 23);
test.equal(arrays.sum([3, "20"]), 23);
test.equal(arrays.sum(["20", 3]), 23);
test.end();
});
tape("sum(array) ignores non-numeric values", function(test) {
test.equal(arrays.sum(["a", "b", "c"]), 0);
test.equal(arrays.sum(["a", 1, "2"]), 3);
test.end();
});
tape("sum(array) ignores null, undefined and NaN", function(test) {
test.equal(arrays.sum([NaN, 1, 2, 3, 4, 5]), 15);
test.equal(arrays.sum([1, 2, 3, 4, 5, NaN]), 15);
test.equal(arrays.sum([10, null, 3, undefined, 5, NaN]), 18);
test.end();
});
tape("sum(array) returns zero if there are no numbers", function(test) {
test.equal(arrays.sum([]), 0);
test.equal(arrays.sum([NaN]), 0);
test.equal(arrays.sum([undefined]), 0);
test.equal(arrays.sum([undefined, NaN]), 0);
test.equal(arrays.sum([undefined, NaN, {}]), 0);
test.end();
});
tape("sum(array, f) returns the sum of the specified numbers", function(test) {
test.equal(arrays.sum([1].map(box), unbox), 1);
test.equal(arrays.sum([5, 1, 2, 3, 4].map(box), unbox), 15);
test.equal(arrays.sum([20, 3].map(box), unbox), 23);
test.equal(arrays.sum([3, 20].map(box), unbox), 23);
test.end();
});
tape("sum(array, f) observes values that can be coerced to numbers", function(test) {
test.equal(arrays.sum(["20", "3"].map(box), unbox), 23);
test.equal(arrays.sum(["3", "20"].map(box), unbox), 23);
test.equal(arrays.sum(["3", 20].map(box), unbox), 23);
test.equal(arrays.sum([20, "3"].map(box), unbox), 23);
test.equal(arrays.sum([3, "20"].map(box), unbox), 23);
test.equal(arrays.sum(["20", 3].map(box), unbox), 23);
test.end();
});
tape("sum(array, f) ignores non-numeric values", function(test) {
test.equal(arrays.sum(["a", "b", "c"].map(box), unbox), 0);
test.equal(arrays.sum(["a", 1, "2"].map(box), unbox), 3);
test.end();
});
tape("sum(array, f) ignores null, undefined and NaN", function(test) {
test.equal(arrays.sum([NaN, 1, 2, 3, 4, 5].map(box), unbox), 15);
test.equal(arrays.sum([1, 2, 3, 4, 5, NaN].map(box), unbox), 15);
test.equal(arrays.sum([10, null, 3, undefined, 5, NaN].map(box), unbox), 18);
test.end();
});
tape("sum(array, f) returns zero if there are no numbers", function(test) {
test.equal(arrays.sum([].map(box), unbox), 0);
test.equal(arrays.sum([NaN].map(box), unbox), 0);
test.equal(arrays.sum([undefined].map(box), unbox), 0);
test.equal(arrays.sum([undefined, NaN].map(box), unbox), 0);
test.equal(arrays.sum([undefined, NaN, {}].map(box), unbox), 0);
test.end();
});
tape("sum(array, f) passes the accessor d, i, and array", function(test) {
var results = [], array = ["a", "b", "c"];
arrays.sum(array, function(d, i, array) { results.push([d, i, array]); });
test.deepEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]);
test.end();
});
tape("sum(array, f) uses the global context", function(test) {
var results = [];
arrays.sum([1, 2], function() { results.push(this); });
test.deepEqual(results, [global, global]);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/tickStep-test.js000066400000000000000000000116461334007175400172340ustar00rootroot00000000000000var tape = require("tape"),
array = require("../");
tape("tickStep(start, stop, count) returns NaN if any argument is NaN", function(test) {
test.ok(isNaN(array.tickStep(NaN, 1, 1)));
test.ok(isNaN(array.tickStep(0, NaN, 1)));
test.ok(isNaN(array.tickStep(0, 1, NaN)));
test.ok(isNaN(array.tickStep(NaN, NaN, 1)));
test.ok(isNaN(array.tickStep(0, NaN, NaN)));
test.ok(isNaN(array.tickStep(NaN, 1, NaN)));
test.ok(isNaN(array.tickStep(NaN, NaN, NaN)));
test.end();
});
tape("tickStep(start, stop, count) returns NaN or 0 if start === stop", function(test) {
test.ok(isNaN(array.tickStep(1, 1, -1)));
test.ok(isNaN(array.tickStep(1, 1, 0)));
test.ok(isNaN(array.tickStep(1, 1, NaN)));
test.equal(array.tickStep(1, 1, 1), 0);
test.equal(array.tickStep(1, 1, 10), 0);
test.end();
});
tape("tickStep(start, stop, count) returns 0 or Infinity if count is not positive", function(test) {
test.equal(array.tickStep(0, 1, -1), Infinity);
test.equal(array.tickStep(0, 1, 0), Infinity);
test.end();
});
tape("tickStep(start, stop, count) returns 0 if count is infinity", function(test) {
test.equal(array.tickStep(0, 1, Infinity), 0);
test.end();
});
tape("tickStep(start, stop, count) returns approximately count + 1 tickStep when start < stop", function(test) {
test.equal(array.tickStep( 0, 1, 10), 0.1);
test.equal(array.tickStep( 0, 1, 9), 0.1);
test.equal(array.tickStep( 0, 1, 8), 0.1);
test.equal(array.tickStep( 0, 1, 7), 0.2);
test.equal(array.tickStep( 0, 1, 6), 0.2);
test.equal(array.tickStep( 0, 1, 5), 0.2);
test.equal(array.tickStep( 0, 1, 4), 0.2);
test.equal(array.tickStep( 0, 1, 3), 0.5);
test.equal(array.tickStep( 0, 1, 2), 0.5);
test.equal(array.tickStep( 0, 1, 1), 1.0);
test.equal(array.tickStep( 0, 10, 10), 1);
test.equal(array.tickStep( 0, 10, 9), 1);
test.equal(array.tickStep( 0, 10, 8), 1);
test.equal(array.tickStep( 0, 10, 7), 2);
test.equal(array.tickStep( 0, 10, 6), 2);
test.equal(array.tickStep( 0, 10, 5), 2);
test.equal(array.tickStep( 0, 10, 4), 2);
test.equal(array.tickStep( 0, 10, 3), 5);
test.equal(array.tickStep( 0, 10, 2), 5);
test.equal(array.tickStep( 0, 10, 1), 10);
test.equal(array.tickStep(-10, 10, 10), 2);
test.equal(array.tickStep(-10, 10, 9), 2);
test.equal(array.tickStep(-10, 10, 8), 2);
test.equal(array.tickStep(-10, 10, 7), 2);
test.equal(array.tickStep(-10, 10, 6), 5);
test.equal(array.tickStep(-10, 10, 5), 5);
test.equal(array.tickStep(-10, 10, 4), 5);
test.equal(array.tickStep(-10, 10, 3), 5);
test.equal(array.tickStep(-10, 10, 2), 10);
test.equal(array.tickStep(-10, 10, 1), 20);
test.end();
});
tape("tickStep(start, stop, count) returns -tickStep(stop, start, count)", function(test) {
test.equal(array.tickStep( 0, 1, 10), -array.tickStep( 1, 0, 10));
test.equal(array.tickStep( 0, 1, 9), -array.tickStep( 1, 0, 9));
test.equal(array.tickStep( 0, 1, 8), -array.tickStep( 1, 0, 8));
test.equal(array.tickStep( 0, 1, 7), -array.tickStep( 1, 0, 7));
test.equal(array.tickStep( 0, 1, 6), -array.tickStep( 1, 0, 6));
test.equal(array.tickStep( 0, 1, 5), -array.tickStep( 1, 0, 5));
test.equal(array.tickStep( 0, 1, 4), -array.tickStep( 1, 0, 4));
test.equal(array.tickStep( 0, 1, 3), -array.tickStep( 1, 0, 3));
test.equal(array.tickStep( 0, 1, 2), -array.tickStep( 1, 0, 2));
test.equal(array.tickStep( 0, 1, 1), -array.tickStep( 1, 0, 1));
test.equal(array.tickStep( 0, 10, 10), -array.tickStep(10, 0, 10));
test.equal(array.tickStep( 0, 10, 9), -array.tickStep(10, 0, 9));
test.equal(array.tickStep( 0, 10, 8), -array.tickStep(10, 0, 8));
test.equal(array.tickStep( 0, 10, 7), -array.tickStep(10, 0, 7));
test.equal(array.tickStep( 0, 10, 6), -array.tickStep(10, 0, 6));
test.equal(array.tickStep( 0, 10, 5), -array.tickStep(10, 0, 5));
test.equal(array.tickStep( 0, 10, 4), -array.tickStep(10, 0, 4));
test.equal(array.tickStep( 0, 10, 3), -array.tickStep(10, 0, 3));
test.equal(array.tickStep( 0, 10, 2), -array.tickStep(10, 0, 2));
test.equal(array.tickStep( 0, 10, 1), -array.tickStep(10, 0, 1));
test.equal(array.tickStep(-10, 10, 10), -array.tickStep(10, -10, 10));
test.equal(array.tickStep(-10, 10, 9), -array.tickStep(10, -10, 9));
test.equal(array.tickStep(-10, 10, 8), -array.tickStep(10, -10, 8));
test.equal(array.tickStep(-10, 10, 7), -array.tickStep(10, -10, 7));
test.equal(array.tickStep(-10, 10, 6), -array.tickStep(10, -10, 6));
test.equal(array.tickStep(-10, 10, 5), -array.tickStep(10, -10, 5));
test.equal(array.tickStep(-10, 10, 4), -array.tickStep(10, -10, 4));
test.equal(array.tickStep(-10, 10, 3), -array.tickStep(10, -10, 3));
test.equal(array.tickStep(-10, 10, 2), -array.tickStep(10, -10, 2));
test.equal(array.tickStep(-10, 10, 1), -array.tickStep(10, -10, 1));
test.end();
});
d3-array-1.2.4/test/ticks-test.js000066400000000000000000000151221334007175400165540ustar00rootroot00000000000000var tape = require("tape"),
array = require("../");
tape("ticks(start, stop, count) returns the empty array if any argument is NaN", function(test) {
test.deepEqual(array.ticks(NaN, 1, 1), []);
test.deepEqual(array.ticks(0, NaN, 1), []);
test.deepEqual(array.ticks(0, 1, NaN), []);
test.deepEqual(array.ticks(NaN, NaN, 1), []);
test.deepEqual(array.ticks(0, NaN, NaN), []);
test.deepEqual(array.ticks(NaN, 1, NaN), []);
test.deepEqual(array.ticks(NaN, NaN, NaN), []);
test.end();
});
tape("ticks(start, stop, count) returns the empty array if start === stop and count is non-positive", function(test) {
test.deepEqual(array.ticks(1, 1, -1), []);
test.deepEqual(array.ticks(1, 1, 0), []);
test.deepEqual(array.ticks(1, 1, NaN), []);
test.end();
});
tape("ticks(start, stop, count) returns the empty array if start === stop and count is positive", function(test) {
test.deepEqual(array.ticks(1, 1, 1), [1]);
test.deepEqual(array.ticks(1, 1, 10), [1]);
test.end();
});
tape("ticks(start, stop, count) returns the empty array if count is not positive", function(test) {
test.deepEqual(array.ticks(0, 1, 0), []);
test.deepEqual(array.ticks(0, 1, -1), []);
test.deepEqual(array.ticks(0, 1, NaN), []);
test.end();
});
tape("ticks(start, stop, count) returns the empty array if count is infinity", function(test) {
test.deepEqual(array.ticks(0, 1, Infinity), []);
test.end();
});
tape("ticks(start, stop, count) returns approximately count + 1 ticks when start < stop", function(test) {
test.deepEqual(array.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]);
test.deepEqual(array.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]);
test.deepEqual(array.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]);
test.deepEqual(array.ticks( 0, 1, 7), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
test.deepEqual(array.ticks( 0, 1, 6), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
test.deepEqual(array.ticks( 0, 1, 5), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
test.deepEqual(array.ticks( 0, 1, 4), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
test.deepEqual(array.ticks( 0, 1, 3), [0.0, 0.5, 1.0]);
test.deepEqual(array.ticks( 0, 1, 2), [0.0, 0.5, 1.0]);
test.deepEqual(array.ticks( 0, 1, 1), [0.0, 1.0]);
test.deepEqual(array.ticks( 0, 10, 10), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
test.deepEqual(array.ticks( 0, 10, 9), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
test.deepEqual(array.ticks( 0, 10, 8), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
test.deepEqual(array.ticks( 0, 10, 7), [0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks( 0, 10, 6), [0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks( 0, 10, 5), [0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks( 0, 10, 4), [0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks( 0, 10, 3), [0, 5, 10]);
test.deepEqual(array.ticks( 0, 10, 2), [0, 5, 10]);
test.deepEqual(array.ticks( 0, 10, 1), [0, 10]);
test.deepEqual(array.ticks(-10, 10, 10), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks(-10, 10, 9), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks(-10, 10, 8), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks(-10, 10, 7), [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10]);
test.deepEqual(array.ticks(-10, 10, 6), [-10, -5, 0, 5, 10]);
test.deepEqual(array.ticks(-10, 10, 5), [-10, -5, 0, 5, 10]);
test.deepEqual(array.ticks(-10, 10, 4), [-10, -5, 0, 5, 10]);
test.deepEqual(array.ticks(-10, 10, 3), [-10, -5, 0, 5, 10]);
test.deepEqual(array.ticks(-10, 10, 2), [-10, 0, 10]);
test.deepEqual(array.ticks(-10, 10, 1), [ 0, ]);
test.end();
});
tape("ticks(start, stop, count) returns the reverse of ticks(stop, start, count)", function(test) {
test.deepEqual(array.ticks( 1, 0, 10), array.ticks( 0, 1, 10).reverse());
test.deepEqual(array.ticks( 1, 0, 9), array.ticks( 0, 1, 9).reverse());
test.deepEqual(array.ticks( 1, 0, 8), array.ticks( 0, 1, 8).reverse());
test.deepEqual(array.ticks( 1, 0, 7), array.ticks( 0, 1, 7).reverse());
test.deepEqual(array.ticks( 1, 0, 6), array.ticks( 0, 1, 6).reverse());
test.deepEqual(array.ticks( 1, 0, 5), array.ticks( 0, 1, 5).reverse());
test.deepEqual(array.ticks( 1, 0, 4), array.ticks( 0, 1, 4).reverse());
test.deepEqual(array.ticks( 1, 0, 3), array.ticks( 0, 1, 3).reverse());
test.deepEqual(array.ticks( 1, 0, 2), array.ticks( 0, 1, 2).reverse());
test.deepEqual(array.ticks( 1, 0, 1), array.ticks( 0, 1, 1).reverse());
test.deepEqual(array.ticks(10, 0, 10), array.ticks( 0, 10, 10).reverse());
test.deepEqual(array.ticks(10, 0, 9), array.ticks( 0, 10, 9).reverse());
test.deepEqual(array.ticks(10, 0, 8), array.ticks( 0, 10, 8).reverse());
test.deepEqual(array.ticks(10, 0, 7), array.ticks( 0, 10, 7).reverse());
test.deepEqual(array.ticks(10, 0, 6), array.ticks( 0, 10, 6).reverse());
test.deepEqual(array.ticks(10, 0, 5), array.ticks( 0, 10, 5).reverse());
test.deepEqual(array.ticks(10, 0, 4), array.ticks( 0, 10, 4).reverse());
test.deepEqual(array.ticks(10, 0, 3), array.ticks( 0, 10, 3).reverse());
test.deepEqual(array.ticks(10, 0, 2), array.ticks( 0, 10, 2).reverse());
test.deepEqual(array.ticks(10, 0, 1), array.ticks( 0, 10, 1).reverse());
test.deepEqual(array.ticks(10, -10, 10), array.ticks(-10, 10, 10).reverse());
test.deepEqual(array.ticks(10, -10, 9), array.ticks(-10, 10, 9).reverse());
test.deepEqual(array.ticks(10, -10, 8), array.ticks(-10, 10, 8).reverse());
test.deepEqual(array.ticks(10, -10, 7), array.ticks(-10, 10, 7).reverse());
test.deepEqual(array.ticks(10, -10, 6), array.ticks(-10, 10, 6).reverse());
test.deepEqual(array.ticks(10, -10, 5), array.ticks(-10, 10, 5).reverse());
test.deepEqual(array.ticks(10, -10, 4), array.ticks(-10, 10, 4).reverse());
test.deepEqual(array.ticks(10, -10, 3), array.ticks(-10, 10, 3).reverse());
test.deepEqual(array.ticks(10, -10, 2), array.ticks(-10, 10, 2).reverse());
test.deepEqual(array.ticks(10, -10, 1), array.ticks(-10, 10, 1).reverse());
test.end();
});
d3-array-1.2.4/test/transpose-test.js000066400000000000000000000026351334007175400174620ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("transpose([]) and transpose([[]]) return an empty array", function(test) {
test.deepEqual(arrays.transpose([]), []);
test.deepEqual(arrays.transpose([[]]), []);
test.end();
});
tape("transpose([[a, b, …]]) returns [[a], [b], …]", function(test) {
test.deepEqual(arrays.transpose([[1, 2, 3, 4, 5]]), [[1], [2], [3], [4], [5]]);
test.end();
});
tape("transpose([[a1, b1, …], [a2, b2, …]]) returns [[a1, a2], [b1, b2], …]", function(test) {
test.deepEqual(arrays.transpose([[1, 2], [3, 4]]), [[1, 3], [2, 4]]);
test.deepEqual(arrays.transpose([[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]]), [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]);
test.end();
});
tape("transpose([[a1, b1, …], [a2, b2, …], [a3, b3, …]]) returns [[a1, a2, a3], [b1, b2, b3], …]", function(test) {
test.deepEqual(arrays.transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), [[1, 4, 7], [2, 5, 8], [3, 6, 9]]);
test.end();
});
tape("transpose(…) ignores extra elements given an irregular matrix", function(test) {
test.deepEqual(arrays.transpose([[1, 2], [3, 4], [5, 6, 7]]), [[1, 3, 5], [2, 4, 6]]);
test.end();
});
tape("transpose(…) returns a copy", function(test) {
var matrix = [[1, 2], [3, 4]],
tranpose = arrays.transpose(matrix);
matrix[0][0] = matrix[0][1] = matrix[1][0] = matrix[1][1] = 0;
test.deepEqual(tranpose, [[1, 3], [2, 4]]);
test.end();
});
d3-array-1.2.4/test/variance-test.js000066400000000000000000000063551334007175400172370ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("variance(array) returns the variance of the specified numbers", function(test) {
test.equal(arrays.variance([5, 1, 2, 3, 4]), 2.5);
test.equal(arrays.variance([20, 3]), 144.5);
test.equal(arrays.variance([3, 20]), 144.5);
test.end();
});
tape("variance(array) ignores null, undefined and NaN", function(test) {
test.equal(arrays.variance([NaN, 1, 2, 3, 4, 5]), 2.5);
test.equal(arrays.variance([1, 2, 3, 4, 5, NaN]), 2.5);
test.equal(arrays.variance([10, null, 3, undefined, 5, NaN]), 13);
test.end();
});
tape("variance(array) can handle large numbers without overflowing", function(test) {
test.equal(arrays.variance([Number.MAX_VALUE, Number.MAX_VALUE]), 0);
test.equal(arrays.variance([-Number.MAX_VALUE, -Number.MAX_VALUE]), 0);
test.end();
});
tape("variance(array) returns undefined if the array has fewer than two numbers", function(test) {
test.equal(arrays.variance([1]), undefined);
test.equal(arrays.variance([]), undefined);
test.equal(arrays.variance([null]), undefined);
test.equal(arrays.variance([undefined]), undefined);
test.equal(arrays.variance([NaN]), undefined);
test.equal(arrays.variance([NaN, NaN]), undefined);
test.end();
});
tape("variance(array, f) returns the variance of the specified numbers", function(test) {
test.equal(arrays.variance([5, 1, 2, 3, 4].map(box), unbox), 2.5);
test.equal(arrays.variance([20, 3].map(box), unbox), 144.5);
test.equal(arrays.variance([3, 20].map(box), unbox), 144.5);
test.end();
});
tape("variance(array, f) ignores null, undefined and NaN", function(test) {
test.equal(arrays.variance([NaN, 1, 2, 3, 4, 5].map(box), unbox), 2.5);
test.equal(arrays.variance([1, 2, 3, 4, 5, NaN].map(box), unbox), 2.5);
test.equal(arrays.variance([10, null, 3, undefined, 5, NaN].map(box), unbox), 13);
test.end();
});
tape("variance(array, f) can handle large numbers without overflowing", function(test) {
test.equal(arrays.variance([Number.MAX_VALUE, Number.MAX_VALUE].map(box), unbox), 0);
test.equal(arrays.variance([-Number.MAX_VALUE, -Number.MAX_VALUE].map(box), unbox), 0);
test.end();
});
tape("variance(array, f) returns undefined if the array has fewer than two numbers", function(test) {
test.equal(arrays.variance([1].map(box), unbox), undefined);
test.equal(arrays.variance([].map(box), unbox), undefined);
test.equal(arrays.variance([null].map(box), unbox), undefined);
test.equal(arrays.variance([undefined].map(box), unbox), undefined);
test.equal(arrays.variance([NaN].map(box), unbox), undefined);
test.equal(arrays.variance([NaN, NaN].map(box), unbox), undefined);
test.end();
});
tape("variance(array, f) passes the accessor d, i, and array", function(test) {
var results = [], array = ["a", "b", "c"];
arrays.variance(array, function(d, i, array) { results.push([d, i, array]); });
test.deepEqual(results, [["a", 0, array], ["b", 1, array], ["c", 2, array]]);
test.end();
});
tape("variance(array, f) uses the global context", function(test) {
var results = [];
arrays.variance([1, 2], function() { results.push(this); });
test.deepEqual(results, [global, global]);
test.end();
});
function box(value) {
return {value: value};
}
function unbox(box) {
return box.value;
}
d3-array-1.2.4/test/zip-test.js000066400000000000000000000020621334007175400162400ustar00rootroot00000000000000var tape = require("tape"),
arrays = require("../");
tape("zip() and zip([]) return an empty array", function(test) {
test.deepEqual(arrays.zip(), []);
test.deepEqual(arrays.zip([]), []);
test.end();
});
tape("zip([a, b, …]) returns [[a], [b], …]", function(test) {
test.deepEqual(arrays.zip([1, 2, 3, 4, 5]), [[1], [2], [3], [4], [5]]);
test.end();
});
tape("zip([a1, b1, …], [a2, b2, …]) returns [[a1, a2], [b1, b2], …]", function(test) {
test.deepEqual(arrays.zip([1, 2], [3, 4]), [[1, 3], [2, 4]]);
test.deepEqual(arrays.zip([1, 2, 3, 4, 5], [2, 4, 6, 8, 10]), [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]);
test.end();
});
tape("zip([a1, b1, …], [a2, b2, …], [a3, b3, …]) returns [[a1, a2, a3], [b1, b2, b3], …]", function(test) {
test.deepEqual(arrays.zip([1, 2, 3], [4, 5, 6], [7, 8, 9]), [[1, 4, 7], [2, 5, 8], [3, 6, 9]]);
test.end();
});
tape("zip(…) ignores extra elements given an irregular matrix", function(test) {
test.deepEqual(arrays.zip([1, 2], [3, 4], [5, 6, 7]), [[1, 3, 5], [2, 4, 6]]);
test.end();
});
d3-array-1.2.4/yarn.lock000066400000000000000000000767421334007175400150070ustar00rootroot00000000000000# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@^7.0.0-beta.47":
version "7.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-rc.3.tgz#d77a587401f818a3168700f596e41cd6905947b2"
dependencies:
"@babel/highlight" "7.0.0-rc.3"
"@babel/highlight@7.0.0-rc.3":
version "7.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.3.tgz#c2ee83f8e5c0c387279a8c48e06fef2e32027004"
dependencies:
chalk "^2.0.0"
esutils "^2.0.2"
js-tokens "^4.0.0"
"@types/estree@0.0.39":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
"@types/node@*":
version "10.9.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.1.tgz#06f002136fbcf51e730995149050bb3c45ee54e6"
acorn-jsx@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e"
dependencies:
acorn "^5.0.3"
acorn@^5.0.3, acorn@^5.6.0:
version "5.7.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.2.tgz#91fa871883485d06708800318404e72bfb26dcc5"
ajv-keywords@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a"
ajv@^6.0.1, ajv@^6.5.0:
version "6.5.3"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9"
dependencies:
fast-deep-equal "^2.0.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ansi-escapes@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
ansi-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
dependencies:
color-convert "^1.9.0"
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
dependencies:
sprintf-js "~1.0.2"
array-union@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
dependencies:
array-uniq "^1.0.1"
array-uniq@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
arrify@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
dependencies:
chalk "^1.1.3"
esutils "^2.0.2"
js-tokens "^3.0.2"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
caller-path@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
dependencies:
callsites "^0.2.0"
callsites@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca"
chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
chalk@^2.0.0, chalk@^2.1.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
circular-json@^0.3.1:
version "0.3.3"
resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66"
cli-cursor@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
dependencies:
restore-cursor "^2.0.0"
cli-width@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
color-convert@^1.9.0:
version "1.9.2"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147"
dependencies:
color-name "1.1.1"
color-name@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689"
commander@~2.16.0:
version "2.16.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
dependencies:
nice-try "^1.0.4"
path-key "^2.0.1"
semver "^5.5.0"
shebang-command "^1.2.0"
which "^1.2.9"
debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
ms "2.0.0"
deep-equal@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"
deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
define-properties@^1.1.2:
version "1.1.3"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
dependencies:
object-keys "^1.0.12"
defined@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
del@^2.0.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8"
dependencies:
globby "^5.0.0"
is-path-cwd "^1.0.0"
is-path-in-cwd "^1.0.0"
object-assign "^4.0.1"
pify "^2.0.0"
pinkie-promise "^2.0.0"
rimraf "^2.2.8"
doctrine@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d"
dependencies:
esutils "^2.0.2"
es-abstract@^1.5.0:
version "1.12.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.1"
has "^1.0.1"
is-callable "^1.1.3"
is-regex "^1.0.4"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
escape-string-regexp@^1.0.2, 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"
eslint-scope@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172"
dependencies:
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-utils@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512"
eslint-visitor-keys@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
eslint@5:
version "5.4.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.4.0.tgz#d068ec03006bb9e06b429dc85f7e46c1b69fac62"
dependencies:
ajv "^6.5.0"
babel-code-frame "^6.26.0"
chalk "^2.1.0"
cross-spawn "^6.0.5"
debug "^3.1.0"
doctrine "^2.1.0"
eslint-scope "^4.0.0"
eslint-utils "^1.3.1"
eslint-visitor-keys "^1.0.0"
espree "^4.0.0"
esquery "^1.0.1"
esutils "^2.0.2"
file-entry-cache "^2.0.0"
functional-red-black-tree "^1.0.1"
glob "^7.1.2"
globals "^11.7.0"
ignore "^4.0.2"
imurmurhash "^0.1.4"
inquirer "^5.2.0"
is-resolvable "^1.1.0"
js-yaml "^3.11.0"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.3.0"
lodash "^4.17.5"
minimatch "^3.0.4"
mkdirp "^0.5.1"
natural-compare "^1.4.0"
optionator "^0.8.2"
path-is-inside "^1.0.2"
pluralize "^7.0.0"
progress "^2.0.0"
regexpp "^2.0.0"
require-uncached "^1.0.3"
semver "^5.5.0"
strip-ansi "^4.0.0"
strip-json-comments "^2.0.1"
table "^4.0.3"
text-table "^0.2.0"
espree@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634"
dependencies:
acorn "^5.6.0"
acorn-jsx "^4.1.1"
esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
esquery@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708"
dependencies:
estraverse "^4.0.0"
esrecurse@^4.1.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf"
dependencies:
estraverse "^4.1.0"
estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1:
version "4.2.0"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
external-editor@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5"
dependencies:
chardet "^0.4.0"
iconv-lite "^0.4.17"
tmp "^0.0.33"
fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
fast-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
fast-levenshtein@~2.0.4:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
figures@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
dependencies:
escape-string-regexp "^1.0.5"
file-entry-cache@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361"
dependencies:
flat-cache "^1.2.1"
object-assign "^4.0.1"
flat-cache@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481"
dependencies:
circular-json "^0.3.1"
del "^2.0.2"
graceful-fs "^4.1.2"
write "^0.2.1"
for-each@~0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
dependencies:
is-callable "^1.1.3"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
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"
glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
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@^11.7.0:
version "11.7.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673"
globby@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d"
dependencies:
array-union "^1.0.1"
arrify "^1.0.0"
glob "^7.0.3"
object-assign "^4.0.1"
pify "^2.0.0"
pinkie-promise "^2.0.0"
graceful-fs@^4.1.2:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
dependencies:
ansi-regex "^2.0.0"
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
has@^1.0.1, has@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
dependencies:
function-bind "^1.1.1"
iconv-lite@^0.4.17:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
dependencies:
safer-buffer ">= 2.1.2 < 3"
ignore@^4.0.2:
version "4.0.6"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2, inherits@~2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
inquirer@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.2.0.tgz#db350c2b73daca77ff1243962e9f22f099685726"
dependencies:
ansi-escapes "^3.0.0"
chalk "^2.0.0"
cli-cursor "^2.1.0"
cli-width "^2.0.0"
external-editor "^2.1.0"
figures "^2.0.0"
lodash "^4.3.0"
mute-stream "0.0.7"
run-async "^2.2.0"
rxjs "^5.5.2"
string-width "^2.1.0"
strip-ansi "^4.0.0"
through "^2.3.6"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-fullwidth-code-point@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
is-path-cwd@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d"
is-path-in-cwd@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52"
dependencies:
is-path-inside "^1.0.0"
is-path-inside@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036"
dependencies:
path-is-inside "^1.0.1"
is-promise@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
dependencies:
has "^1.0.1"
is-resolvable@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88"
is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
js-tokens@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
js-yaml@^3.11.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
dependencies:
argparse "^1.0.7"
esprima "^4.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"
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"
levn@^0.3.0, levn@~0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"
dependencies:
prelude-ls "~1.1.2"
type-check "~0.3.2"
lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
mimic-fn@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
brace-expansion "^1.1.7"
minimist@0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
minimist@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
mkdirp@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
minimist "0.0.8"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
mute-stream@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
nice-try@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"
object-assign@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
object-inspect@~1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b"
object-keys@^1.0.12:
version "1.0.12"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
dependencies:
wrappy "1"
onetime@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
dependencies:
mimic-fn "^1.0.0"
optionator@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
dependencies:
deep-is "~0.1.3"
fast-levenshtein "~2.0.4"
levn "~0.3.0"
prelude-ls "~1.1.2"
type-check "~0.3.2"
wordwrap "~1.0.0"
os-tmpdir@~1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
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"
path-is-inside@^1.0.1, path-is-inside@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
path-key@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
path-parse@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
pify@^2.0.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
pinkie-promise@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa"
dependencies:
pinkie "^2.0.0"
pinkie@^2.0.0:
version "2.0.4"
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
pluralize@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777"
prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
progress@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"
punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
regexpp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365"
require-uncached@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3"
dependencies:
caller-path "^0.1.0"
resolve-from "^1.0.0"
resolve-from@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
resolve@~1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3"
dependencies:
path-parse "^1.0.5"
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
dependencies:
onetime "^2.0.0"
signal-exit "^3.0.2"
resumer@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759"
dependencies:
through "~2.3.4"
rimraf@^2.2.8:
version "2.6.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36"
dependencies:
glob "^7.0.5"
rollup-plugin-terser@1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-1.0.1.tgz#ba5f497cbc9aa38ba19d3ee2167c04ea3ed279af"
dependencies:
"@babel/code-frame" "^7.0.0-beta.47"
terser "^3.7.5"
rollup@0.64:
version "0.64.1"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.64.1.tgz#9188ee368e5fcd43ffbc00ec414e72eeb5de87ba"
dependencies:
"@types/estree" "0.0.39"
"@types/node" "*"
run-async@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
dependencies:
is-promise "^2.1.0"
rxjs@^5.5.2:
version "5.5.11"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87"
dependencies:
symbol-observable "1.0.1"
"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
seedrandom@2:
version "2.4.4"
resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-2.4.4.tgz#b25ea98632c73e45f58b77cfaa931678df01f9ba"
semver@^5.5.0:
version "5.5.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477"
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
dependencies:
shebang-regex "^1.0.0"
shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
slice-ansi@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d"
dependencies:
is-fullwidth-code-point "^2.0.0"
source-map-support@~0.5.6:
version "0.5.9"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f"
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"
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
string-width@^2.1.0, string-width@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
dependencies:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"
string.prototype.trim@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.0"
function-bind "^1.0.2"
strip-ansi@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
dependencies:
ansi-regex "^2.0.0"
strip-ansi@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
dependencies:
ansi-regex "^3.0.0"
strip-json-comments@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
dependencies:
has-flag "^3.0.0"
symbol-observable@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
table@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc"
dependencies:
ajv "^6.0.1"
ajv-keywords "^3.0.0"
chalk "^2.1.0"
lodash "^4.17.4"
slice-ansi "1.0.0"
string-width "^2.1.1"
tape@4:
version "4.9.1"
resolved "https://registry.yarnpkg.com/tape/-/tape-4.9.1.tgz#1173d7337e040c76fbf42ec86fcabedc9b3805c9"
dependencies:
deep-equal "~1.0.1"
defined "~1.0.0"
for-each "~0.3.3"
function-bind "~1.1.1"
glob "~7.1.2"
has "~1.0.3"
inherits "~2.0.3"
minimist "~1.2.0"
object-inspect "~1.6.0"
resolve "~1.7.1"
resumer "~0.0.0"
string.prototype.trim "~1.1.2"
through "~2.3.8"
terser@^3.7.5:
version "3.8.1"
resolved "https://registry.yarnpkg.com/terser/-/terser-3.8.1.tgz#cb70070ac9e0a71add169dfb63c0a64fca2738ac"
dependencies:
commander "~2.16.0"
source-map "~0.6.1"
source-map-support "~0.5.6"
text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
through@^2.3.6, through@~2.3.4, through@~2.3.8:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
dependencies:
os-tmpdir "~1.0.2"
type-check@~0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"
dependencies:
prelude-ls "~1.1.2"
uri-js@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
dependencies:
punycode "^2.1.0"
which@^1.2.9:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
dependencies:
isexe "^2.0.0"
wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
write@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757"
dependencies:
mkdirp "^0.5.1"