CSV preprocessor for Randkid materials
convert.ts
import {weightedList} from "https://raw.githubusercontent.com/randkid/Wrap/master/mod.ts"
await weightedList.convert("data.csv", "data.js")
deno run --allow-read --allow-write convert.ts
mod.ts
import {weightedList} from "https://raw.githubusercontent.com/randkid/Wrap/master/mod.ts"
import data from "./data.js"
export default weightedList.getMaterial(data)
Refer to Randkid.
import material from "./mod.ts"
console.log(material.rand(Math.random()))
CSV file can't be imported.
This provides importable JS file.