@cowwoc/requirements
Version:
A fluent API for enforcing design contracts with automatic message generation.
58 lines (57 loc) • 2.04 kB
text/typescript
/**
* The difference between two collections, irrespective of element ordering.
*
* @typeParam E - the type of elements in the actual and other collections
* @param common - elements that were present in both collections
* @param onlyInActual - elements that were only present in the value
* @param onlyInOther - elements that were only present in the other collection
*/
declare class Difference<E> {
readonly common: Set<E>;
readonly onlyInActual: Set<E>;
readonly onlyInOther: Set<E>;
/**
* Creates a new instance.
*
* @param common - the elements that are common to both arrays
* @param onlyInActual - the elements that are only found in the actual value
* @param onlyInOther - the elements that are only found in the other value
*/
private constructor();
/**
* Compares the elements in two collections.
*
* @typeParam E - the type of elements in the collections
* @param value - the value's elements
* @param other - the other collection's elements
* @returns the elements that were common to both collections, or were only present in the value, or were
* only present in the other collection
*/
static actualVsOther<E>(value: E[] | Set<E>, other: E[] | Set<E>): Difference<E>;
/**
* @param value - an array or set
* @returns the Set representation of the value
*/
private static asSet;
/**
* @param first - a set
* @param second - a set
* @returns the elements found in both sets
*/
private static intersection;
/**
* @param first - a set
* @param second - a set
* @returns the elements found in the first set but not the second set
*/
private static firstMinusSecond;
/**
* @returns `true` if both collections contain the same elements, irrespective of ordering
*/
areTheSame(): boolean;
/**
* @returns `true` if the collections contain different elements
*/
areDifferent(): boolean;
}
export { Difference };