Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
527 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var cloneArrayBuffer = require('./_cloneArrayBuffer');
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Creates a clone of `typedArray`.
|
---|
| 5 | *
|
---|
| 6 | * @private
|
---|
| 7 | * @param {Object} typedArray The typed array to clone.
|
---|
| 8 | * @param {boolean} [isDeep] Specify a deep clone.
|
---|
| 9 | * @returns {Object} Returns the cloned typed array.
|
---|
| 10 | */
|
---|
| 11 | function cloneTypedArray(typedArray, isDeep) {
|
---|
| 12 | var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
---|
| 13 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | module.exports = cloneTypedArray;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.