Skip to content

Commit 0319dca

Browse files
committed
Fix code style
1 parent f746d8c commit 0319dca

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

JavaScript/4-module/ring.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
'use strict';
22

3-
const alloc = (size) => ({
4-
size,
5-
buffer: Buffer.alloc(size),
6-
offset: 0,
7-
});
3+
const buffers = [];
4+
5+
const alloc = (size) => {
6+
const instance = {
7+
size,
8+
buffer: Buffer.alloc(size),
9+
offset: 0,
10+
};
11+
buffers.push(instance);
12+
return instance;
13+
};
814

915
const write = (buf, data) => {
1016
const { size, offset } = buf;

JavaScript/4-module/usage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ ring.write(buf, '1');
77
ring.write(buf, '23');
88
ring.write(buf, '4567890A');
99
console.log(ring.read(buf));
10+
11+
//

0 commit comments

Comments
 (0)