export const pad = ( number , length = 2 ) => `000${ number }` . slice ( length * - 1 ) ; export const int = ( bool ) => ( bool === true ? 1 : 0 ) ; export function debounce < F extends Function > ( fn , wait ) { let t ; return function ( this ) { const args = arguments ; clearTimeout ( t ) ; t = setTimeout ( ( ) => fn . apply ( this , args ) , wait ) ; } ; } export const arrayify = < T > ( obj ) : T [ ] => obj instanceof Array ? obj : [ obj ] ; export type IncrementEvent = MouseEvent & { delta : number ; type : "increment" ; } ;