Skip to content

Commit

Permalink
refactor: trivial cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
  • Loading branch information
jerome-benoit committed May 19, 2024
1 parent 8f86ac8 commit f9a9595
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,10 @@ const quantile = (arr, q) => {
};

const buildStats = samples => {
if (!Array.isArray(samples)) {
if (!Array.isArray(samples))
throw new TypeError(`expected array, got ${samples.constructor.name}`);
}
if (Array.isArray(samples) && samples.length === 0) {
if (Array.isArray(samples) && samples.length === 0)
throw new Error('expected non-empty array, got empty array');
}

samples.sort((a, b) => a - b);

Expand Down

0 comments on commit f9a9595

Please sign in to comment.