Class: Struct

Struct

C-Like Data Structure for JavaScript.

global new Struct(struct, value, endianness)

Name Type Description
struct object
value *
endianness boolean
Version:
  • 0.9.1
Author:
License:
  • MIT
See:

Members

byteLength number

constructor object

defaultValue *

emptyBuffer arrayBuffer

endianness boolean

offset number

struct object

inner typedefs number

Properties:
Name Type Default Description
int8 number 1
uint8 number 1
int16 number 2
uint16 number 2
int32 number 4
uint32 number 4
float32 number 4
int64 number 8
uint64 number 8
float64 number 8

Methods

read(buffer, offset){object}

Name Type Description
buffer arrayBuffer
offset number
Throws:
Will throw an error if uncaught index size
Returns:
Type Description
object parsed data

update(struct){object}

Name Type Description
struct object

object

Returns:
Type Description
object updated struct

write(struct){arrayBuffer}

Name Type Description
struct object

object

Returns:
Type Description
arrayBuffer wrated buffer

inner arrayBufferToArray(buffer, typed){array.<number>}

Name Type Description
buffer arrayBuffer
typed string
Returns:
Type Description
array.<number> typed

inner capitalize(name){boolean}

Name Type Description
name string
Returns:
Type Description
boolean corrected

inner charCodeArrToStr(arr){string}

Name Type Description
arr array.<number>
Returns:
Type Description
string char

inner clone(source){object}

Name Type Description
source object
Returns:
Type Description
object cloned struct

inner getByteLength(struct){number}

Name Type Description
struct object
Returns:
Type Description
number byte length

inner isArray(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isArrayBuffer(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isError(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isFunction(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isNull(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isObject(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isString(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isStruct(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner isUndefined(object){boolean}

Name Type Description
object *
Returns:
Type Description
boolean corrected

inner normalize(model, value){void}

Name Type Description
model object
value *
Returns:
Type Description
void nothing

inner strToCharCodeArr(char){array.<number>}

Name Type Description
char string
Returns:
Type Description
array.<number> char codes

inner update(source, target){object}

Name Type Description
source object
target object
Returns:
Type Description
object mixed
comments powered by Disqus