In some science fiction novel, there is the scenario of using nuclear weapons to deflect an Earth-approaching asteroid.
But the question is, is a nuclear weapon really as useful on the moon or an asteroid as on Earth?
The point is that, on the Earth, there is the atmosphere. The energy released by the bomb is absorbed by the atmosphere completely and induces huge blast.
But on the Moon, there is no air to trap the energy. Most energy released will simply escape into the universe.