@types/d3-array
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -60,9 +60,9 @@ // Type definitions for D3JS d3-array module 3.0 | ||
*/ | ||
export function minIndex<T>(iterable: Iterable<T>): number; | ||
export function minIndex(iterable: Iterable<unknown>): number; | ||
/** | ||
* Return the index of the minimum value in the array using natural order and a projection function to map values. | ||
*/ | ||
export function minIndex<TDatum, U>( | ||
export function minIndex<TDatum>( | ||
iterable: Iterable<TDatum>, | ||
accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => U | undefined | null | ||
accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => unknown | ||
): number; | ||
@@ -72,3 +72,3 @@ /** | ||
*/ | ||
export function minIndex<T>(iterable: Iterable<T>): number; | ||
export function minIndex(iterable: Iterable<unknown>): number; | ||
@@ -101,9 +101,9 @@ /** | ||
*/ | ||
export function maxIndex<T>(iterable: Iterable<T>): number; | ||
export function maxIndex(iterable: Iterable<unknown>): number; | ||
/** | ||
* Return the index of the maximum value in the array using natural order and a projection function to map values. | ||
*/ | ||
export function maxIndex<TDatum, U>( | ||
export function maxIndex<TDatum>( | ||
iterable: Iterable<TDatum>, | ||
accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => U | undefined | null | ||
accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => unknown | ||
): number; | ||
@@ -154,3 +154,3 @@ | ||
*/ | ||
export function sum<T extends Numeric>(iterable: Iterable<T | undefined | null>): number; | ||
export function sum(iterable: Iterable<Numeric | undefined | null>): number; | ||
/** | ||
@@ -167,3 +167,3 @@ * Compute the sum of an array, using the given accessor to convert values to numbers. | ||
*/ | ||
export function mean<T extends Numeric>(iterable: Iterable<T | undefined | null>): number | undefined; | ||
export function mean(iterable: Iterable<Numeric | undefined | null>): number | undefined; | ||
/** | ||
@@ -180,3 +180,3 @@ * Return the mean of an array of numbers | ||
*/ | ||
export function median<T extends Numeric>(iterable: Iterable<T | undefined | null>): number | undefined; | ||
export function median(iterable: Iterable<Numeric | undefined | null>): number | undefined; | ||
/** | ||
@@ -213,3 +213,3 @@ * Return the median of an array of numbers | ||
*/ | ||
export function quantile<T extends Numeric>(iterable: Iterable<T | undefined | null>, p: number): number | undefined; | ||
export function quantile(iterable: Iterable<Numeric | undefined | null>, p: number): number | undefined; | ||
/** | ||
@@ -230,4 +230,4 @@ * Returns the p-quantile of the given iterable of numbers, where p is a number in the range [0, 1]. | ||
*/ | ||
export function quantileSorted<T extends Numeric>( | ||
array: Array<T | undefined | null>, | ||
export function quantileSorted( | ||
array: Array<Numeric | undefined | null>, | ||
p: number | ||
@@ -251,3 +251,3 @@ ): number | undefined; | ||
*/ | ||
export function variance<T extends Numeric>(iterable: Iterable<T | undefined | null>): number | undefined; | ||
export function variance(iterable: Iterable<Numeric | undefined | null>): number | undefined; | ||
/** | ||
@@ -267,3 +267,3 @@ * Returns an unbiased estimator of the population variance of the given iterable of numbers using Welford’s algorithm. | ||
*/ | ||
export function deviation<T extends Numeric>(iterable: Iterable<T | undefined | null>): number | undefined; | ||
export function deviation(iterable: Iterable<Numeric | undefined | null>): number | undefined; | ||
/** | ||
@@ -282,3 +282,3 @@ * Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array, | ||
*/ | ||
export function fsum<T extends Numeric>(values: Iterable<T | undefined | null>): number; | ||
export function fsum(values: Iterable<Numeric | undefined | null>): number; | ||
/** | ||
@@ -330,13 +330,10 @@ * Returns a full precision summation of the given values. | ||
/** | ||
* Returns the least element of the specified iterable. | ||
*/ | ||
export function least<T>(iterable: Iterable<T>): T | undefined; | ||
/** | ||
* Returns the least element of the specified iterable according to the specified comparator. | ||
* If comparator is not specified, it defaults to ascending. | ||
*/ | ||
export function least<T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): T | undefined; | ||
export function least<T>(iterable: Iterable<T>, comparator?: (a: T, b: T) => number): T | undefined; | ||
/** | ||
* Returns the least element of the specified iterable according to the specified accessor. | ||
*/ | ||
export function least<T, U>(iterable: Iterable<T>, accessor: (a: T) => U): T | undefined; | ||
export function least<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): T | undefined; | ||
@@ -346,3 +343,3 @@ /** | ||
*/ | ||
export function leastIndex<T>(iterable: Iterable<T>): number | undefined; | ||
export function leastIndex(iterable: Iterable<unknown>): number | undefined; | ||
/** | ||
@@ -355,3 +352,4 @@ * Returns the index of the least element of the specified iterable according to the specified comparator. | ||
*/ | ||
export function leastIndex<T, U>(iterable: Iterable<T>, accessor: (a: T) => U): number | undefined; | ||
// tslint:disable-next-line:unified-signatures | ||
export function leastIndex<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): number | undefined; | ||
@@ -363,3 +361,3 @@ /** | ||
*/ | ||
export function greatest<T>(iterable: Iterable<T>): T | undefined; | ||
export function greatest<T>(iterable: Iterable<T>, comparator?: (a: T, b: T) => number): T | undefined; | ||
/** | ||
@@ -370,9 +368,3 @@ * Returns the greatest element of the specified iterable according to the specified comparator or accessor. | ||
*/ | ||
export function greatest<T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): T | undefined; | ||
/** | ||
* Returns the greatest element of the specified iterable according to the specified comparator or accessor. | ||
* If the given iterable contains no comparable elements (i.e., the comparator returns NaN when comparing each element to itself), returns undefined. | ||
* If comparator is not specified, it defaults to ascending. | ||
*/ | ||
export function greatest<T, U>(iterable: Iterable<T>, accessor: (a: T) => U): T | undefined; | ||
export function greatest<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): T | undefined; | ||
@@ -384,3 +376,3 @@ /** | ||
*/ | ||
export function greatestIndex<T>(iterable: Iterable<T>): number | undefined; | ||
export function greatestIndex(iterable: Iterable<unknown>): number | undefined; | ||
/** | ||
@@ -397,3 +389,4 @@ * Returns the index of the greatest element of the specified iterable according to the specified comparator or accessor. | ||
*/ | ||
export function greatestIndex<T, U>(iterable: Iterable<T>, accessor: (a: T) => U): number | undefined; | ||
// tslint:disable-next-line:unified-signatures | ||
export function greatestIndex<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): number | undefined; | ||
@@ -421,2 +414,3 @@ export function bisectLeft(array: ArrayLike<number>, x: number, lo?: number, hi?: number): number; | ||
export function bisector<T, U>(comparator: (a: T, b: U) => number): Bisector<T, U>; | ||
// tslint:disable-next-line:unified-signatures | ||
export function bisector<T, U>(accessor: (x: T) => U): Bisector<T, U>; | ||
@@ -429,31 +423,7 @@ | ||
* @param k The middle index for partial sorting. | ||
*/ | ||
export function quickselect<T>(array: ArrayLike<T>, k: number): T[]; | ||
/** | ||
* Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. | ||
* | ||
* @param array The array to partially sort (in place). | ||
* @param k The middle index for partial sorting. | ||
* @param left The left index of the range to sort. | ||
*/ | ||
export function quickselect<T>(array: ArrayLike<T>, k: number, left: number): T[]; | ||
/** | ||
* Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. | ||
* | ||
* @param array The array to partially sort (in place). | ||
* @param k The middle index for partial sorting. | ||
* @param left The left index of the range to sort. | ||
* @param right The right index. | ||
*/ | ||
export function quickselect<T>(array: ArrayLike<T>, k: number, left: number, right: number): T[]; | ||
/** | ||
* Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. | ||
* | ||
* @param array The array to partially sort (in place). | ||
* @param k The middle index for partial sorting. | ||
* @param left The left index of the range to sort. | ||
* @param right The right index. | ||
* @param compare The compare function. | ||
*/ | ||
export function quickselect<T>(array: ArrayLike<T>, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; | ||
export function quickselect<T>(array: ArrayLike<T>, k: number, left?: number, right?: number, compare?: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; | ||
@@ -796,5 +766,6 @@ // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. | ||
*/ | ||
export function groupSort<TObject, TReduce, TKey>( | ||
export function groupSort<TObject, TKey>( | ||
iterable: Iterable<TObject>, | ||
accessor: (value: TObject[]) => TReduce, | ||
// tslint:disable-next-line:unified-signatures | ||
accessor: (value: TObject[]) => unknown, | ||
key: (value: TObject) => TKey | ||
@@ -808,3 +779,3 @@ ): TKey[]; | ||
*/ | ||
export function count<TObject>(iterable: Iterable<TObject>): number; | ||
export function count(iterable: Iterable<unknown>): number; | ||
/** | ||
@@ -957,2 +928,3 @@ * Returns the number of valid number values (i.e., not null, NaN, or undefined) in the specified iterable; accepts an accessor. | ||
*/ | ||
// tslint:disable-next-line:unified-signatures | ||
export function range(start: number, stop: number, step?: number): number[]; | ||
@@ -1122,4 +1094,3 @@ | ||
domain(): (values: ArrayLike<Value>) => [Date, Date]; | ||
domain(domain: [Date, Date]): this; | ||
domain(domainAccessor: (values: ArrayLike<Value>) => [Date, Date]): this; | ||
domain(domain: [Date, Date] | ((values: ArrayLike<Value>) => [Date, Date])): this; | ||
@@ -1133,18 +1104,9 @@ thresholds(): ThresholdDateArrayGenerator<Value>; | ||
* | ||
* @param thresholds Array of threshold values used for binning. The elements must | ||
* @param thresholds Either an array of threshold values used for binning. The elements must | ||
* be of the same type as the materialized values of the histogram. | ||
*/ | ||
thresholds(thresholds: ArrayLike<Value>): this; | ||
/** | ||
* Set a threshold accessor function, which returns the array of values to be used as | ||
* thresholds in determining the bins. | ||
* | ||
* Any threshold values outside the 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. | ||
* | ||
* @param thresholds A function which accepts as arguments the array of materialized values, and | ||
* Or a function which accepts as arguments the array of materialized values, and | ||
* optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as | ||
* thresholds in determining the bins. | ||
*/ | ||
thresholds(thresholds: ThresholdDateArrayGenerator<Value>): this; | ||
thresholds(thresholds: ArrayLike<Value> | ThresholdDateArrayGenerator<Value>): this; | ||
} | ||
@@ -1154,4 +1116,3 @@ | ||
domain(): (values: Iterable<Value>) => [number, number] | [undefined, undefined]; | ||
domain(domain: [number, number]): this; | ||
domain(domainAccessor: (values: Iterable<Value>) => [number, number] | [undefined, undefined]): this; | ||
domain(domain: [number, number] | ((values: Iterable<Value>) => [number, number] | [undefined, undefined])): this; | ||
@@ -1166,19 +1127,8 @@ thresholds(): ThresholdCountGenerator<Value> | ThresholdNumberArrayGenerator<Value>; | ||
* | ||
* @param count The desired number of uniform bins. | ||
* @param count Either the desired number of uniform bins or a function which accepts as arguments the array of | ||
* materialized values, and optionally the domain minimum and maximum. The function calculates and returns the | ||
* suggested number of bins. | ||
*/ | ||
thresholds(count: number): this; | ||
thresholds(count: number | ThresholdCountGenerator<Value>): this; | ||
/** | ||
* Set a threshold accessor function, which returns the desired number of bins. | ||
* Divides the domain uniformly into approximately count bins. IMPORTANT: This threshold | ||
* setting approach only works, when the materialized values are numbers! | ||
* | ||
* Any threshold values outside the 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. | ||
* | ||
* @param count A function which accepts as arguments the array of materialized values, and | ||
* optionally the domain minimum and maximum. The function calculates and returns the suggested | ||
* number of bins. | ||
*/ | ||
thresholds(count: ThresholdCountGenerator<Value>): this; | ||
/** | ||
* Set the array of values to be used as thresholds in determining the bins. | ||
@@ -1189,18 +1139,10 @@ * | ||
* | ||
* @param thresholds Array of threshold values used for binning. The elements must | ||
* @param thresholds Either an array of threshold values used for binning. The elements must | ||
* be of the same type as the materialized values of the histogram. | ||
*/ | ||
thresholds(thresholds: ArrayLike<Value>): this; | ||
/** | ||
* Set a threshold accessor function, which returns the array of values to be used as | ||
* thresholds in determining the bins. | ||
* | ||
* Any threshold values outside the 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. | ||
* | ||
* @param thresholds A function which accepts as arguments the array of materialized values, and | ||
* Or a function which accepts as arguments the array of materialized values, and | ||
* optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as | ||
* thresholds in determining the bins. | ||
*/ | ||
thresholds(thresholds: ThresholdNumberArrayGenerator<Value>): this; | ||
// tslint:disable-next-line:unified-signatures | ||
thresholds(thresholds: ArrayLike<Value> | ThresholdNumberArrayGenerator<Value>): this; | ||
} | ||
@@ -1216,2 +1158,3 @@ | ||
*/ | ||
// tslint:disable-next-line:no-unnecessary-generics | ||
export function histogram<Datum, Value extends number | undefined>(): HistogramGeneratorNumber<Datum, Value>; | ||
@@ -1222,6 +1165,9 @@ | ||
*/ | ||
// tslint:disable-next-line:no-unnecessary-generics | ||
export function histogram<Datum, Value extends Date | undefined>(): HistogramGeneratorDate<Datum, Value>; | ||
export function bin(): HistogramGeneratorNumber<number, number>; | ||
// tslint:disable-next-line:no-unnecessary-generics | ||
export function bin<Datum, Value extends number | undefined>(): HistogramGeneratorNumber<Datum, Value>; | ||
// tslint:disable-next-line:no-unnecessary-generics | ||
export function bin<Datum, Value extends Date | undefined>(): HistogramGeneratorDate<Datum, Value>; | ||
@@ -1228,0 +1174,0 @@ |
{ | ||
"name": "@types/d3-array", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "TypeScript definitions for D3JS d3-array module", | ||
@@ -48,4 +48,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-array", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "101fe09ba06a59553b73eba435f288e5459089801cc4ebff1bc9ae39ef0cd3dc", | ||
"typesPublisherContentHash": "e2ff60bfe49af0826c4dba32a9b1f676f9fa249eeb4e996180fa274f57d7ed13", | ||
"typeScriptVersion": "3.6" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Fri, 18 Jun 2021 00:31:12 GMT | ||
* Last updated: Fri, 25 Jun 2021 17:01:17 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53825
1068