mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-08-30 02:24:42 +08:00
update: hooks, web
This commit is contained in:
@@ -22,3 +22,18 @@ export function pickWeight<T>(items: WeightItem<T>[], rng?: RNG) {
|
||||
export function sum(arr: number[]) {
|
||||
return arr.reduce((sum, v) => sum + v, 0)
|
||||
}
|
||||
|
||||
export function shuffle<T>(array: T[], rng?: RNG): T[] {
|
||||
const result = [...array]
|
||||
for (let i = result.length - 1; i > 0; i--) {
|
||||
const j = random(i, 0, rng)
|
||||
const temp = result[i]
|
||||
result[i] = result[j]!
|
||||
result[j] = temp!
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function keys<T extends object>(obj: T): (keyof T)[] {
|
||||
return Object.keys(obj) as (keyof T)[]
|
||||
}
|
||||
|
||||
@@ -1,29 +1,4 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Environment setup & latest features
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"types": ["bun"],
|
||||
|
||||
// Bundler mode
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
|
||||
// Best practices
|
||||
"strict": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
|
||||
// Some stricter flags (disabled by default)
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noPropertyAccessFromIndexSignature": false,
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user