MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / copy

Method copy

projects/JavaScript/proto/test.js:13574–13726  ·  view source on GitHub ↗

* Copy struct (shallow copy) * @this {!StructArray} * @param {!StructArray} other Other struct * @returns {!StructArray} This struct

(other)

Source from the content-addressed store, hash-verified

13572 * @returns {!StructArray} This struct
13573 */
13574 copy (other) {
13575 if (other.f1 != null) {
13576 this.f1 = []
13577 for (let item of other.f1) {
13578 if (item != null) {
13579 let tempItem
13580 tempItem = item
13581 this.f1.push(tempItem)
13582 } else {
13583 this.f1.push(undefined)
13584 }
13585 }
13586 } else {
13587 this.f1 = undefined
13588 }
13589 if (other.f2 != null) {
13590 this.f2 = []
13591 for (let item of other.f2) {
13592 if (item != null) {
13593 let tempItem
13594 tempItem = item
13595 this.f2.push(tempItem)
13596 } else {
13597 this.f2.push(undefined)
13598 }
13599 }
13600 } else {
13601 this.f2 = undefined
13602 }
13603 if (other.f3 != null) {
13604 this.f3 = []
13605 for (let item of other.f3) {
13606 if (item != null) {
13607 let tempItem
13608 if (typeof item === 'string') {
13609 // noinspection JSUnresolvedFunction
13610 tempItem = Uint8Array.from(Buffer.from(item, 'base64'))
13611 } else {
13612 tempItem = Uint8Array.from(item)
13613 }
13614 this.f3.push(tempItem)
13615 } else {
13616 this.f3.push(undefined)
13617 }
13618 }
13619 } else {
13620 this.f3 = undefined
13621 }
13622 if (other.f4 != null) {
13623 this.f4 = []
13624 for (let item of other.f4) {
13625 if (item != null) {
13626 let tempItem
13627 if (typeof item === 'string') {
13628 // noinspection JSUnresolvedFunction
13629 tempItem = Uint8Array.from(Buffer.from(item, 'base64'))
13630 } else {
13631 tempItem = Uint8Array.from(item)

Callers

nothing calls this directly

Calls 1

fromObjectMethod · 0.45

Tested by

no test coverage detected