| /** |
| * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/> |
| * Build: `lodash modularize modern exports="node" -o ./modern/` |
| * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> |
| * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE> |
| * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors |
| * Available under MIT license <http://lodash.com/license> |
| */ |
| var lodashWrapper = require('../internals/lodashWrapper'); |
| |
| /** |
| * Creates a `lodash` object that wraps the given value with explicit |
| * method chaining enabled. |
| * |
| * @static |
| * @memberOf _ |
| * @category Chaining |
| * @param {*} value The value to wrap. |
| * @returns {Object} Returns the wrapper object. |
| * @example |
| * |
| * var characters = [ |
| * { 'name': 'barney', 'age': 36 }, |
| * { 'name': 'fred', 'age': 40 }, |
| * { 'name': 'pebbles', 'age': 1 } |
| * ]; |
| * |
| * var youngest = _.chain(characters) |
| * .sortBy('age') |
| * .map(function(chr) { return chr.name + ' is ' + chr.age; }) |
| * .first() |
| * .value(); |
| * // => 'pebbles is 1' |
| */ |
| function chain(value) { |
| value = new lodashWrapper(value); |
| value.__chain__ = true; |
| return value; |
| } |
| |
| module.exports = chain; |