yellow-brick-road 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rst +10 -5
- data/lib/yellow-brick-road/directive_processor.rb +10 -3
- data/lib/yellow-brick-road/version.rb +1 -1
- data/test/dummy/app/assets/javascripts/closure-deps.js +3 -3
- data/test/dummy/log/development.log +159 -0
- data/test/dummy/tmp/cache/assets/C1E/0C0/sprockets%2F9c2f7430126aff8d8514326208712832 +165 -0
- data/test/dummy/tmp/cache/assets/C29/5D0/sprockets%2F1498f4451d0836a53c7c302c49920996 +0 -0
- data/test/dummy/tmp/cache/assets/C7E/9F0/sprockets%2F89862076204c62c4593ac20de32da909 +6 -6
- data/test/dummy/tmp/cache/assets/CB4/5B0/sprockets%2Ff17618b71eca9a4621f68626572a75b2 +103 -0
- data/test/dummy/tmp/cache/assets/CC2/240/sprockets%2F9f41da672330830c3366594f7ff5e7f6 +590 -0
- data/test/dummy/tmp/cache/assets/CC4/2C0/sprockets%2F715db78c7d974ea64406ed9711793f42 +494 -0
- data/test/dummy/tmp/cache/assets/CE1/610/sprockets%2F50c01109ecf86153176ccf577595fab4 +53 -0
- data/test/dummy/tmp/cache/assets/CE1/C20/sprockets%2F58a7b0499656c97a2204b5821eadab84 +207 -0
- data/test/dummy/tmp/cache/assets/CE4/DE0/sprockets%2Fb3aab0604ee02598f339965ec583a746 +204 -0
- data/test/dummy/tmp/cache/assets/CE9/B00/sprockets%2F80b139f66661444d6a781bfe56aee076 +0 -0
- data/test/dummy/tmp/cache/assets/CEB/840/sprockets%2F38fe57c2a5963f36a49404f672cc707b +0 -0
- data/test/dummy/tmp/cache/assets/CEC/6C0/sprockets%2F01b982295748dbd09683557aebd358bd +0 -0
- data/test/dummy/tmp/cache/assets/CF0/140/sprockets%2F3974b046fe949e86ef851a0271eb9d50 +1545 -0
- data/test/dummy/tmp/cache/assets/D01/DF0/sprockets%2F2ce268622b41a173bb209465a2ced6b9 +806 -0
- data/test/dummy/tmp/cache/assets/D05/920/sprockets%2F909507434dcc270db4853e4c147f0aac +4 -5
- data/test/dummy/tmp/cache/assets/D0A/C10/sprockets%2Fd050d5ee6a2073aa708a26c589a4c974 +283 -0
- data/test/dummy/tmp/cache/assets/D0F/360/sprockets%2Fa18927874a5e02c58c14c5b5df19ec04 +300 -0
- data/test/dummy/tmp/cache/assets/D15/700/sprockets%2F2987192f402d2bdc72792b5ae17f9a2f +142 -0
- data/test/dummy/tmp/cache/assets/D15/F60/sprockets%2Fa28394e3f80365b5bc86794dd46daa22 +0 -0
- data/test/dummy/tmp/cache/assets/D1F/E60/sprockets%2Fe65796b72231e36f5573ce71e2c8bbf8 +511 -0
- data/test/dummy/tmp/cache/assets/D22/200/sprockets%2F874bd1079c304ae88fbec8434d6d7794 +187 -0
- data/test/dummy/tmp/cache/assets/D3B/6A0/sprockets%2Ff8a978a3672b4f7ba513303b91ad15fc +127 -0
- data/test/dummy/tmp/cache/assets/D3C/530/sprockets%2Fe6730ff143273d9a7471b4afc3e1c19d +0 -0
- data/test/dummy/tmp/cache/assets/D41/B30/sprockets%2Fba1b93913dd01d83ac9a96df334456f8 +0 -0
- data/test/dummy/tmp/cache/assets/D49/570/sprockets%2Fd76be81d59871518ea06d3668f2c4bbb +239 -0
- data/test/dummy/tmp/cache/assets/D49/DA0/sprockets%2Fa84f85a305cde80a4d53785d7be0892f +457 -0
- data/test/dummy/tmp/cache/assets/D5C/760/sprockets%2F5cd491e0f9106cfd4ec4938896c97de7 +256 -0
- data/test/dummy/tmp/cache/assets/D5C/A00/sprockets%2Fefe291b3012745251e2641defbe4cad0 +1529 -0
- data/test/dummy/tmp/cache/assets/D68/2B0/sprockets%2Fe51ab0aca893e08c40f9672edef71106 +0 -0
- data/test/dummy/tmp/cache/assets/D6E/EA0/sprockets%2Fb52cbc47414c9e60ad4c46824928fbbe +115 -0
- data/test/dummy/tmp/cache/assets/D70/0B0/sprockets%2F1ae574bacfb86b4d51281b5e47fe1892 +505 -0
- data/test/dummy/tmp/cache/assets/D75/A60/sprockets%2Fab64285176f11f975fb6bb40af8bce76 +0 -0
- data/test/dummy/tmp/cache/assets/D76/0A0/sprockets%2F3ad3bd078c47096b34d5bcce886d7b47 +794 -0
- data/test/dummy/tmp/cache/assets/D79/C00/sprockets%2F94449fa386c370a1ebd7628eba9afe72 +72 -0
- data/test/dummy/tmp/cache/assets/D7B/310/sprockets%2Ff56e44be18b2d65efda80e588e5229a4 +0 -0
- data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +7 -8
- data/test/dummy/tmp/cache/assets/D95/D20/sprockets%2F05b19351f203fb1eadf8ef1f0e6f9a60 +173 -0
- data/test/dummy/tmp/cache/assets/D9F/250/sprockets%2F40dcbb8f852f0e6360c4afb1f39964eb +0 -0
- data/test/dummy/tmp/cache/assets/DA8/0E0/sprockets%2F1351359f5bbdb94ef7d247df9af38bd1 +2556 -0
- data/test/dummy/tmp/cache/assets/DB3/070/sprockets%2Fd98f91680433cec456e6eb7485dcfdbc +522 -0
- data/test/dummy/tmp/cache/assets/DC4/6E0/sprockets%2F72117f09fccb98e6aac4cd1124edae42 +2539 -0
- data/test/dummy/tmp/cache/assets/DCC/D50/sprockets%2F9b2b027991c15af6f8afeacdd183c14e +1260 -0
- data/test/dummy/tmp/cache/assets/DD9/FF0/sprockets%2Fdf5dcfe86e199b272742a52a4b7e5fbd +823 -0
- data/test/dummy/tmp/cache/assets/DE7/0D0/sprockets%2Fe4d9fe29b6d96cdeb070d9b595af83d7 +1354 -0
- data/test/dummy/tmp/cache/assets/E00/3A0/sprockets%2Fc1db8cbfbc94bd2736f9f067a4c06cc7 +811 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E0C/C80/sprockets%2F55805edb5f27aaef88eef6632fd08ade +1277 -0
- data/test/dummy/tmp/cache/assets/E1B/CF0/sprockets%2Feb58b29b94f29d7da8d9fbe666e4a8dd +474 -0
- data/test/dummy/tmp/cache/assets/E1E/E00/sprockets%2Fb005d4fa3dc6cfc1c5098e0fdb3f6b2b +1371 -0
- data/test/dummy/tmp/cache/assets/E30/8E0/sprockets%2Fef4fdb83b3eefb027cbc8e19b274ec80 +607 -0
- metadata +96 -8
@@ -0,0 +1,607 @@
|
|
1
|
+
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325729947.679007:@value{I"
|
2
|
+
class:EFI"BundledAsset;
|
3
|
+
FI"id;
|
4
|
+
F"%13790f4a95f5d5e06826aee18a6c3e3dI"logical_path;
|
5
|
+
FI""closure/goog/object/object.js;
|
6
|
+
TI"
|
7
|
+
F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/object/object.jsI"content_type;
|
8
|
+
FI"application/javascript;
|
9
|
+
FI"
|
10
|
+
mtime;
|
11
|
+
FI"2012-01-03T00:52:24+00:00;
|
12
|
+
FI" body;
|
13
|
+
FI"�A// Copyright 2006 The Closure Library Authors. All Rights Reserved.
|
14
|
+
//
|
15
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
+
// you may not use this file except in compliance with the License.
|
17
|
+
// You may obtain a copy of the License at
|
18
|
+
//
|
19
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
20
|
+
//
|
21
|
+
// Unless required by applicable law or agreed to in writing, software
|
22
|
+
// distributed under the License is distributed on an "AS-IS" BASIS,
|
23
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
+
// See the License for the specific language governing permissions and
|
25
|
+
// limitations under the License.
|
26
|
+
|
27
|
+
/**
|
28
|
+
* @fileoverview Utilities for manipulating objects/maps/hashes.
|
29
|
+
*/
|
30
|
+
|
31
|
+
|
32
|
+
goog.provide('goog.object');
|
33
|
+
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Calls a function for each element in an object/map/hash.
|
37
|
+
*
|
38
|
+
* @param {Object} obj The object over which to iterate.
|
39
|
+
* @param {Function} f The function to call for every element. This function
|
40
|
+
* takes 3 arguments (the element, the index and the object)
|
41
|
+
* and the return value is irrelevant.
|
42
|
+
* @param {Object=} opt_obj This is used as the 'this' object within f.
|
43
|
+
*/
|
44
|
+
goog.object.forEach = function(obj, f, opt_obj) {
|
45
|
+
for (var key in obj) {
|
46
|
+
f.call(opt_obj, obj[key], key, obj);
|
47
|
+
}
|
48
|
+
};
|
49
|
+
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Calls a function for each element in an object/map/hash. If that call returns
|
53
|
+
* true, adds the element to a new object.
|
54
|
+
*
|
55
|
+
* @param {Object} obj The object over which to iterate.
|
56
|
+
* @param {Function} f The function to call for every element. This
|
57
|
+
* function takes 3 arguments (the element, the index and the object)
|
58
|
+
* and should return a boolean. If the return value is true the
|
59
|
+
* element is added to the result object. If it is false the
|
60
|
+
* element is not included.
|
61
|
+
* @param {Object=} opt_obj This is used as the 'this' object within f.
|
62
|
+
* @return {!Object} a new object in which only elements that passed the test
|
63
|
+
* are present.
|
64
|
+
*/
|
65
|
+
goog.object.filter = function(obj, f, opt_obj) {
|
66
|
+
var res = {};
|
67
|
+
for (var key in obj) {
|
68
|
+
if (f.call(opt_obj, obj[key], key, obj)) {
|
69
|
+
res[key] = obj[key];
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return res;
|
73
|
+
};
|
74
|
+
|
75
|
+
|
76
|
+
/**
|
77
|
+
* For every element in an object/map/hash calls a function and inserts the
|
78
|
+
* result into a new object.
|
79
|
+
*
|
80
|
+
* @param {Object} obj The object over which to iterate.
|
81
|
+
* @param {Function} f The function to call for every element. This function
|
82
|
+
* takes 3 arguments (the element, the index and the object)
|
83
|
+
* and should return something. The result will be inserted
|
84
|
+
* into a new object.
|
85
|
+
* @param {Object=} opt_obj This is used as the 'this' object within f.
|
86
|
+
* @return {!Object} a new object with the results from f.
|
87
|
+
*/
|
88
|
+
goog.object.map = function(obj, f, opt_obj) {
|
89
|
+
var res = {};
|
90
|
+
for (var key in obj) {
|
91
|
+
res[key] = f.call(opt_obj, obj[key], key, obj);
|
92
|
+
}
|
93
|
+
return res;
|
94
|
+
};
|
95
|
+
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Calls a function for each element in an object/map/hash. If any
|
99
|
+
* call returns true, returns true (without checking the rest). If
|
100
|
+
* all calls return false, returns false.
|
101
|
+
*
|
102
|
+
* @param {Object} obj The object to check.
|
103
|
+
* @param {Function} f The function to call for every element. This function
|
104
|
+
* takes 3 arguments (the element, the index and the object) and should
|
105
|
+
* return a boolean.
|
106
|
+
* @param {Object=} opt_obj This is used as the 'this' object within f.
|
107
|
+
* @return {boolean} true if any element passes the test.
|
108
|
+
*/
|
109
|
+
goog.object.some = function(obj, f, opt_obj) {
|
110
|
+
for (var key in obj) {
|
111
|
+
if (f.call(opt_obj, obj[key], key, obj)) {
|
112
|
+
return true;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return false;
|
116
|
+
};
|
117
|
+
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Calls a function for each element in an object/map/hash. If
|
121
|
+
* all calls return true, returns true. If any call returns false, returns
|
122
|
+
* false at this point and does not continue to check the remaining elements.
|
123
|
+
*
|
124
|
+
* @param {Object} obj The object to check.
|
125
|
+
* @param {Function} f The function to call for every element. This function
|
126
|
+
* takes 3 arguments (the element, the index and the object) and should
|
127
|
+
* return a boolean.
|
128
|
+
* @param {Object=} opt_obj This is used as the 'this' object within f.
|
129
|
+
* @return {boolean} false if any element fails the test.
|
130
|
+
*/
|
131
|
+
goog.object.every = function(obj, f, opt_obj) {
|
132
|
+
for (var key in obj) {
|
133
|
+
if (!f.call(opt_obj, obj[key], key, obj)) {
|
134
|
+
return false;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
return true;
|
138
|
+
};
|
139
|
+
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Returns the number of key-value pairs in the object map.
|
143
|
+
*
|
144
|
+
* @param {Object} obj The object for which to get the number of key-value
|
145
|
+
* pairs.
|
146
|
+
* @return {number} The number of key-value pairs in the object map.
|
147
|
+
*/
|
148
|
+
goog.object.getCount = function(obj) {
|
149
|
+
// JS1.5 has __count__ but it has been deprecated so it raises a warning...
|
150
|
+
// in other words do not use. Also __count__ only includes the fields on the
|
151
|
+
// actual object and not in the prototype chain.
|
152
|
+
var rv = 0;
|
153
|
+
for (var key in obj) {
|
154
|
+
rv++;
|
155
|
+
}
|
156
|
+
return rv;
|
157
|
+
};
|
158
|
+
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Returns one key from the object map, if any exists.
|
162
|
+
* For map literals the returned key will be the first one in most of the
|
163
|
+
* browsers (a know exception is Konqueror).
|
164
|
+
*
|
165
|
+
* @param {Object} obj The object to pick a key from.
|
166
|
+
* @return {string|undefined} The key or undefined if the object is empty.
|
167
|
+
*/
|
168
|
+
goog.object.getAnyKey = function(obj) {
|
169
|
+
for (var key in obj) {
|
170
|
+
return key;
|
171
|
+
}
|
172
|
+
};
|
173
|
+
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Returns one value from the object map, if any exists.
|
177
|
+
* For map literals the returned value will be the first one in most of the
|
178
|
+
* browsers (a know exception is Konqueror).
|
179
|
+
*
|
180
|
+
* @param {Object} obj The object to pick a value from.
|
181
|
+
* @return {*} The value or undefined if the object is empty.
|
182
|
+
*/
|
183
|
+
goog.object.getAnyValue = function(obj) {
|
184
|
+
for (var key in obj) {
|
185
|
+
return obj[key];
|
186
|
+
}
|
187
|
+
};
|
188
|
+
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Whether the object/hash/map contains the given object as a value.
|
192
|
+
* An alias for goog.object.containsValue(obj, val).
|
193
|
+
*
|
194
|
+
* @param {Object} obj The object in which to look for val.
|
195
|
+
* @param {*} val The object for which to check.
|
196
|
+
* @return {boolean} true if val is present.
|
197
|
+
*/
|
198
|
+
goog.object.contains = function(obj, val) {
|
199
|
+
return goog.object.containsValue(obj, val);
|
200
|
+
};
|
201
|
+
|
202
|
+
|
203
|
+
/**
|
204
|
+
* Returns the values of the object/map/hash.
|
205
|
+
*
|
206
|
+
* @param {Object} obj The object from which to get the values.
|
207
|
+
* @return {!Array} The values in the object/map/hash.
|
208
|
+
*/
|
209
|
+
goog.object.getValues = function(obj) {
|
210
|
+
var res = [];
|
211
|
+
var i = 0;
|
212
|
+
for (var key in obj) {
|
213
|
+
res[i++] = obj[key];
|
214
|
+
}
|
215
|
+
return res;
|
216
|
+
};
|
217
|
+
|
218
|
+
|
219
|
+
/**
|
220
|
+
* Returns the keys of the object/map/hash.
|
221
|
+
*
|
222
|
+
* @param {Object} obj The object from which to get the keys.
|
223
|
+
* @return {!Array.<string>} Array of property keys.
|
224
|
+
*/
|
225
|
+
goog.object.getKeys = function(obj) {
|
226
|
+
var res = [];
|
227
|
+
var i = 0;
|
228
|
+
for (var key in obj) {
|
229
|
+
res[i++] = key;
|
230
|
+
}
|
231
|
+
return res;
|
232
|
+
};
|
233
|
+
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Get a value from an object multiple levels deep. This is useful for
|
237
|
+
* pulling values from deeply nested objects, such as JSON responses.
|
238
|
+
* Example usage: getValueByKeys(jsonObj, 'foo', 'entries', 3)
|
239
|
+
*
|
240
|
+
* @param {!Object} obj An object to get the value from. Can be array-like.
|
241
|
+
* @param {...(string|number|!Array.<number|string>)} var_args A number of keys
|
242
|
+
* (as strings, or nubmers, for array-like objects). Can also be
|
243
|
+
* specified as a single array of keys.
|
244
|
+
* @return {*} The resulting value. If, at any point, the value for a key
|
245
|
+
* is undefined, returns undefined.
|
246
|
+
*/
|
247
|
+
goog.object.getValueByKeys = function(obj, var_args) {
|
248
|
+
var isArrayLike = goog.isArrayLike(var_args);
|
249
|
+
var keys = isArrayLike ? var_args : arguments;
|
250
|
+
|
251
|
+
// Start with the 2nd parameter for the variable parameters syntax.
|
252
|
+
for (var i = isArrayLike ? 0 : 1; i < keys.length; i++) {
|
253
|
+
obj = obj[keys[i]];
|
254
|
+
if (!goog.isDef(obj)) {
|
255
|
+
break;
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
return obj;
|
260
|
+
};
|
261
|
+
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Whether the object/map/hash contains the given key.
|
265
|
+
*
|
266
|
+
* @param {Object} obj The object in which to look for key.
|
267
|
+
* @param {*} key The key for which to check.
|
268
|
+
* @return {boolean} true If the map contains the key.
|
269
|
+
*/
|
270
|
+
goog.object.containsKey = function(obj, key) {
|
271
|
+
return key in obj;
|
272
|
+
};
|
273
|
+
|
274
|
+
|
275
|
+
/**
|
276
|
+
* Whether the object/map/hash contains the given value. This is O(n).
|
277
|
+
*
|
278
|
+
* @param {Object} obj The object in which to look for val.
|
279
|
+
* @param {*} val The value for which to check.
|
280
|
+
* @return {boolean} true If the map contains the value.
|
281
|
+
*/
|
282
|
+
goog.object.containsValue = function(obj, val) {
|
283
|
+
for (var key in obj) {
|
284
|
+
if (obj[key] == val) {
|
285
|
+
return true;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
return false;
|
289
|
+
};
|
290
|
+
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Searches an object for an element that satisfies the given condition and
|
294
|
+
* returns its key.
|
295
|
+
* @param {Object} obj The object to search in.
|
296
|
+
* @param {function(*, string, Object): boolean} f The function to call for
|
297
|
+
* every element. Takes 3 arguments (the value, the key and the object) and
|
298
|
+
* should return a boolean.
|
299
|
+
* @param {Object=} opt_this An optional "this" context for the function.
|
300
|
+
* @return {string|undefined} The key of an element for which the function
|
301
|
+
* returns true or undefined if no such element is found.
|
302
|
+
*/
|
303
|
+
goog.object.findKey = function(obj, f, opt_this) {
|
304
|
+
for (var key in obj) {
|
305
|
+
if (f.call(opt_this, obj[key], key, obj)) {
|
306
|
+
return key;
|
307
|
+
}
|
308
|
+
}
|
309
|
+
return undefined;
|
310
|
+
};
|
311
|
+
|
312
|
+
|
313
|
+
/**
|
314
|
+
* Searches an object for an element that satisfies the given condition and
|
315
|
+
* returns its value.
|
316
|
+
* @param {Object} obj The object to search in.
|
317
|
+
* @param {function(*, string, Object): boolean} f The function to call for
|
318
|
+
* every element. Takes 3 arguments (the value, the key and the object) and
|
319
|
+
* should return a boolean.
|
320
|
+
* @param {Object=} opt_this An optional "this" context for the function.
|
321
|
+
* @return {*} The value of an element for which the function returns true or
|
322
|
+
* undefined if no such element is found.
|
323
|
+
*/
|
324
|
+
goog.object.findValue = function(obj, f, opt_this) {
|
325
|
+
var key = goog.object.findKey(obj, f, opt_this);
|
326
|
+
return key && obj[key];
|
327
|
+
};
|
328
|
+
|
329
|
+
|
330
|
+
/**
|
331
|
+
* Whether the object/map/hash is empty.
|
332
|
+
*
|
333
|
+
* @param {Object} obj The object to test.
|
334
|
+
* @return {boolean} true if obj is empty.
|
335
|
+
*/
|
336
|
+
goog.object.isEmpty = function(obj) {
|
337
|
+
for (var key in obj) {
|
338
|
+
return false;
|
339
|
+
}
|
340
|
+
return true;
|
341
|
+
};
|
342
|
+
|
343
|
+
|
344
|
+
/**
|
345
|
+
* Removes all key value pairs from the object/map/hash.
|
346
|
+
*
|
347
|
+
* @param {Object} obj The object to clear.
|
348
|
+
*/
|
349
|
+
goog.object.clear = function(obj) {
|
350
|
+
for (var i in obj) {
|
351
|
+
delete obj[i];
|
352
|
+
}
|
353
|
+
};
|
354
|
+
|
355
|
+
|
356
|
+
/**
|
357
|
+
* Removes a key-value pair based on the key.
|
358
|
+
*
|
359
|
+
* @param {Object} obj The object from which to remove the key.
|
360
|
+
* @param {*} key The key to remove.
|
361
|
+
* @return {boolean} Whether an element was removed.
|
362
|
+
*/
|
363
|
+
goog.object.remove = function(obj, key) {
|
364
|
+
var rv;
|
365
|
+
if ((rv = key in obj)) {
|
366
|
+
delete obj[key];
|
367
|
+
}
|
368
|
+
return rv;
|
369
|
+
};
|
370
|
+
|
371
|
+
|
372
|
+
/**
|
373
|
+
* Adds a key-value pair to the object. Throws an exception if the key is
|
374
|
+
* already in use. Use set if you want to change an existing pair.
|
375
|
+
*
|
376
|
+
* @param {Object} obj The object to which to add the key-value pair.
|
377
|
+
* @param {string} key The key to add.
|
378
|
+
* @param {*} val The value to add.
|
379
|
+
*/
|
380
|
+
goog.object.add = function(obj, key, val) {
|
381
|
+
if (key in obj) {
|
382
|
+
throw Error('The object already contains the key "' + key + '"');
|
383
|
+
}
|
384
|
+
goog.object.set(obj, key, val);
|
385
|
+
};
|
386
|
+
|
387
|
+
|
388
|
+
/**
|
389
|
+
* Returns the value for the given key.
|
390
|
+
*
|
391
|
+
* @param {Object} obj The object from which to get the value.
|
392
|
+
* @param {string} key The key for which to get the value.
|
393
|
+
* @param {*=} opt_val The value to return if no item is found for the given
|
394
|
+
* key (default is undefined).
|
395
|
+
* @return {*} The value for the given key.
|
396
|
+
*/
|
397
|
+
goog.object.get = function(obj, key, opt_val) {
|
398
|
+
if (key in obj) {
|
399
|
+
return obj[key];
|
400
|
+
}
|
401
|
+
return opt_val;
|
402
|
+
};
|
403
|
+
|
404
|
+
|
405
|
+
/**
|
406
|
+
* Adds a key-value pair to the object/map/hash.
|
407
|
+
*
|
408
|
+
* @param {Object} obj The object to which to add the key-value pair.
|
409
|
+
* @param {string} key The key to add.
|
410
|
+
* @param {*} value The value to add.
|
411
|
+
*/
|
412
|
+
goog.object.set = function(obj, key, value) {
|
413
|
+
obj[key] = value;
|
414
|
+
};
|
415
|
+
|
416
|
+
|
417
|
+
/**
|
418
|
+
* Adds a key-value pair to the object/map/hash if it doesn't exist yet.
|
419
|
+
*
|
420
|
+
* @param {Object} obj The object to which to add the key-value pair.
|
421
|
+
* @param {string} key The key to add.
|
422
|
+
* @param {*} value The value to add if the key wasn't present.
|
423
|
+
* @return {*} The value of the entry at the end of the function.
|
424
|
+
*/
|
425
|
+
goog.object.setIfUndefined = function(obj, key, value) {
|
426
|
+
return key in obj ? obj[key] : (obj[key] = value);
|
427
|
+
};
|
428
|
+
|
429
|
+
|
430
|
+
/**
|
431
|
+
* Does a flat clone of the object.
|
432
|
+
*
|
433
|
+
* @param {Object} obj Object to clone.
|
434
|
+
* @return {!Object} Clone of the input object.
|
435
|
+
*/
|
436
|
+
goog.object.clone = function(obj) {
|
437
|
+
// We cannot use the prototype trick because a lot of methods depend on where
|
438
|
+
// the actual key is set.
|
439
|
+
|
440
|
+
var res = {};
|
441
|
+
for (var key in obj) {
|
442
|
+
res[key] = obj[key];
|
443
|
+
}
|
444
|
+
return res;
|
445
|
+
// We could also use goog.mixin but I wanted this to be independent from that.
|
446
|
+
};
|
447
|
+
|
448
|
+
|
449
|
+
/**
|
450
|
+
* Clones a value. The input may be an Object, Array, or basic type. Objects and
|
451
|
+
* arrays will be cloned recursively.
|
452
|
+
*
|
453
|
+
* WARNINGS:
|
454
|
+
* <code>goog.object.unsafeClone</code> does not detect reference loops. Objects
|
455
|
+
* that refer to themselves will cause infinite recursion.
|
456
|
+
*
|
457
|
+
* <code>goog.object.unsafeClone</code> is unaware of unique identifiers, and
|
458
|
+
* copies UIDs created by <code>getUid</code> into cloned results.
|
459
|
+
*
|
460
|
+
* @param {*} obj The value to clone.
|
461
|
+
* @return {*} A clone of the input value.
|
462
|
+
*/
|
463
|
+
goog.object.unsafeClone = function(obj) {
|
464
|
+
var type = goog.typeOf(obj);
|
465
|
+
if (type == 'object' || type == 'array') {
|
466
|
+
if (obj.clone) {
|
467
|
+
return obj.clone();
|
468
|
+
}
|
469
|
+
var clone = type == 'array' ? [] : {};
|
470
|
+
for (var key in obj) {
|
471
|
+
clone[key] = goog.object.unsafeClone(obj[key]);
|
472
|
+
}
|
473
|
+
return clone;
|
474
|
+
}
|
475
|
+
|
476
|
+
return obj;
|
477
|
+
};
|
478
|
+
|
479
|
+
|
480
|
+
/**
|
481
|
+
* Returns a new object in which all the keys and values are interchanged
|
482
|
+
* (keys become values and values become keys). If multiple keys map to the
|
483
|
+
* same value, the chosen transposed value is implementation-dependent.
|
484
|
+
*
|
485
|
+
* @param {Object} obj The object to transpose.
|
486
|
+
* @return {!Object} The transposed object.
|
487
|
+
*/
|
488
|
+
goog.object.transpose = function(obj) {
|
489
|
+
var transposed = {};
|
490
|
+
for (var key in obj) {
|
491
|
+
transposed[obj[key]] = key;
|
492
|
+
}
|
493
|
+
return transposed;
|
494
|
+
};
|
495
|
+
|
496
|
+
|
497
|
+
/**
|
498
|
+
* The names of the fields that are defined on Object.prototype.
|
499
|
+
* @type {Array.<string>}
|
500
|
+
* @private
|
501
|
+
*/
|
502
|
+
goog.object.PROTOTYPE_FIELDS_ = [
|
503
|
+
'constructor',
|
504
|
+
'hasOwnProperty',
|
505
|
+
'isPrototypeOf',
|
506
|
+
'propertyIsEnumerable',
|
507
|
+
'toLocaleString',
|
508
|
+
'toString',
|
509
|
+
'valueOf'
|
510
|
+
];
|
511
|
+
|
512
|
+
|
513
|
+
/**
|
514
|
+
* Extends an object with another object.
|
515
|
+
* This operates 'in-place'; it does not create a new Object.
|
516
|
+
*
|
517
|
+
* Example:
|
518
|
+
* var o = {};
|
519
|
+
* goog.object.extend(o, {a: 0, b: 1});
|
520
|
+
* o; // {a: 0, b: 1}
|
521
|
+
* goog.object.extend(o, {c: 2});
|
522
|
+
* o; // {a: 0, b: 1, c: 2}
|
523
|
+
*
|
524
|
+
* @param {Object} target The object to modify.
|
525
|
+
* @param {...Object} var_args The objects from which values will be copied.
|
526
|
+
*/
|
527
|
+
goog.object.extend = function(target, var_args) {
|
528
|
+
var key, source;
|
529
|
+
for (var i = 1; i < arguments.length; i++) {
|
530
|
+
source = arguments[i];
|
531
|
+
for (key in source) {
|
532
|
+
target[key] = source[key];
|
533
|
+
}
|
534
|
+
|
535
|
+
// For IE the for-in-loop does not contain any properties that are not
|
536
|
+
// enumerable on the prototype object (for example isPrototypeOf from
|
537
|
+
// Object.prototype) and it will also not include 'replace' on objects that
|
538
|
+
// extend String and change 'replace' (not that it is common for anyone to
|
539
|
+
// extend anything except Object).
|
540
|
+
|
541
|
+
for (var j = 0; j < goog.object.PROTOTYPE_FIELDS_.length; j++) {
|
542
|
+
key = goog.object.PROTOTYPE_FIELDS_[j];
|
543
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
544
|
+
target[key] = source[key];
|
545
|
+
}
|
546
|
+
}
|
547
|
+
}
|
548
|
+
};
|
549
|
+
|
550
|
+
|
551
|
+
/**
|
552
|
+
* Creates a new object built from the key-value pairs provided as arguments.
|
553
|
+
* @param {...*} var_args If only one argument is provided and it is an array
|
554
|
+
* then this is used as the arguments, otherwise even arguments are used as
|
555
|
+
* the property names and odd arguments are used as the property values.
|
556
|
+
* @return {!Object} The new object.
|
557
|
+
* @throws {Error} If there are uneven number of arguments or there is only one
|
558
|
+
* non array argument.
|
559
|
+
*/
|
560
|
+
goog.object.create = function(var_args) {
|
561
|
+
var argLength = arguments.length;
|
562
|
+
if (argLength == 1 && goog.isArray(arguments[0])) {
|
563
|
+
return goog.object.create.apply(null, arguments[0]);
|
564
|
+
}
|
565
|
+
|
566
|
+
if (argLength % 2) {
|
567
|
+
throw Error('Uneven number of arguments');
|
568
|
+
}
|
569
|
+
|
570
|
+
var rv = {};
|
571
|
+
for (var i = 0; i < argLength; i += 2) {
|
572
|
+
rv[arguments[i]] = arguments[i + 1];
|
573
|
+
}
|
574
|
+
return rv;
|
575
|
+
};
|
576
|
+
|
577
|
+
|
578
|
+
/**
|
579
|
+
* Creates a new object where the property names come from the arguments but
|
580
|
+
* the value is always set to true
|
581
|
+
* @param {...*} var_args If only one argument is provided and it is an array
|
582
|
+
* then this is used as the arguments, otherwise the arguments are used
|
583
|
+
* as the property names.
|
584
|
+
* @return {!Object} The new object.
|
585
|
+
*/
|
586
|
+
goog.object.createSet = function(var_args) {
|
587
|
+
var argLength = arguments.length;
|
588
|
+
if (argLength == 1 && goog.isArray(arguments[0])) {
|
589
|
+
return goog.object.createSet.apply(null, arguments[0]);
|
590
|
+
}
|
591
|
+
|
592
|
+
var rv = {};
|
593
|
+
for (var i = 0; i < argLength; i++) {
|
594
|
+
rv[arguments[i]] = true;
|
595
|
+
}
|
596
|
+
return rv;
|
597
|
+
};
|
598
|
+
;
|
599
|
+
FI"asset_paths;
|
600
|
+
F["�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/object/object.jsI"dependency_paths;
|
601
|
+
F[{I" path;
|
602
|
+
F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/object/object.jsI"
|
603
|
+
mtime;
|
604
|
+
FIu: Time
|
605
|
+
T:offsetiI"hexdigest;
|
606
|
+
F"%4087c42e0c92911b0a435909f540d43eI"
|
607
|
+
F"%46dde6621c301f4928e3b34efee9e3b5
|