UNPKG

@navelpluisje/pcb-components

Version:

A library with native components. They are all pcb components, like a dip-switch, resitor etc.

8 lines (6 loc) 219 B
export const round = (number, step) => { const decimals = step.toString().split('.')[1].length; const value = Math.round(number / step) * step; return parseFloat(value.toFixed(decimals)); }; export default null;