Skip to content

Commit 41f4ebf

Browse files
committed
chore: fix JavaScript lint errors (issue #8258)
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent ad8f246 commit 41f4ebf

File tree

1 file changed

+16
-1
lines changed
  • lib/node_modules/@stdlib/_tools/github/star-repo/lib

1 file changed

+16
-1
lines changed

lib/node_modules/@stdlib/_tools/github/star-repo/lib/query.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ function query( slug, options, clbk ) {
6262
* @returns {void}
6363
*/
6464
function done( error, response ) {
65+
var resetDate;
66+
var resetISO;
6567
var info;
6668
if ( arguments.length === 1 ) {
6769
debug( 'No available rate limit information.' );
@@ -73,7 +75,20 @@ function query( slug, options, clbk ) {
7375
info = ratelimit( response.headers );
7476
debug( 'Rate limit: %d', info.limit );
7577
debug( 'Rate limit remaining: %d', info.remaining );
76-
debug( 'Rate limit reset: %s', (new Date( info.reset*1000 )).toISOString() );
78+
79+
// Guard against invalid or missing reset values which would throw a RangeError when calling toISOString:
80+
resetISO = 'n/a';
81+
if (
82+
info &&
83+
typeof info.reset === 'number' &&
84+
isFinite( info.reset )
85+
) {
86+
resetDate = new Date( info.reset*1000 );
87+
if ( !isNaN( resetDate.getTime() ) ) {
88+
resetISO = resetDate.toISOString();
89+
}
90+
}
91+
debug( 'Rate limit reset: %s', resetISO );
7792

7893
if ( error ) {
7994
return clbk( error, info );

0 commit comments

Comments
 (0)