Skip to content

Commit

Permalink
Convert files in src to next-gen JS.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurschreiber committed Aug 31, 2015
1 parent f8f4db4 commit 0317b53
Show file tree
Hide file tree
Showing 91 changed files with 6,789 additions and 5,454 deletions.
12 changes: 4 additions & 8 deletions package.json
Expand Up @@ -52,16 +52,12 @@
"nodeunit": "^0.9.1"
},
"scripts": {
"test": "nodeunit --reporter minimal test/register-coffee.js test/unit/ test/unit/token/ test/unit/tracking-buffer",
"test-all": "nodeunit --reporter minimal test/register-coffee.js test/unit/ test/unit/token/ test/unit/tracking-buffer test/integration/",
"test-integration": "nodeunit --reporter minimal test/register-coffee.js test/integration/",
"test": "nodeunit --reporter minimal test/setup.js test/unit/ test/unit/token/ test/unit/tracking-buffer",
"test-all": "nodeunit --reporter minimal test/setup.js test/unit/ test/unit/token/ test/unit/tracking-buffer test/integration/",
"test-integration": "nodeunit --reporter minimal test/setup.js test/integration/",
"prepublish": "coffee scripts/build.coffee"
},
"babel": {
"whitelist": [
"regenerator",
"es6.modules",
"runtime"
]
"optional": [ "runtime" ]
}
}
2 changes: 1 addition & 1 deletion scripts/build.coffee
Expand Up @@ -37,6 +37,6 @@ if isdir 'src'
if err
console.error err
else
child.exec "#{babel_bin} lib --out-dir lib", (err) ->
child.exec "#{babel_bin} src --out-dir lib", (err) ->
if err
console.error err
27 changes: 0 additions & 27 deletions src/all-headers.coffee

This file was deleted.

21 changes: 21 additions & 0 deletions src/all-headers.js
@@ -0,0 +1,21 @@
const TYPE = {
QUERY_NOTIFICATIONS: 1,
TXN_DESCRIPTOR: 2,
TRACE_ACTIVITY: 3
};

const TXNDESCRIPTOR_HEADER_DATA_LEN = 4 + 8;

const TXNDESCRIPTOR_HEADER_LEN = 4 + 2 + TXNDESCRIPTOR_HEADER_DATA_LEN;

export function writeToTrackingBuffer(buffer, txnDescriptor, outstandingRequestCount) {
buffer.writeUInt32LE(0);
buffer.writeUInt32LE(TXNDESCRIPTOR_HEADER_LEN);
buffer.writeUInt16LE(TYPE.TXN_DESCRIPTOR);
buffer.writeBuffer(txnDescriptor);
buffer.writeUInt32LE(outstandingRequestCount);

const data = buffer.data;
data.writeUInt32LE(data.length, 0);
return buffer;
}
27 changes: 0 additions & 27 deletions src/buffertools.coffee

This file was deleted.

39 changes: 39 additions & 0 deletions src/buffertools.js
@@ -0,0 +1,39 @@
if (!Buffer.concat) {
Buffer.concat = function(buffers) {
const buffersCount = buffers.length;

let length = 0;
for (let i = 0; i < buffersCount; i++) {
const buffer = buffers[i];
length += buffer.length;
}

const result = new Buffer(length);
let position = 0;
for (let i = 0; i < buffersCount; i++) {
const buffer = buffers[i];
buffer.copy(result, position, 0);
position += buffer.length;
}

return result;
};
}

Buffer.prototype.toByteArray = function() {
return Array.prototype.slice.call(this, 0);
};

Buffer.prototype.equals = function(other) {
if (this.length !== other.length) {
return false;
}

for (let i = 0, len = this.length; i < len; i++) {
if (this[i] !== other[i]) {
return false;
}
}

return true;
};
168 changes: 0 additions & 168 deletions src/bulk-load.coffee

This file was deleted.

0 comments on commit 0317b53

Please sign in to comment.