Firebase Update
This commit is contained in:
		
							
								
								
									
										2
									
								
								express-server/node_modules/buffer-writer/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								express-server/node_modules/buffer-writer/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,2 +0,0 @@
 | 
			
		||||
benchmark/versions/
 | 
			
		||||
node_modules
 | 
			
		||||
							
								
								
									
										7
									
								
								express-server/node_modules/buffer-writer/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								express-server/node_modules/buffer-writer/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,4 +1,7 @@
 | 
			
		||||
language: node_js
 | 
			
		||||
node_js:
 | 
			
		||||
  - 0.8
 | 
			
		||||
  - 0.9
 | 
			
		||||
  - 4
 | 
			
		||||
  - 6
 | 
			
		||||
  - 8
 | 
			
		||||
  - 10
 | 
			
		||||
  - 11
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										86
									
								
								express-server/node_modules/buffer-writer/benchmark/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										86
									
								
								express-server/node_modules/buffer-writer/benchmark/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,86 +0,0 @@
 | 
			
		||||
var fs = require('fs');
 | 
			
		||||
var path = require('path');
 | 
			
		||||
 | 
			
		||||
var bench = require('bench');
 | 
			
		||||
var async = require('async');
 | 
			
		||||
var rmdir = require('rmdir');
 | 
			
		||||
var ok = require('okay');
 | 
			
		||||
var cloned = require('cloned');
 | 
			
		||||
cloned.workingDir = __dirname + '/versions';
 | 
			
		||||
 | 
			
		||||
