Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 21x 21x 21x 22x 22x 22x 11x 11x 11x 11x 22x 18x 1x 10x 10x 10x 18x 1x 9x 9x 9x 22x 21x 21x 21x 21x 57x 198x 198x 198x 198x 198x 195x 195x 177x 177x 195x 195x 198x 3x 198x 57x 21x 21x 21x 39x 21x 21x 21x | const Streamz = require('streamz'); const util = require('util'); function expand(convert) { if (!(this instanceof Streamz)) return new expand(convert); Streamz.call(this); if (convert == 'uppercase') this.convert = function(d) { return String(d).toUpperCase(); }; else if (convert == 'lowercase') this.convert = function(d) { return String(d).toLowerCase(); }; else this.convert = convert; } util.inherits(expand,Streamz); expand.prototype.expand = function(d) { for (let key in d) { const oldKey = key; if (typeof this.convert === 'function') key = this.convert(key); if (key) { if (typeof d[key] === 'object') d[key] = this.expand(d[oldKey]); else d[key] = d[oldKey]; if (oldKey !== key) delete d[oldKey]; } else delete d[oldKey]; } return d; }; expand.prototype._fn = function(d) { return this.expand(Object.create(d)); }; module.exports = expand; |