fix up movies index route [wip]
This commit is contained in:
parent
7cc540b6fd
commit
bae0415a24
4 changed files with 210 additions and 8 deletions
|
|
@ -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)))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue