Fix some trivial Typescript issues
This commit is contained in:
parent
f2e52cfcb2
commit
4696733ec6
|
@ -5,13 +5,13 @@ import { THEOREMONE_CONFIG } from './theoremone'
|
||||||
|
|
||||||
export const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD'
|
export const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD'
|
||||||
|
|
||||||
const CONFIGS = {
|
const CONFIGS: { [env: string]: EnvConfig } = {
|
||||||
PROD: PROD_CONFIG,
|
PROD: PROD_CONFIG,
|
||||||
DEV: DEV_CONFIG,
|
DEV: DEV_CONFIG,
|
||||||
THEOREMONE: THEOREMONE_CONFIG,
|
THEOREMONE: THEOREMONE_CONFIG,
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
|
||||||
export const ENV_CONFIG: EnvConfig = CONFIGS[ENV]
|
export const ENV_CONFIG = CONFIGS[ENV]
|
||||||
|
|
||||||
export function isWhitelisted(email?: string) {
|
export function isWhitelisted(email?: string) {
|
||||||
if (!ENV_CONFIG.whitelistEmail) {
|
if (!ENV_CONFIG.whitelistEmail) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ export const randomString = (length = 12) =>
|
||||||
|
|
||||||
export function genHash(str: string) {
|
export function genHash(str: string) {
|
||||||
// xmur3
|
// xmur3
|
||||||
|
let h: number
|
||||||
for (let i = 0, h = 1779033703 ^ str.length; i < str.length; i++) {
|
for (let i = 0, h = 1779033703 ^ str.length; i < str.length; i++) {
|
||||||
h = Math.imul(h ^ str.charCodeAt(i), 3432918353)
|
h = Math.imul(h ^ str.charCodeAt(i), 3432918353)
|
||||||
h = (h << 13) | (h >>> 19)
|
h = (h << 13) | (h >>> 19)
|
||||||
|
@ -39,7 +40,7 @@ export function createRNG(seed: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const shuffle = (array: any[], rand: () => number) => {
|
export const shuffle = (array: unknown[], rand: () => number) => {
|
||||||
for (let i = 0; i < array.length; i++) {
|
for (let i = 0; i < array.length; i++) {
|
||||||
const swapIndex = Math.floor(rand() * (array.length - i))
|
const swapIndex = Math.floor(rand() * (array.length - i))
|
||||||
;[array[i], array[swapIndex]] = [array[swapIndex], array[i]]
|
;[array[i], array[swapIndex]] = [array[swapIndex], array[i]]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user