lib/struct.js
function set (buffer, offset, value) {
  debug('Struct "type" setter for buffer at offset', buffer, offset, value)
  var isStruct = value instanceof this
  if (isStruct) {
    // optimization: copy the buffer contents directly rather
    // than going through the ref-struct constructor
    value['ref.buffer'].copy(buffer, offset, 0, this.size)
  } else {
    if (offset > 0) {
      buffer = buffer.slice(offset)
    }
    new this(buffer, value)
  }
}
function set (buffer, offset, value) {
  debug('Struct "type" setter for buffer at offset', buffer, offset, value)
  var isStruct = value instanceof this
  if (isStruct) {
    // optimization: copy the buffer contents directly rather
    // than going through the ref-struct constructor
    value['ref.buffer'].copy(buffer, offset, 0, this.size)
  } else {
    if (offset > 0) {
      buffer = buffer.slice(offset)
    }
    new this(buffer, value)
  }
}
function set ( buffer , offset , value ) { debug ( 'Struct "type" setter for buffer at offset' , buffer , offset , value ) var isStruct = value instanceof this if ( isStruct ) { // optimization: copy the buffer contents directly rather // than going through the ref-struct constructor value [ 'ref.buffer' ] . copy ( buffer , offset , 0 , this . size ) } else { if ( offset > 0 ) { buffer = buffer . slice ( offset ) } new this ( buffer , value ) } }
The "set" function of the Struct "type" interface
The set function of the Struct type interface