fix up movies index route [wip]

This commit is contained in:
ducklet 2021-08-04 01:04:13 +02:00
parent 7cc540b6fd
commit bae0415a24
4 changed files with 210 additions and 8 deletions

View file

@ -1,3 +1,18 @@
export function is_object(x) {
return x !== null && typeof x === "object" && !Array.isArray(x)
}
export function sum(nums) {
return nums.reduce((s, n) => s + n, 0)
}
export function mean(nums) {
return sum(nums) / nums.length
}
export function pstdev(nums, mu=null) {
if (mu === null) {
mu = mean(nums)
}
return Math.sqrt(mean(nums.map((n) => (n - mu) ** 2)))
}