add library, tsconfig.base.json

This commit is contained in:
polv committed 2021-10-25 05:19:13 +07:00
1 parent 0348f84255
commit ffbe5fed18
8 files changed
+758 -25

No files matched your search

+3 -3
View File
@@ -45,7 +45,7 @@ export const doMapKeypress = (
export function shuffle<T>(a: T[]) {
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1))
;[a[i], a[j]] = [a[j], a[i]]
;[a[i], a[j]] = [a[j]!, a[i]!]
}
return a
}
@@ -60,7 +60,7 @@ export function sample<T>(arr: T[], size: number): T[] {
outN.push(...allN.splice(Math.floor(Math.random() * allN.length), 1))
}
return outN.map((n) => arr[n])
return outN.map((n) => arr[n]!)
}
export function capitalize(s: string): string {
@@ -72,7 +72,7 @@ export function capitalize(s: string): string {
}
if (!s) return s
return s[0].toLocaleUpperCase() + s.substr(1)
return s[0]!.toLocaleUpperCase() + s.substr(1)
}
export function jsonClone<T>(o: T): T {