Personal library?

I use a tool called Rollup to use ES modules for code bundling and managing utilities, though it requires coding outside of the browser.

For example I have some utilities:

// Array.js
// ...
export function maximumBy (fn, arr) { /* ... */ }
export function minimumBy (fn, arr) { /* ... */ }
// ...
// levels.js
import {maximumBy} from '../utils/Array'
const chooseTarget = maximumBy(enemy => hero.distanceTo(enemy))

I then run rollup on the level file, which includes any imported modules into my code that I can paste into CodeCombat. It is somewhat of an inconvenience however.

Other discussions:

1 Like