Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit d23c58f

Browse files
author
cmd
committed
update
1 parent 10a0854 commit d23c58f

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/client/class/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export function get_fetcher (
7474
// Initialize the options object.
7575
if (token !== undefined) {
7676
init.headers = {
77-
...init.headers,
78-
'Authorization' :'Token ' + token
77+
...init.headers,
78+
'Authorization' :'Bearer ' + token
7979
}
8080
}
8181
// Run the fetcher method.

src/lib/util.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@ export function is_literal (value : unknown) : value is Literal {
6666
return false
6767
}
6868

69+
export function is_uint (
70+
value : unknown,
71+
max_val = Number.MAX_SAFE_INTEGER
72+
) : value is Number {
73+
if (typeof value === 'string') {
74+
value = Number(value)
75+
}
76+
if (typeof value !== 'number') {
77+
return false
78+
}
79+
return (
80+
typeof value === 'number' &&
81+
!isNaN(value) &&
82+
value >= 0 &&
83+
value <= max_val &&
84+
Math.floor(value) === value
85+
)
86+
}
87+
6988
export function now () {
7089
return Math.floor(Date.now() / 1000)
7190
}

0 commit comments

Comments
 (0)