Skip to content

Commit 72a3931

Browse files
committed
feat: remove deprecated append overload.
1 parent 1c7e7b5 commit 72a3931

File tree

2 files changed

+2
-37
lines changed

2 files changed

+2
-37
lines changed

src/dynamicBuffer.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -226,37 +226,11 @@ export class DynamicBuffer {
226226
* @param encoding The character encoding to use, default from buffer encoding.
227227
* @returns The number of bytes written.
228228
*/
229-
append(data: string, length?: number, encoding?: BufferEncoding): number;
230-
231-
/**
232-
* Appends string to this buffer according to the character encoding.
233-
*
234-
* @param data String to write to buffer.
235-
* @param encoding The character encoding to use, default from buffer encoding.
236-
* @param length Maximum number of bytes to write, default the length of string.
237-
* @returns The number of bytes written.
238-
* @deprecated
239-
*/
240-
append(data: string, encoding?: BufferEncoding, length?: number): number;
241-
242229
append(
243230
data: string,
244-
lengthParam?: number | BufferEncoding,
245-
encodingParam?: BufferEncoding | number,
231+
length?: number,
232+
encoding?: BufferEncoding,
246233
): number {
247-
let length: number | undefined;
248-
let encoding: BufferEncoding | undefined;
249-
250-
if (typeof lengthParam === 'number' || typeof encodingParam === 'string') {
251-
// @ts-ignore
252-
length = lengthParam;
253-
// @ts-ignore
254-
encoding = encodingParam;
255-
} else {
256-
encoding = lengthParam;
257-
length = encodingParam;
258-
}
259-
260234
const count = this.writeData(data, this.used, length, encoding);
261235
this.used += count;
262236

test/write.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,6 @@ describe('Append tests', () => {
8484
assert.equal(buffer.toString(), str);
8585
});
8686

87-
it('Test append overload', () => {
88-
const buffer = new DynamicBuffer();
89-
90-
const count = buffer.append('Hello world', 'utf8');
91-
92-
assert.equal(count, 11);
93-
assert.equal(buffer.toString(), 'Hello world');
94-
});
95-
9687
it('Test appending string to zero size buffer', () => {
9788
const buffer = new DynamicBuffer({ size: 0 });
9889
const str = 'Hello world';

0 commit comments

Comments
 (0)