Ohm-Management - Projektarbeit B-ME
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.

chain.js 851B

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