1 var LazyWrapper = require('./_LazyWrapper'),
2 LodashWrapper = require('./_LodashWrapper'),
3 baseAt = require('./_baseAt'),
4 flatRest = require('./_flatRest'),
5 isIndex = require('./_isIndex'),
6 thru = require('./thru');
9 * This method is the wrapper version of `_.at`.
15 * @param {...(string|string[])} [paths] The property paths of elements to pick.
16 * @returns {Object} Returns the new `lodash` wrapper instance.
19 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
21 * _(object).at(['a[0].b.c', 'a[1]']).value();
24 var wrapperAt = flatRest(function(paths) {
25 var length = paths.length,
26 start = length ? paths[0] : 0,
27 value = this.__wrapped__,
28 interceptor = function(object) { return baseAt(object, paths); };
30 if (length > 1 || this.__actions__.length ||
31 !(value instanceof LazyWrapper) || !isIndex(start)) {
32 return this.thru(interceptor);
34 value = value.slice(start, +start + (length ? 1 : 0));
35 value.__actions__.push({
37 'args': [interceptor],
40 return new LodashWrapper(value, this.__chain__).thru(function(array) {
41 if (length && !array.length) {
42 array.push(undefined);
48 module.exports = wrapperAt;