You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 年之前
123456789101112
  1. const bound = (position, min, max) => {
  2. let ret = position
  3. if (min !== undefined) {
  4. ret = Math.max(position, min)
  5. }
  6. if (max !== undefined) {
  7. ret = Math.min(ret, max)
  8. }
  9. return ret
  10. }
  11. export default bound