refact: refact the $.reduce function in lumpy