How to keep zoom into limits

I have an object and I can drag the camera all around. To avoid to move the camera too far I have added some check inside the render method:

 render() {

  if (this.camera.position.x>4) this.camera.position.x = 4;
  if (this.camera.position.y>4) this.camera.position.y = 4;
  if (this.camera.position.z>4) this.camera.position.z = 4;

  if (this.camera.position.x<-4) this.camera.position.x = -4;
  if (this.camera.position.y<-4) this.camera.position.y = -4;
  if (this.camera.position.z<-4) this.camera.position.z = -4;
   ...
}

This works. But how to avoid the camera to go to near the object? Have I to set some data range or there is some special property?

Thanks for any suggestion!

Are you using OrbitControls or a custom camera controls implementation?

Yes I use OrbitControls

  let controls = new OrbitControls(this.camera, this.renderer.domElement);
  controls.addEventListener('change', this.render);
  controls.enableZoom = true;

If you are using a perspective camera use the minDistance and maxDistance properties to limit zoom/dollying. With an orthographic camera, the properties are minZoom and maxZoom. More information in the documentation:

https://threejs.org/docs/index.html#examples/en/controls/OrbitControls

Thanks! minDistance and maxDistance solved my request.

Three.js has a great documentation but sometimes I get lost, thanks for helping all of us