Projekt

Obecné

Profil

Stáhnout (851 Bajtů) Statistiky
| Větev: | Revize:
1
var lodash = require('./wrapperLodash');
2

    
3
/**
4
 * Creates a `lodash` wrapper instance that wraps `value` with explicit method
5
 * chain sequences enabled. The result of such sequences must be unwrapped
6
 * with `_#value`.
7
 *
8
 * @static
9
 * @memberOf _
10
 * @since 1.3.0
11
 * @category Seq
12
 * @param {*} value The value to wrap.
13
 * @returns {Object} Returns the new `lodash` wrapper instance.
14
 * @example
15
 *
16
 * var users = [
17
 *   { 'user': 'barney',  'age': 36 },
18
 *   { 'user': 'fred',    'age': 40 },
19
 *   { 'user': 'pebbles', 'age': 1 }
20
 * ];
21
 *
22
 * var youngest = _
23
 *   .chain(users)
24
 *   .sortBy('age')
25
 *   .map(function(o) {
26
 *     return o.user + ' is ' + o.age;
27
 *   })
28
 *   .head()
29
 *   .value();
30
 * // => 'pebbles is 1'
31
 */
32
function chain(value) {
33
  var result = lodash(value);
34
  result.__chain__ = true;
35
  return result;
36
}
37

    
38
module.exports = chain;
(275-275/590)