js processor using promises