Skip to content

Commit 0fb5a75

Browse files
committed
feature: @putout/plugin-nodejs: convert-buffer-to-buffer-alloc: call
1 parent 7242f4a commit 0fb5a75

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Readable
2+
.from(Buffer.from(binary))
3+
.pipe(process.stdout);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Readable
2+
.from(new Buffer(binary))
3+
.pipe(process.stdout);

packages/plugin-nodejs/lib/convert-buffer-to-buffer-alloc/index.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ const isNumber = (a) => typeof a === 'number';
66

77
export const report = () => `Use 'Buffer.alloc()' or 'Buffer.from()' instead of 'Buffer()' and 'new Buffer()'`;
88

9-
export const match = () => ({
10-
'new Buffer(__a)': (vars, path) => {
11-
const __aPath = path.get('arguments.0');
12-
const [is] = compute(__aPath);
13-
14-
return is;
15-
},
16-
});
17-
189
export const replace = () => ({
1910
'new Buffer(__a)': transform,
2011
'new Buffer(__a, __b)': transform,

packages/plugin-nodejs/lib/convert-buffer-to-buffer-alloc/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ test('nodejs: convert-buffer-to-buffer-alloc: transform: couple-args', (t) => {
2121
t.transform('couple-args');
2222
t.end();
2323
});
24+
25+
test('nodejs: convert-buffer-to-buffer-alloc: transform: call', (t) => {
26+
t.transform('call');
27+
t.end();
28+
});

0 commit comments

Comments
 (0)