documentation of the lib/trend.js file