Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Internal jBinary Methods

Ingvar Stepanyan edited this page · 4 revisions
  • getType(type): Returns preconfigured jBinary.Type instance from given descriptor.

    // Example:
    var jbType = binary.getType(['string', 30]);
  • getContext(filter): Get object context specified by filter. Possible filter types:

    • not set - current context will be returned.
    • number - filter will be used as relative depth (0 is current context, 1 for parent and so on).
    • string - will look for closest context that contains property name equal to filter.
    • function - will be used as boolean function (true to stop) while bubbling up through contexts.
    // Example:
    var currentContext = binary.getContext(); // current object that value belongs to
    var parentContext = binary.getContext(1); // one level up
    var contextWithID = binary.getContext('id'); // first context with "id" property (bubbling up)
    var contextWithID1 = binary.getContext(function (context) { return context.id === 1 }); // first context that matches custom condition
  • inContext(newContext, callback): Steps into given context and executes function inside it.

Something went wrong with that request. Please try again.