UNPKG

beanstalkd-protocol

Version:
20 lines (16 loc) 510 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reduce = reduce; const CRLF = exports.CRLF = Buffer.from([0x0d, 0x0a]); // '\r\n' const SPACE = exports.SPACE = Buffer.from([0x20]); // ' ' function reduce(collection, callback, accumulator) { if (!collection) return accumulator; var index = -1, length = collection.length; while (++index < length) { accumulator = callback(accumulator, collection[index], index, collection); } return accumulator; }