exports.compare = {
 | 
			
		||||
  'math': function() {
 | 
			
		||||
    var two = 1 + 1;
 | 
			
		||||
  },
 | 
			
		||||
  'another': function() {
 | 
			
		||||
    var yay = 2 + 2;
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var clone = function(rev, cb) {
 | 
			
		||||
  var outputDir = path.join(cloned.workingDir, rev);
 | 
			
		||||
  console.log(outputDir)
 | 
			
		||||
  if(fs.existsSync(outputDir)) {
 | 
			
		||||
    return cb(null, {
 | 
			
		||||
      rev: rev,
 | 
			
		||||
      dir: outputDir
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  console.log('cloning version ' + rev);
 | 
			
		||||
  cloned(rev, ok(cb, function(dir) {
 | 
			
		||||
    console.log('cloned version ' + rev + ' to ' + dir);
 | 
			
		||||
    cb(null, {
 | 
			
		||||
      rev: rev,
 | 
			
		||||
      dir: dir
 | 
			
		||||
    });
 | 
			
		||||
  }));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var versions = [
 | 
			
		||||
  'ef599d3'
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
var scripts = fs.readdirSync(__dirname).filter(function(x) {
 | 
			
		||||
  return x.indexOf('benchmark') > 0;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
if(process.argv[2]) {
 | 
			
		||||
  scripts = [process.argv[2]]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
var run = function() {
 | 
			
		||||
  async.map(versions, clone, function(err, results) {
 | 
			
		||||
    if(err) throw err;
 | 
			
		||||
    exports.compare = { };
 | 
			
		||||
    var suites = [];
 | 
			
		||||
    scripts.forEach(function(script) {
 | 
			
		||||
      for(var i = 0; i < results.length; i++) {
 | 
			
		||||
        var result = results[i];
 | 
			
		||||
        var benchPath = path.join(result.dir, 'benchmark', script);
 | 
			
		||||
        var suite = {};
 | 
			
		||||
        suites.push(suite);
 | 
			
		||||
        if(fs.existsSync(benchPath)) {
 | 
			
		||||
          var bench = require(benchPath);
 | 
			
		||||
          suite[script + '@' + result.rev] = bench;
 | 
			
		||||
        } else {
 | 
			
		||||
          console.log('%s missing at revision %s', benchPath, result.rev);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      suite[script + '@HEAD'] = require(__dirname + '/' + script);
 | 
			
		||||
    });
 | 
			
		||||
    var compare = function(suite, cb) {
 | 
			
		||||
      console.log('running...')
 | 
			
		||||
      bench.compare(suite, null, null, null, function(err, data) {
 | 
			
		||||
        if(err) return cb(err);
 | 
			
		||||
        bench.show(data);
 | 
			
		||||
        cb(null);
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
    async.eachSeries(suites, compare, function(err, res) {
 | 
			
		||||
      console.log('all suites done')
 | 
			
		||||
    })
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
run();
 | 
			
		||||
							
								
								
									
										31
									
								
								express-server/node_modules/buffer-writer/benchmark/int-16-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								express-server/node_modules/buffer-writer/benchmark/int-16-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,31 +0,0 @@
 | 
			
		||||
var Writer = require(__dirname + '/../');
 | 
			
		||||
 | 
			
		||||
module.exports = function() {
 | 
			
		||||
  var writer = new Writer();
 | 
			
		||||
  writer.addInt16(-100000000);
 | 
			
		||||
  writer.addInt16(-1000);
 | 
			
		||||
  writer.addInt16(-1);
 | 
			
		||||
  writer.addInt16(0);
 | 
			
		||||
  writer.addInt16(1);
 | 
			
		||||
  writer.addInt16(1000);
 | 
			
		||||
  writer.addInt16(1000000000);
 | 
			
		||||
  writer.addInt16(-100000000);
 | 
			
		||||
  writer.addInt16(-100000000);
 | 
			
		||||
  writer.addInt16(-1000);
 | 
			
		||||
  writer.addInt16(-1);
 | 
			
		||||
  writer.addInt16(0);
 | 
			
		||||
  writer.addInt16(1);
 | 
			
		||||
  writer.addInt16(1000);
 | 
			
		||||
  writer.addInt16(1000000000);
 | 
			
		||||
  writer.addInt16(-1000);
 | 
			
		||||
  writer.addInt16(-1);
 | 
			
		||||
  writer.addInt16(0);
 | 
			
		||||
  writer.addInt16(1);
 | 
			
		||||
  writer.addInt16(1000);
 | 
			
		||||
  writer.addInt16(1000000000);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if(!module.parent) {
 | 
			
		||||
  module.exports();
 | 
			
		||||
  console.log('benchmark ok');
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								express-server/node_modules/buffer-writer/benchmark/int-32-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								express-server/node_modules/buffer-writer/benchmark/int-32-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,17 +0,0 @@
 | 
			
		||||
var Writer = require(__dirname + '/../');
 | 
			
		||||
 | 
			
		||||
module.exports = function() {
 | 
			
		||||
  var writer = new Writer();
 | 
			
		||||
  writer.addInt32(-10000000000000);
 | 
			
		||||
  writer.addInt32(-1000);
 | 
			
		||||
  writer.addInt32(-1);
 | 
			
		||||
  writer.addInt32(0);
 | 
			
		||||
  writer.addInt32(1);
 | 
			
		||||
  writer.addInt32(1000);
 | 
			
		||||
  writer.addInt32(10000000000000);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if(!module.parent) {
 | 
			
		||||
  module.exports();
 | 
			
		||||
  console.log('benchmark ok');
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								express-server/node_modules/buffer-writer/benchmark/join-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								express-server/node_modules/buffer-writer/benchmark/join-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,16 +0,0 @@
 | 
			
		||||
var Writer = require(__dirname + '/../');
 | 
			
		||||
 | 
			
		||||
var writer = new Writer();
 | 
			
		||||
writer.addCString('hello');
 | 
			
		||||
writer.addCString('something else, really');
 | 
			
		||||
writer.addInt32(38013);
 | 
			
		||||
writer.addCString('and that\'s all she wrote, folks\n...\n...not really');
 | 
			
		||||
 | 
			
		||||
module.exports = function() {
 | 
			
		||||
  writer.join(0x50);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if(!module.parent) {
 | 
			
		||||
  module.exports();
 | 
			
		||||
  console.log('benchmark ok');
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										23
									
								
								express-server/node_modules/buffer-writer/benchmark/resize-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								express-server/node_modules/buffer-writer/benchmark/resize-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,23 +0,0 @@
 | 
			
		||||
var Writer = require(__dirname + '/../');
 | 
			
		||||
 | 
			
		||||
var string = "";
 | 
			
		||||
for(var i = 0; i < 10; i++) {
 | 
			
		||||
  string += 'Once upon a time long ago there lived a little programming language named JavaScript';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = function() {
 | 
			
		||||
  var writer = new Writer(4);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
  writer.addCString(string);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if(!module.parent) {
 | 
			
		||||
  module.exports();
 | 
			
		||||
  console.log('benchmark ok');
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										14
									
								
								express-server/node_modules/buffer-writer/benchmark/small-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								express-server/node_modules/buffer-writer/benchmark/small-benchmark.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,14 +0,0 @@
 | 
			
		||||
var Writer = require(__dirname + '/../');
 | 
			
		||||
 | 
			
		||||
module.exports = function() {
 | 
			
		||||
  var writer = new Writer();
 | 
			
		||||
  writer.addInt32(10);
 | 
			
		||||
  writer.addInt16(5);
 | 
			
		||||
  writer.addCString('test');
 | 
			
		||||
  writer.flush('X');
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if(!module.parent) {
 | 
			
		||||
  module.exports();
 | 
			
		||||
  console.log('benchmark ok');
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										54
									
								
								express-server/node_modules/buffer-writer/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										54
									
								
								express-server/node_modules/buffer-writer/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,57 +1,57 @@
 | 
			
		||||
//binary data writer tuned for creating
 | 
			
		||||
//postgres message packets as effeciently as possible by reusing the
 | 
			
		||||
//same buffer to avoid memcpy and limit memory allocations
 | 
			
		||||
var Writer = module.exports = function(size) {
 | 
			
		||||
var Writer = module.exports = function (size) {
 | 
			
		||||
  this.size = size || 1024;
 | 
			
		||||
  this.buffer = Buffer(this.size + 5);
 | 
			
		||||
  this.buffer = Buffer.alloc(this.size + 5);
 | 
			
		||||
  this.offset = 5;
 | 
			
		||||
  this.headerPosition = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//resizes internal buffer if not enough size left
 | 
			
		||||
Writer.prototype._ensure = function(size) {
 | 
			
		||||
Writer.prototype._ensure = function (size) {
 | 
			
		||||
  var remaining = this.buffer.length - this.offset;
 | 
			
		||||
  if(remaining < size) {
 | 
			
		||||
  if (remaining < size) {
 | 
			
		||||
    var oldBuffer = this.buffer;
 | 
			
		||||
    // exponential growth factor of around ~ 1.5
 | 
			
		||||
    // https://stackoverflow.com/questions/2269063/buffer-growth-strategy
 | 
			
		||||
    var newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
 | 
			
		||||
    this.buffer = new Buffer(newSize);
 | 
			
		||||
    this.buffer = Buffer.alloc(newSize);
 | 
			
		||||
    oldBuffer.copy(this.buffer);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.addInt32 = function(num) {
 | 
			
		||||
Writer.prototype.addInt32 = function (num) {
 | 
			
		||||
  this._ensure(4);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>> 24 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>> 16 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>>  8 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>>  0 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>> 8 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>> 0 & 0xFF);
 | 
			
		||||
  return this;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.addInt16 = function(num) {
 | 
			
		||||
Writer.prototype.addInt16 = function (num) {
 | 
			
		||||
  this._ensure(2);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>>  8 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>>  0 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>> 8 & 0xFF);
 | 
			
		||||
  this.buffer[this.offset++] = (num >>> 0 & 0xFF);
 | 
			
		||||
  return this;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//for versions of node requiring 'length' as 3rd argument to buffer.write
 | 
			
		||||
var writeString = function(buffer, string, offset, len) {
 | 
			
		||||
var writeString = function (buffer, string, offset, len) {
 | 
			
		||||
  buffer.write(string, offset, len);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//overwrite function for older versions of node
 | 
			
		||||
if(Buffer.prototype.write.length === 3) {
 | 
			
		||||
  writeString = function(buffer, string, offset, len) {
 | 
			
		||||
if (Buffer.prototype.write.length === 3) {
 | 
			
		||||
  writeString = function (buffer, string, offset, len) {
 | 
			
		||||
    buffer.write(string, offset);
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Writer.prototype.addCString = function(string) {
 | 
			
		||||
Writer.prototype.addCString = function (string) {
 | 
			
		||||
  //just write a 0 for empty or null strings
 | 
			
		||||
  if(!string) {
 | 
			
		||||
  if (!string) {
 | 
			
		||||
    this._ensure(1);
 | 
			
		||||
  } else {
 | 
			
		||||
    var len = Buffer.byteLength(string);
 | 
			
		||||
@@ -64,14 +64,14 @@ Writer.prototype.addCString = function(string) {
 | 
			
		||||
  return this;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.addChar = function(c) {
 | 
			
		||||
Writer.prototype.addChar = function (c) {
 | 
			
		||||
  this._ensure(1);
 | 
			
		||||
  writeString(this.buffer, c, this.offset, 1);
 | 
			
		||||
  this.offset++;
 | 
			
		||||
  return this;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.addString = function(string) {
 | 
			
		||||
Writer.prototype.addString = function (string) {
 | 
			
		||||
  string = string || "";
 | 
			
		||||
  var len = Buffer.byteLength(string);
 | 
			
		||||
  this._ensure(len);
 | 
			
		||||
@@ -80,18 +80,18 @@ Writer.prototype.addString = function(string) {
 | 
			
		||||
  return this;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.getByteLength = function() {
 | 
			
		||||
Writer.prototype.getByteLength = function () {
 | 
			
		||||
  return this.offset - 5;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.add = function(otherBuffer) {
 | 
			
		||||
Writer.prototype.add = function (otherBuffer) {
 | 
			
		||||
  this._ensure(otherBuffer.length);
 | 
			
		||||
  otherBuffer.copy(this.buffer, this.offset);
 | 
			
		||||
  this.offset += otherBuffer.length;
 | 
			
		||||
  return this;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.clear = function() {
 | 
			
		||||
Writer.prototype.clear = function () {
 | 
			
		||||
  this.offset = 5;
 | 
			
		||||
  this.headerPosition = 0;
 | 
			
		||||
  this.lastEnd = 0;
 | 
			
		||||
@@ -99,30 +99,30 @@ Writer.prototype.clear = function() {
 | 
			
		||||
 | 
			
		||||
//appends a header block to all the written data since the last
 | 
			
		||||
//subsequent header or to the beginning if there is only one data block
 | 
			
		||||
Writer.prototype.addHeader = function(code, last) {
 | 
			
		||||
Writer.prototype.addHeader = function (code, last) {
 | 
			
		||||
  var origOffset = this.offset;
 | 
			
		||||
  this.offset = this.headerPosition;
 | 
			
		||||
  this.buffer[this.offset++] = code;
 | 
			
		||||
  //length is everything in this packet minus the code
 | 
			
		||||
  this.addInt32(origOffset - (this.headerPosition+1));
 | 
			
		||||
  this.addInt32(origOffset - (this.headerPosition + 1));
 | 
			
		||||
  //set next header position
 | 
			
		||||
  this.headerPosition = origOffset;
 | 
			
		||||
  //make space for next header
 | 
			
		||||
  this.offset = origOffset;
 | 
			
		||||
  if(!last) {
 | 
			
		||||
  if (!last) {
 | 
			
		||||
    this._ensure(5);
 | 
			
		||||
    this.offset += 5;
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.join = function(code) {
 | 
			
		||||
  if(code) {
 | 
			
		||||
Writer.prototype.join = function (code) {
 | 
			
		||||
  if (code) {
 | 
			
		||||
    this.addHeader(code, true);
 | 
			
		||||
  }
 | 
			
		||||
  return this.buffer.slice(code ? 0 : 5, this.offset);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Writer.prototype.flush = function(code) {
 | 
			
		||||
Writer.prototype.flush = function (code) {
 | 
			
		||||
  var result = this.join(code);
 | 
			
		||||
  this.clear();
 | 
			
		||||
  return result;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								express-server/node_modules/buffer-writer/package.json
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								express-server/node_modules/buffer-writer/package.json
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,27 +1,27 @@
 | 
			
		||||
{
 | 
			
		||||
  "_from": "buffer-writer@1.0.1",
 | 
			
		||||
  "_id": "buffer-writer@1.0.1",
 | 
			
		||||
  "_from": "buffer-writer@2.0.0",
 | 
			
		||||
  "_id": "buffer-writer@2.0.0",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha1-Iqk2kB4wKa/NdUfrRIfOtpejvwg=",
 | 
			
		||||
  "_integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==",
 | 
			
		||||
  "_location": "/buffer-writer",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "version",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "buffer-writer@1.0.1",
 | 
			
		||||
    "raw": "buffer-writer@2.0.0",
 | 
			
		||||
    "name": "buffer-writer",
 | 
			
		||||
    "escapedName": "buffer-writer",
 | 
			
		||||
    "rawSpec": "1.0.1",
 | 
			
		||||
    "rawSpec": "2.0.0",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "1.0.1"
 | 
			
		||||
    "fetchSpec": "2.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/pg"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-1.0.1.tgz",
 | 
			
		||||
  "_shasum": "22a936901e3029afcd7547eb4487ceb697a3bf08",
 | 
			
		||||
  "_spec": "buffer-writer@1.0.1",
 | 
			
		||||
  "_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\SmartShopper\\express-server\\node_modules\\pg",
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
 | 
			
		||||
  "_shasum": "ce7eb81a38f7829db09c873f2fbb792c0c98ec04",
 | 
			
		||||
  "_spec": "buffer-writer@2.0.0",
 | 
			
		||||
  "_where": "D:\\Desktop\\Git\\Firebase\\SmartShopperFirebase\\node_modules\\pg",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Brian M. Carlson"
 | 
			
		||||
  },
 | 
			
		||||
@@ -32,14 +32,10 @@
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "a fast, efficient buffer writer",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "async": "~0.2.6",
 | 
			
		||||
    "bench": "~0.3.5",
 | 
			
		||||
    "benchmark": "~1.0.0",
 | 
			
		||||
    "cloned": "0.0.1",
 | 
			
		||||
    "microtime": "~0.3.3",
 | 
			
		||||
    "mocha": "~1.8.1",
 | 
			
		||||
    "okay": "0.0.2",
 | 
			
		||||
    "rmdir": "~1.0.0"
 | 
			
		||||
    "mocha": "5.2.0"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=4"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/brianc/node-buffer-writer#readme",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
@@ -55,7 +51,7 @@
 | 
			
		||||
    "url": "git://github.com/brianc/node-buffer-writer.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "mocha"
 | 
			
		||||
    "test": "mocha --throw-deprecation"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "1.0.1"
 | 
			
		||||
  "version": "2.0.0"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										100
									
								
								express-server/node_modules/buffer-writer/test/writer-tests.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										100
									
								
								express-server/node_modules/buffer-writer/test/writer-tests.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -3,28 +3,28 @@ var Writer = require(__dirname + "/../");
 | 
			
		||||
var assert = require('assert');
 | 
			
		||||
var util = require('util');
 | 
			
		||||
 | 
			
		||||
assert.equalBuffers = function(actual, expected) {
 | 
			
		||||
  var spit = function(actual, expected) {
 | 
			
		||||
assert.equalBuffers = function (actual, expected) {
 | 
			
		||||
  var spit = function (actual, expected) {
 | 
			
		||||
    console.log("");
 | 
			
		||||
    console.log("actual " + util.inspect(actual));
 | 
			
		||||
    console.log("expect " + util.inspect(expected));
 | 
			
		||||
    console.log("");
 | 
			
		||||
  };
 | 
			
		||||
  if(actual.length != expected.length) {
 | 
			
		||||
  if (actual.length != expected.length) {
 | 
			
		||||
    spit(actual, expected);
 | 
			
		||||
    assert.equal(actual.length, expected.length);
 | 
			
		||||
    assert.strictEqual(actual.length, expected.length);
 | 
			
		||||
  }
 | 
			
		||||
  for(var i = 0; i < actual.length; i++) {
 | 
			
		||||
    if(actual[i] != expected[i]) {
 | 
			
		||||
  for (var i = 0; i < actual.length; i++) {
 | 
			
		||||
    if (actual[i] != expected[i]) {
 | 
			
		||||
      spit(actual, expected);
 | 
			
		||||
    }
 | 
			
		||||
    assert.equal(actual[i],expected[i]);
 | 
			
		||||
    assert.strictEqual(actual[i], expected[i]);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
suite('adding int32', function() {
 | 
			
		||||
  var testAddingInt32 = function(int, expectedBuffer) {
 | 
			
		||||
    test('writes ' + int, function() {
 | 
			
		||||
suite('adding int32', function () {
 | 
			
		||||
  var testAddingInt32 = function (int, expectedBuffer) {
 | 
			
		||||
    test('writes ' + int, function () {
 | 
			
		||||
      var subject = new Writer();
 | 
			
		||||
      var result = subject.addInt32(int).join();
 | 
			
		||||
      assert.equalBuffers(result, expectedBuffer);
 | 
			
		||||
@@ -34,19 +34,19 @@ suite('adding int32', function() {
 | 
			
		||||
  testAddingInt32(0, [0, 0, 0, 0]);
 | 
			
		||||
  testAddingInt32(1, [0, 0, 0, 1]);
 | 
			
		||||
  testAddingInt32(256, [0, 0, 1, 0]);
 | 
			
		||||
  test('writes largest int32', function() {
 | 
			
		||||
  test('writes largest int32', function () {
 | 
			
		||||
    //todo need to find largest int32 when I have internet access
 | 
			
		||||
    return false;
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('writing multiple int32s', function() {
 | 
			
		||||
  test('writing multiple int32s', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addInt32(1).addInt32(10).addInt32(0).join();
 | 
			
		||||
    assert.equalBuffers(result, [0, 0, 0, 1, 0, 0, 0, 0x0a, 0, 0, 0, 0]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  suite('having to resize the buffer', function() {
 | 
			
		||||
    test('after resize correct result returned', function() {
 | 
			
		||||
  suite('having to resize the buffer', function () {
 | 
			
		||||
    test('after resize correct result returned', function () {
 | 
			
		||||
      var subject = new Writer(10);
 | 
			
		||||
      subject.addInt32(1).addInt32(1).addInt32(1);
 | 
			
		||||
      assert.equalBuffers(subject.join(), [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]);
 | 
			
		||||
@@ -54,26 +54,26 @@ suite('adding int32', function() {
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
suite('int16', function() {
 | 
			
		||||
  test('writes 0', function() {
 | 
			
		||||
suite('int16', function () {
 | 
			
		||||
  test('writes 0', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addInt16(0).join();
 | 
			
		||||
    assert.equalBuffers(result, [0,0]);
 | 
			
		||||
    assert.equalBuffers(result, [0, 0]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('writes 400', function() {
 | 
			
		||||
  test('writes 400', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addInt16(400).join();
 | 
			
		||||
    assert.equalBuffers(result, [1, 0x90]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('writes many', function() {
 | 
			
		||||
  test('writes many', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addInt16(0).addInt16(1).addInt16(2).join();
 | 
			
		||||
    assert.equalBuffers(result, [0, 0, 0, 1, 0, 2]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('resizes if internal buffer fills up', function() {
 | 
			
		||||
  test('resizes if internal buffer fills up', function () {
 | 
			
		||||
    var subject = new Writer(3);
 | 
			
		||||
    var result = subject.addInt16(2).addInt16(3).join();
 | 
			
		||||
    assert.equalBuffers(result, [0, 2, 0, 3]);
 | 
			
		||||
@@ -81,33 +81,33 @@ suite('int16', function() {
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
suite('cString', function() {
 | 
			
		||||
  test('writes empty cstring', function() {
 | 
			
		||||
suite('cString', function () {
 | 
			
		||||
  test('writes empty cstring', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addCString().join();
 | 
			
		||||
    assert.equalBuffers(result, [0]);
 | 
			
		||||
  });
 | 
			
		||||
  
 | 
			
		||||
  test('writes two empty cstrings', function() {
 | 
			
		||||
 | 
			
		||||
  test('writes two empty cstrings', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addCString("").addCString("").join();
 | 
			
		||||
    assert.equalBuffers(result, [0, 0]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  test('writes non-empty cstring', function() {
 | 
			
		||||
  test('writes non-empty cstring', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addCString("!!!").join();
 | 
			
		||||
    assert.equalBuffers(result, [33, 33, 33, 0]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('resizes if reached end', function() {
 | 
			
		||||
  test('resizes if reached end', function () {
 | 
			
		||||
    var subject = new Writer(3);
 | 
			
		||||
    var result = subject.addCString("!!!").join();
 | 
			
		||||
    assert.equalBuffers(result, [33, 33, 33, 0]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('writes multiple cstrings', function() {
 | 
			
		||||
  test('writes multiple cstrings', function () {
 | 
			
		||||
    var subject = new Writer();
 | 
			
		||||
    var result = subject.addCString("!").addCString("!").join();
 | 
			
		||||
    assert.equalBuffers(result, [33, 0, 33, 0]);
 | 
			
		||||
@@ -115,101 +115,101 @@ suite('cString', function() {
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test('writes char', function() {
 | 
			
		||||
test('writes char', function () {
 | 
			
		||||
  var subject = new Writer(2);
 | 
			
		||||
  var result = subject.addChar('a').addChar('b').addChar('c').join();
 | 
			
		||||
  assert.equalBuffers(result, [0x61, 0x62, 0x63]);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test('gets correct byte length', function() {
 | 
			
		||||
test('gets correct byte length', function () {
 | 
			
		||||
  var subject = new Writer(5);
 | 
			
		||||
  assert.equal(subject.getByteLength(), 0);
 | 
			
		||||
  assert.strictEqual(subject.getByteLength(), 0);
 | 
			
		||||
  subject.addInt32(0);
 | 
			
		||||
  assert.equal(subject.getByteLength(), 4);
 | 
			
		||||
  assert.strictEqual(subject.getByteLength(), 4);
 | 
			
		||||
  subject.addCString("!");
 | 
			
		||||
  assert.equal(subject.getByteLength(), 6);
 | 
			
		||||
  assert.strictEqual(subject.getByteLength(), 6);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test('can add arbitrary buffer to the end', function() {
 | 
			
		||||
test('can add arbitrary buffer to the end', function () {
 | 
			
		||||
  var subject = new Writer(4);
 | 
			
		||||
  subject.addCString("!!!")
 | 
			
		||||
  var result = subject.add(Buffer("@@@")).join();
 | 
			
		||||
  var result = subject.add(Buffer.from("@@@")).join();
 | 
			
		||||
  assert.equalBuffers(result, [33, 33, 33, 0, 0x40, 0x40, 0x40]);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
suite('can write normal string', function() {
 | 
			
		||||
suite('can write normal string', function () {
 | 
			
		||||
  var subject = new Writer(4);
 | 
			
		||||
  var result = subject.addString("!").join();
 | 
			
		||||
  assert.equalBuffers(result, [33]);
 | 
			
		||||
  test('can write cString too', function() {
 | 
			
		||||
  test('can write cString too', function () {
 | 
			
		||||
    var result = subject.addCString("!").join();
 | 
			
		||||
    assert.equalBuffers(result, [33, 33, 0]);
 | 
			
		||||
  });
 | 
			
		||||
  test('can resize', function() {
 | 
			
		||||
  test('can resize', function () {
 | 
			
		||||
    var result = subject.addString("!!").join();
 | 
			
		||||
    assert.equalBuffers(result, [33, 33, 0, 33, 33]);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
suite('clearing', function() {
 | 
			
		||||
suite('clearing', function () {
 | 
			
		||||
  var subject = new Writer();
 | 
			
		||||
  subject.addCString("@!!#!#");
 | 
			
		||||
  subject.addInt32(10401);
 | 
			
		||||
  test('clears', function() {
 | 
			
		||||
  test('clears', function () {
 | 
			
		||||
    subject.clear();
 | 
			
		||||
    assert.equalBuffers(subject.join(), []);
 | 
			
		||||
  });
 | 
			
		||||
  test('writing more', function() {
 | 
			
		||||
  test('writing more', function () {
 | 
			
		||||
    var joinedResult = subject.addCString("!").addInt32(9).addInt16(2).join();
 | 
			
		||||
    assert.equalBuffers(joinedResult, [33, 0, 0, 0, 0, 9, 0, 2]);
 | 
			
		||||
  });
 | 
			
		||||
  test('returns result', function() {
 | 
			
		||||
  test('returns result', function () {
 | 
			
		||||
    var flushedResult = subject.flush();
 | 
			
		||||
    assert.equalBuffers(flushedResult, [33, 0, 0, 0, 0, 9, 0, 2])
 | 
			
		||||
  });
 | 
			
		||||
  test('clears the writer', function() {
 | 
			
		||||
  test('clears the writer', function () {
 | 
			
		||||
    assert.equalBuffers(subject.join(), [])
 | 
			
		||||
    assert.equalBuffers(subject.flush(), [])
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test("resizing to much larger", function() {
 | 
			
		||||
test("resizing to much larger", function () {
 | 
			
		||||
  var subject = new Writer(2);
 | 
			
		||||
  var string = "!!!!!!!!";
 | 
			
		||||
  var result = subject.addCString(string).flush();
 | 
			
		||||
  assert.equalBuffers(result, [33, 33, 33, 33, 33, 33, 33, 33, 0]);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
suite("flush", function() {
 | 
			
		||||
  test('added as a hex code to a full writer', function() {
 | 
			
		||||
suite("flush", function () {
 | 
			
		||||
  test('added as a hex code to a full writer', function () {
 | 
			
		||||
    var subject = new Writer(2);
 | 
			
		||||
    var result = subject.addCString("!").flush(0x50);
 | 
			
		||||
    assert.equalBuffers(result, [0x50, 0, 0, 0, 6, 33, 0]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('added as a hex code to a non-full writer', function() {
 | 
			
		||||
  test('added as a hex code to a non-full writer', function () {
 | 
			
		||||
    var subject = new Writer(10).addCString("!");
 | 
			
		||||
    var joinedResult = subject.join(0x50);
 | 
			
		||||
    var result = subject.flush(0x50);
 | 
			
		||||
    assert.equalBuffers(result, [0x50, 0, 0, 0, 6, 33, 0]);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test('added as a hex code to a buffer which requires resizing', function() {
 | 
			
		||||
  test('added as a hex code to a buffer which requires resizing', function () {
 | 
			
		||||
    var result = new Writer(2).addCString("!!!!!!!!").flush(0x50);
 | 
			
		||||
    assert.equalBuffers(result, [0x50, 0, 0, 0, 0x0D, 33, 33, 33, 33, 33, 33, 33, 33, 0]);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
suite("header", function() {
 | 
			
		||||
  test('adding two packets with headers', function() {
 | 
			
		||||
suite("header", function () {
 | 
			
		||||
  test('adding two packets with headers', function () {
 | 
			
		||||
    var subject = new Writer(10).addCString("!");
 | 
			
		||||
    subject.addHeader(0x50);
 | 
			
		||||
    subject.addCString("!!");
 | 
			
		||||
    subject.addHeader(0x40);
 | 
			
		||||
    subject.addCString("!");
 | 
			
		||||
    var result = subject.flush(0x10);
 | 
			
		||||
    assert.equalBuffers(result, [0x50, 0, 0, 0, 6, 33, 0, 0x40, 0, 0, 0, 7, 33, 33, 0, 0x10, 0, 0, 0, 6, 33, 0 ]);
 | 
			
		||||
    assert.equalBuffers(result, [0x50, 0, 0, 0, 6, 33, 0, 0x40, 0, 0, 0, 7, 33, 33, 0, 0x10, 0, 0, 0, 6, 33, 0]);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user