diff --git a/lib/node_modules/@stdlib/_tools/github/star-repo/lib/query.js b/lib/node_modules/@stdlib/_tools/github/star-repo/lib/query.js index 040d3d189c2c..352fd5168bc0 100644 --- a/lib/node_modules/@stdlib/_tools/github/star-repo/lib/query.js +++ b/lib/node_modules/@stdlib/_tools/github/star-repo/lib/query.js @@ -62,6 +62,8 @@ function query( slug, options, clbk ) { * @returns {void} */ function done( error, response ) { + var resetDate; + var resetISO; var info; if ( arguments.length === 1 ) { debug( 'No available rate limit information.' ); @@ -73,7 +75,20 @@ function query( slug, options, clbk ) { info = ratelimit( response.headers ); debug( 'Rate limit: %d', info.limit ); debug( 'Rate limit remaining: %d', info.remaining ); - debug( 'Rate limit reset: %s', (new Date( info.reset*1000 )).toISOString() ); + + // Guard against invalid or missing reset values which would throw a RangeError when calling toISOString: + resetISO = 'n/a'; + if ( + info && + typeof info.reset === 'number' && + isFinite( info.reset ) + ) { + resetDate = new Date( info.reset*1000 ); + if ( !isNaN( resetDate.getTime() ) ) { + resetISO = resetDate.toISOString(); + } + } + debug( 'Rate limit reset: %s', resetISO ); if ( error ) { return clbk( error, info );