8000 Add ByteBuffer.accessor() getter to test build programmatically, upda… · adon-at-work/bytebuffer.js@6f41df7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f41df7

Browse files
committed
Add ByteBuffer.accessor() getter to test build programmatically, updated ByteBuffer#toString to reflect the changes
1 parent 54513ee commit 6f41df7

File tree

14 files changed

+64
-28
lines changed

14 files changed

+64
-28
lines changed

dist/ByteBufferAB.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@
220220
};
221221
}
222222

223+
/**
224+
* Gets the accessor type.
225+
* @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
226+
* @expose
227+
*/
228+
ByteBuffer.accessor = function() {
229+
return Uint8Array;
230+
};
223231
/**
224232
* Allocates a new ByteBuffer backed by a buffer of the specified capacity.
225233
* @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
@@ -292,7 +300,6 @@
292300
ByteBuffer.type = function() {
293301
return ArrayBuffer;
294302
};
295-
296303
/**
297304
* Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
298305
* {@link ByteBuffer#limit} to the length of the wrapped data.

dist/ByteBufferAB.min.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ByteBufferAB.min.js.gz

17 Bytes
Binary file not shown.

dist/ByteBufferAB.min.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/ByteBufferAB_DataView.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@
220220
};
221221
}
222222

223+
/**
224+
* Gets the accessor type.
225+
* @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
226+
* @expose
227+
*/
228+
ByteBuffer.accessor = function() {
229+
return DataView;
230+
};
223231
/**
224232
* Allocates a new ByteBuffer backed by a buffer of the specified capacity.
225233
* @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
@@ -293,7 +301,6 @@
293301
ByteBuffer.type = function() {
294302
return ArrayBuffer;
295303
};
296-
297304
/**
298305
* Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
299306
* {@link ByteBuffer#limit} to the length of the wrapped data.
@@ -2579,7 +2586,7 @@
25792586
*/
25802587
ByteBufferPrototype.toString = function(encoding, begin, end) {
25812588
if (typeof encoding === 'undefined')
2582-
return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
2589+
return "ByteBufferAB_DataView(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
25832590
if (typeof encoding === 'number')
25842591
encoding = "utf8",
25852592
begin = encoding,

0 commit comments

Comments
 (0)
0