From 921280d15b0dcdfa57d2a7a88952c7b35134b235 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 08:40:55 +0000 Subject: [PATCH] refactor: use `format` for error messages in `stats/base/dists/hypergeometric/ctor` Route the two constructor `RangeError` messages (`K > N` and `n > N` guards) through `@stdlib/string/format`, matching the canonical error-construction convention. Every other throw in this file already uses `format` (three `TypeError` argument checks and all six property setters), and all 34 `stats/base/dists/*/ctor` packages construct thrown errors via `format` (100% conformance); this package held the only two plain-string throws. Message text is unchanged and the thrown error type remains `RangeError`, so no observable behavior or test expectation changes (tests assert error type only). --- .../@stdlib/stats/base/dists/hypergeometric/ctor/lib/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/ctor/lib/main.js b/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/ctor/lib/main.js index 892f9da3cf8e..284bd764383d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/ctor/lib/main.js +++ b/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/ctor/lib/main.js @@ -125,10 +125,10 @@ function Hypergeometric( N, K, n ) { throw new TypeError( format( 'invalid argument. Number of draws must be a nonnegative integer. Value: `%s`.', n ) ); } if ( K > N ) { - throw new RangeError( 'invalid arguments. Subpopulation size must be less than or equal to the population size.' ); + throw new RangeError( format( 'invalid arguments. Subpopulation size must be less than or equal to the population size.' ) ); } if ( n > N ) { - throw new RangeError( 'invalid arguments. Number of draws must be less than or equal to the population size.' ); + throw new RangeError( format( 'invalid arguments. Number of draws must be less than or equal to the population size.' ) ); } defineProperty( this, 'N', { 'configurable': false,