UNPKG

json-prism

Version:

Immutable Prisms, i.e. Taking a Multifoci Json Path to Immutability, or A sentient item has some ability to communicate, either by sharing its emotions, broadcasting its thoughts telepathically, or speaking aloud.

26 lines (21 loc) 531 B
"use strict"; var write = function write(writer, data, encoding, callback) { var ok = true; do { i--; if (i === 0) { // last time! writer.write(data, encoding, callback); } else { // See if we should continue, or wait. // Don't pass the callback, because we're not done yet. ok = writer.write(data, encoding); } } while (i > 0 && ok); if (i > 0) { // had to stop early! // write some more once it drains writer.once('drain', write); } }; module.exports = {};