ESG-short for Equatorial Surface Gravity-is a small functionally-programmed library which returns the surface gravity of a spherical body as derived from the Newton's gravitational constant.
npm install esg
var esg = require('esg').ESG;
// Surface gravity in m/s.
esg.gravity(5.972E+24, 6.371E+6) // 9.91810989409835
// Relative surface gravity to Earth's, expressed as a ratio.
esg.relative(5.972E+24, 6.371E+6); // 1
// Escape velocity in m/s.
esg.escape(5.972E+24, 6.371E+6); // 11241.732796619975
// Orbital velocity in m/s.
esg.orbit(5.972E+24, 6.371E+6); // 7949.105492777197
npm test
Pull requests welcome.
The code is under the MIT license.