|
98 | 98 | * If it is disabled, every key => value of the container object will be passed to the callback function.
|
99 | 99 | *
|
100 | 100 | * @property {boolean} [castArrayIndex=true] -
|
101 |
| - * |
| 101 | + * |
102 | 102 | * Determines whether "foreach" should cast the indices of the array-like container object
|
103 | 103 | * to integers (in {number}).
|
104 | 104 | *
|
|
169 | 169 | * @function processOptions
|
170 | 170 | * @memberOf js/partial/foreach
|
171 | 171 | *
|
172 |
| - * @param {config} [options] The object, which contains the config options. |
173 |
| - * @param {boolean} [setGlobal] Whether the passed config options should change |
174 |
| - * the global config options for "foreach". |
| 172 | + * @param {config} [options] The object, which contains the config options. |
| 173 | + * @param {boolean} [setGlobal=false] Whether the passed config options should change |
| 174 | + * the global config options for "foreach". |
175 | 175 | *
|
176 | 176 | * @returns {config} The valid, changeable config options with their actual, current value.
|
177 | 177 | */
|
|
226 | 226 | * @param {*} object The container object.
|
227 | 227 | * @param {function} callback The callback function to receive key or key=>value arguments.
|
228 | 228 | * @param {config} [options] The object, which contains the config options.
|
229 |
| -
|
| 229 | + * |
| 230 | + * @return {void} |
| 231 | + * |
230 | 232 | * @example
|
231 | 233 | * // for arrays
|
232 | 234 | * var array = [1, 2, 3, 4, 5];
|
|
297 | 299 | * console.log(char); // 'a' .. 'h'
|
298 | 300 | * }
|
299 | 301 | * );
|
300 |
| - * |
301 |
| - * @return {void} |
302 | 302 | */
|
303 | 303 | function foreach(object, callback, options) {
|
304 | 304 | var numArgs = TWO_ARGUMENTS,
|
|
366 | 366 | * @param {config} [options] The object, which contains the config options.
|
367 | 367 | *
|
368 | 368 | * @return {void}
|
| 369 | + * |
| 370 | + * @example |
| 371 | + * // after setOptions(...), the global config of "foreach" will be changed |
| 372 | + * foreach.setOptions({ |
| 373 | + * checkArguments : true, |
| 374 | + * checkOwnProperty : false, |
| 375 | + * castArrayIndex : false |
| 376 | + * }); |
369 | 377 | */
|
370 | 378 | foreach.setOptions = function(options) {
|
371 | 379 | processOptions(options, true);
|
372 | 380 | };
|
373 | 381 |
|
374 | 382 | /**
|
375 |
| - * Gets the global config options for "foreach" partial. |
| 383 | + * Returns the global config options for "foreach" partial. |
376 | 384 | *
|
377 | 385 | * @static
|
378 | 386 | * @function getOptions
|
379 | 387 | * @memberOf js/partial/foreach
|
380 | 388 | *
|
381 | 389 | * @returns {config} The valid, changeable config options with their actual, current value.
|
| 390 | + * |
| 391 | + * @example |
| 392 | + * var options = foreach.getOptions(); |
| 393 | + * // options now will contain: |
| 394 | + * // options.checkArguments |
| 395 | + * // options.checkOwnProperty |
| 396 | + * // options.castArrayIndex |
382 | 397 | */
|
383 | 398 | foreach.getOptions = function() {
|
384 | 399 | return processOptions();
|
|
0 commit comments