forked from MapComplete/MapComplete
Refactoring: split 'Utils' into multiple files; fix some stray uppercase-method names
This commit is contained in:
parent
81be4db044
commit
3ec89826e4
97 changed files with 884 additions and 921 deletions
|
|
@ -3,6 +3,7 @@
|
|||
import type { ChartConfiguration } from "chart.js"
|
||||
import ChartJs from "../Base/ChartJs.svelte"
|
||||
import { ChartJsUtils } from "../Base/ChartJsUtils"
|
||||
import { Lists } from "../../Utils/Lists"
|
||||
|
||||
export let values: Store<string[]>
|
||||
let counts: Store<Map<string, number>> = values.map(
|
||||
|
|
@ -11,7 +12,7 @@
|
|||
return undefined
|
||||
}
|
||||
|
||||
values = Utils.NoNull(values)
|
||||
values = Utils.noNull(values)
|
||||
const counts = new Map<string, number>()
|
||||
for (const value of values) {
|
||||
const c = counts.get(value) ?? 0
|
||||
|
|
@ -23,7 +24,7 @@
|
|||
|
||||
let max: Store<number> = counts.mapD(counts => Math.max(...Array.from(counts.values())))
|
||||
let keys: Store<string> = counts.mapD(counts => {
|
||||
const keys = Utils.Dedup(counts.keys())
|
||||
const keys = Lists.dedup(counts.keys())
|
||||
keys.sort(/*inplace sort*/)
|
||||
return keys
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue