A killer JavaScript promise chaining helper.