Apply prettier formatting

This commit is contained in:
Michael Weimann 2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
No known key found for this signature in database
GPG key ID: 53F535A266BB9584
1576 changed files with 65385 additions and 62478 deletions

View file

@ -70,7 +70,7 @@ export function arraySmoothingResample(input: number[], points: number): number[
// never end, and we can over-average the data. Instead, we'll get as far as
// we can and do a followup fast resample (the neighbouring points will be close
// to the actual waveform, so we can get away with this safely).
while (samples.length > (points * 2) || samples.length === 0) {
while (samples.length > points * 2 || samples.length === 0) {
samples = [];
for (let i = 1; i < input.length - 1; i += 2) {
const prevPoint = input[i - 1];
@ -102,7 +102,7 @@ export function arraySmoothingResample(input: number[], points: number): number[
export function arrayRescale(input: number[], newMin: number, newMax: number): number[] {
const min: number = Math.min(...input);
const max: number = Math.max(...input);
return input.map(v => percentageWithin(percentageOf(v, min, max), newMin, newMax));
return input.map((v) => percentageWithin(percentageOf(v, min, max), newMin, newMax));
}
/**
@ -174,8 +174,8 @@ export function arrayHasDiff(a: any[], b: any[]): boolean {
if (a.length === b.length) {
// When the lengths are equal, check to see if either array is missing
// an element from the other.
if (b.some(i => !a.includes(i))) return true;
if (a.some(i => !b.includes(i))) return true;
if (b.some((i) => !a.includes(i))) return true;
if (a.some((i) => !b.includes(i))) return true;
// if all the keys are common, say so
return false;
@ -184,7 +184,7 @@ export function arrayHasDiff(a: any[], b: any[]): boolean {
}
}
export type Diff<T> = { added: T[], removed: T[] };
export type Diff<T> = { added: T[]; removed: T[] };
/**
* Performs a diff on two arrays. The result is what is different with the
@ -196,8 +196,8 @@ export type Diff<T> = { added: T[], removed: T[] };
*/
export function arrayDiff<T>(a: T[], b: T[]): Diff<T> {
return {
added: b.filter(i => !a.includes(i)),
removed: a.filter(i => !b.includes(i)),
added: b.filter((i) => !a.includes(i)),
removed: a.filter((i) => !b.includes(i)),
};
}
@ -208,7 +208,7 @@ export function arrayDiff<T>(a: T[], b: T[]): Diff<T> {
* @returns The intersection of the arrays.
*/
export function arrayIntersection<T>(a: T[], b: T[]): T[] {
return a.filter(i => b.includes(i));
return a.filter((i) => b.includes(i));
}
/**
@ -217,10 +217,12 @@ export function arrayIntersection<T>(a: T[], b: T[]): T[] {
* @returns The union of all given arrays.
*/
export function arrayUnion<T>(...a: T[][]): T[] {
return Array.from(a.reduce((c, v) => {
v.forEach(i => c.add(i));
return c;
}, new Set<T>()));
return Array.from(
a.reduce((c, v) => {
v.forEach((i) => c.add(i));
return c;
}, new Set<T>()),
);
}
/**
@ -246,8 +248,7 @@ export class ArrayUtil<T> {
* Create a new array helper.
* @param a The array to help. Can be modified in-place.
*/
constructor(private a: T[]) {
}
constructor(private a: T[]) {}
/**
* The value of this array, after all appropriate alterations.
@ -280,8 +281,7 @@ export class GroupedArray<K, T> {
* Creates a new group helper.
* @param val The group to help. Can be modified in-place.
*/
constructor(private val: Map<K, T[]>) {
}
constructor(private val: Map<K, T[]>) {}
/**
* The value of this group, after all applicable alterations.