Skip to content

Commit

Permalink
Formatting change: {...} should have spaces inside the braces
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoglan committed Jun 11, 2019
1 parent f6c50ab commit 44a677a
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 68 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ then the `permessage-deflate` extension will receive the call:

```js
ext.createServerSession([
{server_no_context_takeover: true, server_max_window_bits: 8},
{server_max_window_bits: 15}
{ server_no_context_takeover: true, server_max_window_bits: 8 },
{ server_max_window_bits: 15 }
]);
```

Expand All @@ -251,8 +251,8 @@ implement the following methods, as well as the *Session* API listed below.
```js
clientSession.generateOffer()
// e.g. -> [
// {server_no_context_takeover: true, server_max_window_bits: 8},
// {server_max_window_bits: 15}
// { server_no_context_takeover: true, server_max_window_bits: 8 },
// { server_max_window_bits: 15 }
// ]
```

Expand All @@ -277,7 +277,7 @@ must implement the following methods, as well as the *Session* API listed below.

```js
serverSession.generateResponse()
// e.g. -> {server_max_window_bits: 8}
// e.g. -> { server_max_window_bits: 8 }
```

This returns the set of parameters the server session wants to send in its
Expand Down
2 changes: 1 addition & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Offers.prototype.push = function(name, params) {
this._byName[name] = [];

this._byName[name].push(params);
this._inOrder.push({name: name, params: params});
this._inOrder.push({ name: name, params: params });
};

