UNPKG

protobufjs-no-cli

Version:

Protocol Buffers for JavaScript. Finally.

526 lines (180 loc) • 9.01 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Map</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Map</h1> <section> <header> <h2> <span class="ancestors"><a href="ProtoBuf.html">ProtoBuf</a>.</span> Map </h2> </header> <article> <div class="container-overview"> <dt> <h4 class="name" id="Map"><span class="type-signature"></span>new Map<span class="signature">(field<span class="signature-attributes">non-null</span>, contents<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Constructs a new Map. A Map is a container that is used to implement map fields on message objects. It closely follows the ES6 Map API; however, it is distinct because we do not want to depend on external polyfills or on ES6 itself.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">ProtoBuf.Reflect.Field</span> </td> <td class="attributes"> </td> <td class="description last"><p>Map field</p></td> </tr> <tr> <td class="name"><code>contents</code></td> <td class="type"> <span class="param-type">Object.&lt;string, *></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Initial contents</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4911">line 4911</a> </li></ul></dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name" id="field"><span class="type-signature">(non-null) </span>field<span class="type-signature"> :ProtoBuf.Reflect.Field</span></h4> </dt> <dd> <div class="description"> <p>The field corresponding to this map.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">ProtoBuf.Reflect.Field</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4919">line 4919</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="keyElem"><span class="type-signature">(non-null) </span>keyElem<span class="type-signature"> :<a href="ProtoBuf.Reflect.Element.html">ProtoBuf.Reflect.Element</a></span></h4> </dt> <dd> <div class="description"> <p>Element instance corresponding to key type.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="ProtoBuf.Reflect.Element.html">ProtoBuf.Reflect.Element</a></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4925">line 4925</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="map"><span class="type-signature">(non-null) </span>map<span class="type-signature"> :Object.&lt;string, Object></span></h4> </dt> <dd> <div class="description"> <p>Internal map: stores mapping of (string form of key) -&gt; (key, value) pair.</p> <p>We provide map semantics for arbitrary key types, but we build on top of an Object, which has only string keys. In order to avoid the need to convert a string key back to its native type in many situations, we store the native key value alongside the value. Thus, we only need a one-way mapping from a key type to its string form that guarantees uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1 === K2).</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object.&lt;string, Object></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4947">line 4947</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="valueElem"><span class="type-signature">(non-null) </span>valueElem<span class="type-signature"> :<a href="ProtoBuf.Reflect.Element.html">ProtoBuf.Reflect.Element</a></span></h4> </dt> <dd> <div class="description"> <p>Element instance corresponding to value type.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="ProtoBuf.Reflect.Element.html">ProtoBuf.Reflect.Element</a></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4931">line 4931</a> </li></ul></dd> </dl> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ProtoBuf.Builder.html">Builder</a></li><li><a href="ProtoBuf.Builder.Message.html">Message</a></li><li><a href="ProtoBuf.Builder.Service.html">Service</a></li><li><a href="ProtoBuf.DotProto.Parser.html">Parser</a></li><li><a href="ProtoBuf.DotProto.Tokenizer.html">Tokenizer</a></li><li><a href="ProtoBuf.Map.html">Map</a></li><li><a href="ProtoBuf.Reflect.Element.html">Element</a></li><li><a href="ProtoBuf.Reflect.Enum.html">Enum</a></li><li><a href="ProtoBuf.Reflect.Enum.Value.html">Value</a></li><li><a href="ProtoBuf.Reflect.Extension.html">Extension</a></li><li><a href="ProtoBuf.Reflect.Message.html">Message</a></li><li><a href="ProtoBuf.Reflect.Message.ExtensionField.html">ExtensionField</a></li><li><a href="ProtoBuf.Reflect.Message.Field.html">Field</a></li><li><a href="ProtoBuf.Reflect.Message.OneOf.html">OneOf</a></li><li><a href="ProtoBuf.Reflect.Namespace.html">Namespace</a></li><li><a href="ProtoBuf.Reflect.Service.html">Service</a></li><li><a href="ProtoBuf.Reflect.Service.Method.html">Method</a></li><li><a href="ProtoBuf.Reflect.Service.RPCMethod.html">RPCMethod</a></li><li><a href="ProtoBuf.Reflect.T.html">T</a></li></ul><h3>Namespaces</h3><ul><li><a href="ProtoBuf.html">ProtoBuf</a></li><li><a href="ProtoBuf.DotProto.html">DotProto</a></li><li><a href="ProtoBuf.Reflect.html">Reflect</a></li><li><a href="ProtoBuf.Util.html">Util</a></li></ul> </nav> <br clear="both"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Thu May 26 2016 19:11:32 GMT+0200 (Mitteleuropäische Sommerzeit) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>