You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
36 KiB
77 lines
36 KiB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.object</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace goog.object</h1><a class="source" href="source/lib/goog/object/object.js.src.html#l19">code »</a></header><section></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l383">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.add">goog.object.add</a> <span class="args">( obj, key, val )</span></span></div><p>Adds a key-value pair to the object. Throws an exception if the key is
|
|
already in use. Use set if you want to change an existing pair.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to which to add the key-value pair.<dt>key: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The key to add.<dt>val: <code class="type">V</code><dd>The value to add.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l351">code »</a><span class="member"><a name="goog.object.clear">goog.object.clear</a> <span class="args">( obj )</span></span></div><p>Removes all key value pairs from the object/map/hash.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to clear.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l443">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.clone">goog.object.clone</a> <span class="args">( obj )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code></span></div><p>Does a flat clone of the object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>Object to clone.</dl><tr><th>Returns<tr><td><dl>Clone of the input object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l196">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.contains">goog.object.contains</a> <span class="args">( obj, val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Whether the object/hash/map contains the given object as a value.
|
|
An alias for goog.object.containsValue(obj, val).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object in which to look for val.<dt>val: <code class="type">V</code><dd>The object for which to check.</dl><tr><th>Returns<tr><td><dl>true if val is present.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l269">code »</a><span class="member"><a name="goog.object.containsKey">goog.object.containsKey</a> <span class="args">( obj, key )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Whether the object/map/hash contains the given key.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object in which to look for key.<dt>key: <code class="type">*</code><dd>The key for which to check.</dl><tr><th>Returns<tr><td><dl>true If the map contains the key.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l282">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.containsValue">goog.object.containsValue</a> <span class="args">( obj, val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Whether the object/map/hash contains the given value. This is O(n).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object in which to look for val.<dt>val: <code class="type">V</code><dd>The value for which to check.</dl><tr><th>Returns<tr><td><dl>true If the map contains the value.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l569">code »</a><span class="member"><a name="goog.object.create">goog.object.create</a> <span class="args">( var_args )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Creates a new object built from the key-value pairs provided as arguments.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...*</code><dd>If only one argument is provided and it is an array
|
|
then this is used as the arguments, otherwise even arguments are used as
|
|
the property names and odd arguments are used as the property values.</dl><tr><th>Returns<tr><td><dl>The new object.</dl><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>If there are uneven number of arguments or there is only one
|
|
non array argument.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l621">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.createImmutableView">goog.object.createImmutableView</a> <span class="args">( obj )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code></span></div><p>Creates an immutable view of the underlying object, if the browser
|
|
supports immutable objects.
|
|
|
|
In default mode, writes to this view will fail silently. In strict mode,
|
|
they will throw an error.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>An object.</dl><tr><th>Returns<tr><td><dl>An immutable view of that object, or the
|
|
original object if this browser does not support immutables.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l595">code »</a><span class="member"><a name="goog.object.createSet">goog.object.createSet</a> <span class="args">( var_args )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Creates a new object where the property names come from the arguments but
|
|
the value is always set to true</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...*</code><dd>If only one argument is provided and it is an array
|
|
then this is used as the arguments, otherwise the arguments are used
|
|
as the property names.</dl><tr><th>Returns<tr><td><dl>The new object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l127">code »</a><code class="type"><T, K, V></code> <span class="member"><a name="goog.object.every">goog.object.every</a> <span class="args">( obj, f, opt_obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Calls a function for each element in an object/map/hash. If
|
|
all calls return true, returns true. If any call returns false, returns
|
|
false at this point and does not continue to check the remaining elements.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to check.<dt>f: <code class="type">?function(this: T, V, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to
|
|
call for every element. This function
|
|
takes 3 arguments (the element, the index and the object) and should
|
|
return a boolean.<dt>opt_obj: <code class="type">T=</code><dd>This is used as the 'this' object within f.</dl><tr><th>Returns<tr><td><dl>false if any element fails the test.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l536">code »</a><span class="member"><a name="goog.object.extend">goog.object.extend</a> <span class="args">( target, var_args )</span></span></div><p>Extends an object with another object.
|
|
This operates 'in-place'; it does not create a new Object.
|
|
|
|
Example:
|
|
var o = {};
|
|
goog.object.extend(o, {a: 0, b: 1});
|
|
o; // {a: 0, b: 1}
|
|
goog.object.extend(o, {b: 2, c: 3});
|
|
o; // {a: 0, b: 2, c: 3}</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>target: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to modify. Existing properties will be
|
|
overwritten if they are also present in one of the objects in
|
|
<code >var_args</code>.<dt>var_args: <code class="type">...<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The objects from which values will be copied.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l55">code »</a><code class="type"><T, K, V></code> <span class="member"><a name="goog.object.filter">goog.object.filter</a> <span class="args">( obj, f, opt_obj )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code></span></div><p>Calls a function for each element in an object/map/hash. If that call returns
|
|
true, adds the element to a new object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object over which to iterate.<dt>f: <code class="type">function(this: T, V, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to call
|
|
for every element. This
|
|
function takes 3 arguments (the element, the index and the object)
|
|
and should return a boolean. If the return value is true the
|
|
element is added to the result object. If it is false the
|
|
element is not included.<dt>opt_obj: <code class="type">T=</code><dd>This is used as the 'this' object within f.</dl><tr><th>Returns<tr><td><dl>a new object in which only elements that passed the
|
|
test are present.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l304">code »</a><code class="type"><T, K, V></code> <span class="member"><a name="goog.object.findKey">goog.object.findKey</a> <span class="args">( obj, f, opt_this )</span> ⇒ <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>Searches an object for an element that satisfies the given condition and
|
|
returns its key.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to search in.<dt>f: <code class="type">function(this: T, V, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The
|
|
function to call for every element. Takes 3 arguments (the value,
|
|
the key and the object) and should return a boolean.<dt>opt_this: <code class="type">T=</code><dd>An optional "this" context for the function.</dl><tr><th>Returns<tr><td><dl>The key of an element for which the function
|
|
returns true or undefined if no such element is found.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l326">code »</a><code class="type"><T, K, V></code> <span class="member"><a name="goog.object.findValue">goog.object.findValue</a> <span class="args">( obj, f, opt_this )</span> ⇒ <code class="type">V</code></span></div><p>Searches an object for an element that satisfies the given condition and
|
|
returns its value.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to search in.<dt>f: <code class="type">function(this: T, V, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function
|
|
to call for every element. Takes 3 arguments (the value, the key
|
|
and the object) and should return a boolean.<dt>opt_this: <code class="type">T=</code><dd>An optional "this" context for the function.</dl><tr><th>Returns<tr><td><dl>The value of an element for which the function returns true or
|
|
undefined if no such element is found.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l32">code »</a><code class="type"><T, K, V></code> <span class="member"><a name="goog.object.forEach">goog.object.forEach</a> <span class="args">( obj, f, opt_obj )</span></span></div><p>Calls a function for each element in an object/map/hash.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object over which to iterate.<dt>f: <code class="type">function(this: T, V, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V>): ?</code><dd>The function to call
|
|
for every element. This function takes 3 arguments (the element, the
|
|
index and the object) and the return value is ignored.<dt>opt_obj: <code class="type">T=</code><dd>This is used as the 'this' object within f.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l401">code »</a><code class="type"><K, V, R></code> <span class="member"><a name="goog.object.get">goog.object.get</a> <span class="args">( obj, key, opt_val )</span> ⇒ <code class="type">(V|R|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>Returns the value for the given key.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object from which to get the value.<dt>key: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The key for which to get the value.<dt>opt_val: <code class="type">R=</code><dd>The value to return if no item is found for the given
|
|
key (default is undefined).</dl><tr><th>Returns<tr><td><dl>The value for the given key.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l164">code »</a><span class="member"><a name="goog.object.getAnyKey">goog.object.getAnyKey</a> <span class="args">( obj )</span> ⇒ <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>Returns one key from the object map, if any exists.
|
|
For map literals the returned key will be the first one in most of the
|
|
browsers (a know exception is Konqueror).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to pick a key from.</dl><tr><th>Returns<tr><td><dl>The key or undefined if the object is empty.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l180">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.getAnyValue">goog.object.getAnyValue</a> <span class="args">( obj )</span> ⇒ <code class="type">(V|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>Returns one value from the object map, if any exists.
|
|
For map literals the returned value will be the first one in most of the
|
|
browsers (a know exception is Konqueror).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to pick a value from.</dl><tr><th>Returns<tr><td><dl>The value or undefined if the object is empty.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l144">code »</a><span class="member"><a name="goog.object.getCount">goog.object.getCount</a> <span class="args">( obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the number of key-value pairs in the object map.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object for which to get the number of key-value
|
|
pairs.</dl><tr><th>Returns<tr><td><dl>The number of key-value pairs in the object map.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l224">code »</a><span class="member"><a name="goog.object.getKeys">goog.object.getKeys</a> <span class="args">( obj )</span> ⇒ <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div><p>Returns the keys of the object/map/hash.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object from which to get the keys.</dl><tr><th>Returns<tr><td><dl>Array of property keys.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l246">code »</a><span class="member"><a name="goog.object.getValueByKeys">goog.object.getValueByKeys</a> <span class="args">( obj, var_args )</span> ⇒ <code class="type">*</code></span></div><p>Get a value from an object multiple levels deep. This is useful for
|
|
pulling values from deeply nested objects, such as JSON responses.
|
|
Example usage: getValueByKeys(jsonObj, 'foo', 'entries', 3)</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>An object to get the value from. Can be array-like.<dt>var_args: <code class="type">...(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>)</code><dd>A number of keys
|
|
(as strings, or numbers, for array-like objects). Can also be
|
|
specified as a single array of keys.</dl><tr><th>Returns<tr><td><dl>The resulting value. If, at any point, the value for a key
|
|
is undefined, returns undefined.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l208">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.getValues">goog.object.getValues</a> <span class="args">( obj )</span> ⇒ <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<V></code></span></div><p>Returns the values of the object/map/hash.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object from which to get the values.</dl><tr><th>Returns<tr><td><dl>The values in the object/map/hash.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l338">code »</a><span class="member"><a name="goog.object.isEmpty">goog.object.isEmpty</a> <span class="args">( obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Whether the object/map/hash is empty.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to test.</dl><tr><th>Returns<tr><td><dl>true if obj is empty.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l635">code »</a><span class="member"><a name="goog.object.isImmutableView">goog.object.isImmutableView</a> <span class="args">( obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>An object.</dl><tr><th>Returns<tr><td><dl>Whether this is an immutable view of the object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l80">code »</a><code class="type"><T, K, V, R></code> <span class="member"><a name="goog.object.map">goog.object.map</a> <span class="args">( obj, f, opt_obj )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, R></code></span></div><p>For every element in an object/map/hash calls a function and inserts the
|
|
result into a new object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object over which to iterate.<dt>f: <code class="type">function(this: T, V, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V>): R</code><dd>The function to call
|
|
for every element. This function
|
|
takes 3 arguments (the element, the index and the object)
|
|
and should return something. The result will be inserted
|
|
into a new object.<dt>opt_obj: <code class="type">T=</code><dd>This is used as the 'this' object within f.</dl><tr><th>Returns<tr><td><dl>a new object with the results from f.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l365">code »</a><span class="member"><a name="goog.object.remove">goog.object.remove</a> <span class="args">( obj, key )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Removes a key-value pair based on the key.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object from which to remove the key.<dt>key: <code class="type">*</code><dd>The key to remove.</dl><tr><th>Returns<tr><td><dl>Whether an element was removed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l417">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.set">goog.object.set</a> <span class="args">( obj, key, value )</span></span></div><p>Adds a key-value pair to the object/map/hash.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to which to add the key-value pair.<dt>key: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The key to add.<dt>value: <code class="type">V</code><dd>The value to add.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l431">code »</a><code class="type"><K, V></code> <span class="member"><a name="goog.object.setIfUndefined">goog.object.setIfUndefined</a> <span class="args">( obj, key, value )</span> ⇒ <code class="type">V</code></span></div><p>Adds a key-value pair to the object/map/hash if it doesn't exist yet.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to which to add the key-value pair.<dt>key: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The key to add.<dt>value: <code class="type">V</code><dd>The value to add if the key wasn't present.</dl><tr><th>Returns<tr><td><dl>The value of the entry at the end of the function.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l103">code »</a><code class="type"><T, K, V></code> <span class="member"><a name="goog.object.some">goog.object.some</a> <span class="args">( obj, f, opt_obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Calls a function for each element in an object/map/hash. If any
|
|
call returns true, returns true (without checking the rest). If
|
|
all calls return false, returns false.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V></code><dd>The object to check.<dt>f: <code class="type">function(this: T, V, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<K, V>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to
|
|
call for every element. This function
|
|
takes 3 arguments (the element, the index and the object) and should
|
|
return a boolean.<dt>opt_obj: <code class="type">T=</code><dd>This is used as the 'this' object within f.</dl><tr><th>Returns<tr><td><dl>true if any element passes the test.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l495">code »</a><span class="member"><a name="goog.object.transpose">goog.object.transpose</a> <span class="args">( obj )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Returns a new object in which all the keys and values are interchanged
|
|
(keys become values and values become keys). If multiple keys map to the
|
|
same value, the chosen transposed value is implementation-dependent.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to transpose.</dl><tr><th>Returns<tr><td><dl>The transposed object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l470">code »</a><span class="member"><a name="goog.object.unsafeClone">goog.object.unsafeClone</a> <span class="args">( obj )</span> ⇒ <code class="type">*</code></span></div><p>Clones a value. The input may be an Object, Array, or basic type. Objects and
|
|
arrays will be cloned recursively.
|
|
|
|
WARNINGS:
|
|
<code>goog.object.unsafeClone</code> does not detect reference loops. Objects
|
|
that refer to themselves will cause infinite recursion.
|
|
|
|
<code>goog.object.unsafeClone</code> is unaware of unique identifiers, and
|
|
copies UIDs created by <code>getUid</code> into cloned results.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">*</code><dd>The value to clone.</dl><tr><th>Returns<tr><td><dl>A clone of the input value.</dl></table></div></details></div></div></section><section id="static-properties"><h2>Global Properties</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/object/object.js.src.html#l509">code »</a><span class="member"><a name="goog.object.PROTOTYPE_FIELDS_">goog.object.PROTOTYPE_FIELDS_</a> : <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div><p>The names of the fields that are defined on Object.prototype.</summary></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>No data</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>No data</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>No data</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script> |