node module: some functions for working with promises