Offers.prototype.eachOffer = function(callback, context) {
Expand Down
10 changes: 5 additions & 5 deletions lib/pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ var crypto = require('crypto'),
large = crypto.randomBytes(1 << 14),
small = new Buffer('hi');

deflate.outgoing({data: large}, function() {
deflate.outgoing({ data: large }, function() {
console.log(1, 'large');
});

deflate.outgoing({data: small}, function() {
deflate.outgoing({ data: small }, function() {
console.log(2, 'small');
});

Expand Down Expand Up @@ -205,7 +205,7 @@ order is preserved:

```js
var stream = require('stream'),
session = new stream.Transform({objectMode: true});
session = new stream.Transform({ objectMode: true });

session._transform = function(message, _, callback) {
var self = this;
Expand Down Expand Up @@ -276,11 +276,11 @@ above:
```js
var functor = new Functor(deflate, 'outgoing');

functor.call({data: large}, function() {
functor.call({ data: large }, function() {
console.log(1, 'large');
});

functor.call({data: small}, function() {
functor.call({ data: small }, function() {
console.log(2, 'small');
});

Expand Down
2 changes: 1 addition & 1 deletion lib/pipeline/functor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Functor.QUEUE_SIZE = 8;
Functor.prototype.call = function(error, message, callback, context) {
if (this._stopped) return;

var record = {error: error, message: message, callback: callback, context: context, done: false},
var record = { error: error, message: message, callback: callback, context: context, done: false },
called = false,
self = this;

Expand Down
4 changes: 2 additions & 2 deletions lib/pipeline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var Cell = require('./cell'),

var Pipeline = function(sessions) {
this._cells = sessions.map(function(session) { return new Cell(session) });
this._stopped = {incoming: false, outgoing: false};
this._stopped = { incoming: false, outgoing: false };
};

Pipeline.prototype.processIncomingMessage = function(message, callback, context) {
Expand All @@ -19,7 +19,7 @@ Pipeline.prototype.processOutgoingMessage = function(message, callback, context)
};

Pipeline.prototype.close = function(callback, context) {
this._stopped = {incoming: true, outgoing: true};
this._stopped = { incoming: true, outgoing: true };

var closed = this._cells.map(function(a) { return a.close() });
if (callback)
Expand Down
2 changes: 1 addition & 1 deletion lib/websocket_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ var instance = {
},

validFrameRsv: function(frame) {
var allowed = {rsv1: false, rsv2: false, rsv3: false},
var allowed = { rsv1: false, rsv2: false, rsv3: false },
ext;

if (Extensions.MESSAGE_OPCODES.indexOf(frame.opcode) >= 0) {
Expand Down
38 changes: 19 additions & 19 deletions spec/parser_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,56 @@ test.describe("Parser", function() { with(this) {
}})

it("parses one offer with no params", function() { with(this) {
assertEqual( [{name: "a", params: {}}],
assertEqual( [{ name: "a", params: {}}],
parse('a') )
}})

it("parses two offers with no params", function() { with(this) {
assertEqual( [{name: "a", params: {}}, {name: "b", params: {}}],
assertEqual( [{ name: "a", params: {}}, { name: "b", params: {}}],
parse('a, b') )
}})

it("parses a duplicate offer name", function() { with(this) {
assertEqual( [{name: "a", params: {}}, {name: "a", params: {}}],
assertEqual( [{ name: "a", params: {}}, { name: "a", params: {}}],
parse('a, a') )
}})

it("parses a flag", function() { with(this) {
assertEqual( [{name: "a", params: {b: true}}],
assertEqual( [{ name: "a", params: { b: true }}],
parse('a; b') )
}})

it("parses an unquoted param", function() { with(this) {
assertEqual( [{name: "a", params: {b: 1}}],
assertEqual( [{ name: "a", params: { b: 1 }}],
parse('a; b=1') )
}})

it("parses a quoted param", function() { with(this) {
assertEqual( [{name: "a", params: {b: 'hi, "there'}}],
assertEqual( [{ name: "a", params: { b: 'hi, "there' }}],
parse('a; b="hi, \\"there"') )
}})

it("parses multiple params", function() { with(this) {
assertEqual( [{name: "a", params: {b: true, c: 1, d: 'hi'}}],
assertEqual( [{ name: "a", params: { b: true, c: 1, d: 'hi' }}],
parse('a; b; c=1; d="hi"') )
}})

it("parses duplicate params", function() { with(this) {
assertEqual( [{name: "a", params: {b: [true, 'hi'], c: 1}}],
assertEqual( [{ name: "a", params: { b: [true, 'hi'], c: 1 }}],
parse('a; b; c=1; b="hi"') )
}})

it("parses multiple complex offers", function() { with(this) {
assertEqual( [{name: "a", params: {b: 1}},
{name: "c", params: {}},
{name: "b", params: {d: true}},
{name: "c", params: {e: ['hi, there', true]}},
{name: "a", params: {b: true}}],
assertEqual( [{ name: "a", params: { b: 1 }},
{ name: "c", params: {}},
{ name: "b", params: { d: true }},
{ name: "c", params: { e: ['hi, there', true] }},
{ name: "a", params: { b: true }}],
parse('a; b=1, c, b; d, c; e="hi, there"; e, a; b') )
}})

it("parses an extension name that shadows an Object property", function() { with(this) {
assertEqual( [{name: "hasOwnProperty", params: {}}],
assertEqual( [{ name: "hasOwnProperty", params: {}}],
parse('hasOwnProperty') )
}})

Expand All @@ -86,23 +86,23 @@ test.describe("Parser", function() { with(this) {
}})

it("serializes a flag", function() { with(this) {
assertEqual( 'a; b', Parser.serializeParams('a', {b: true}) )
assertEqual( 'a; b', Parser.serializeParams('a', { b: true }) )
}})

it("serializes an unquoted param", function() { with(this) {
assertEqual( 'a; b=42', Parser.serializeParams('a', {b: '42'}) )
assertEqual( 'a; b=42', Parser.serializeParams('a', { b: '42' }) )
}})

it("serializes a quoted param", function() { with(this) {
assertEqual( 'a; b="hi, there"', Parser.serializeParams('a', {b: 'hi, there'}) )
assertEqual( 'a; b="hi, there"', Parser.serializeParams('a', { b: 'hi, there' }) )
}})

it("serializes multiple params", function() { with(this) {
assertEqual( 'a; b; c=1; d=hi', Parser.serializeParams('a', {b: true, c: 1, d: 'hi'}) )
assertEqual( 'a; b; c=1; d=hi', Parser.serializeParams('a', { b: true, c: 1, d: 'hi' }) )
}})

it("serializes duplicate params", function() { with(this) {
assertEqual( 'a; b; b=hi; c=1', Parser.serializeParams('a', {b: [true, 'hi'], c: 1}) )
assertEqual( 'a; b; b=hi; c=1', Parser.serializeParams('a', { b: [true, 'hi'], c: 1 }) )
}})
}})
}})
Loading

1 comment on commit 44a677a

@Nyambura254
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small mistake can cause much

Please sign in to comment.