Lodash Wrapper .at() Method

Beginner
⏱️ 7 min read
📚 Updated: Jul 2026
🎯 6 Examples + 3 Try It
Seq & chaining

What You’ll Learn

By the end of this tutorial, you’ll use wrapper .at() inside Lodash chains to pluck nested values by path and unwrap with .value().

01

Chain syntax

_(obj).at(paths)

02

Path plucking

Dotted & bracket paths.

03

Array result

Always returns value[].

04

vs _.at()

Same logic, chain style.

05

vs _.get()

Many paths at once.

06

Unwrap

Finish with .value().

What Is Wrapper .at()?

Wrapper .at() is the chainable version of _.at(). Call it on a Lodash sequence wrapper to extract values at one or more property paths from the wrapped object or array, then continue chaining or unwrap with .value().

💡
Not _.prototype.at()

There is no _.prototype.at() function. The correct call is _(object).at('a.b.c').value() or _.chain(object).at(['name', 'email']).value().

Use wrapper .at() when you already have a chain and want to pluck several nested fields in one step—API responses, form prefill data, or config snapshots.

📝 Syntax

Call .at() on a wrapper; pass one path or many:

javascript
_(object).at(paths)
// or
_.chain(object).at(path1, path2, ...)

Syntax Rules

  • paths — string path(s), array of paths, or rest arguments ('a', 'b.c').
  • Return (after .value()) — always an array of values in path order.
  • Missing paths — yield undefined at that index; no exception is thrown.
  • Nested paths — use dot notation ('address.city') or bracket segments ('a[0].b').
  • Keys with dots — use array paths: [['weird.key']] (see _.at()).
javascript
import _ from "lodash";

const object = { a: [{ b: { c: 3 } }, 4] };
const extracted = _(object)
  .at(["a[0].b.c", "a[1]"])
  .value();

// extracted -> [3, 4]

⚡ Quick Reference

TaskCode patternResult
Single nested path_(obj).at('a.b.c')[value] array
Multiple paths.at('name', 'email')[name, email]
Path array.at(['a[0].b', 'a[1]'])Values in order
Direct equivalent_.at(obj, paths)See _.at()
One path, one value_.get(obj, path)See _.get()
Finish chain... .value()Plain array
Pluck
.at(paths)

Many paths → array

Single
.get(path)

One value

Unwrap
.value()

Plain array

🧰 Parameters

Arguments to wrapper .at() and what you get after .value():

paths Required

One or more path strings (or an array of paths) to read from the wrapped value.

.at('name', 'address.city')
return (wrapper) Wrapper

Another Lodash wrapper with the pluck step queued until unwrap.

_(obj).at('a.b')
.value() result Array

Always an array of extracted values, aligned with path order.

.value() // -> [3, 4]
missing path undefined

Absent paths produce undefined at that index—no throw.

.at('missing') // -> [undefined]

Same path rules as _.at(); wrapper .at() is for fluent chains only.

Examples Gallery

Practical wrapper .at() patterns with sample output and interactive Try It Yourself labs.

📚 Getting Started

Wrap an object, call .at() with paths, unwrap with .value().

Example 1 — Nested path extraction

Pull values from deeply nested objects using dot and bracket path notation.

javascript
const object = { a: [{ b: { c: 3 } }, 4] };

const extracted = _(object)
  .at(["a[0].b.c", "a[1]"])
  .value();

console.log(extracted);
// -> [3, 4]
Try It Yourself

How It Works

Each path string is resolved against the wrapped object. Results are collected into an array in the same order as the paths you passed.

Example 2 — Multiple paths as rest arguments

Pass several paths as separate arguments instead of wrapping them in an array.

javascript
const user = {
  name: "Alice",
  email: "alice@example.com",
  address: { city: "Portland", zip: "97201" }
};

const fields = _(user)
  .at("name", "email", "address.city")
  .value();

console.log(fields);
// -> ["Alice", "alice@example.com", "Portland"]
Try It Yourself

📈 Practical Patterns

Real-world plucking from API payloads, handling missing data, and comparing approaches.

Example 3 — Pluck fields from an API response

Extract only the fields you need from a nested API payload inside a chain.

javascript
const apiResponse = {
  data: {
    name: "John Doe",
    email: "john@example.com",
    address: { city: "New York", zip: "10001" }
  },
  meta: { requestId: "abc-123" }
};

const requiredFields = ["data.name", "data.email", "data.address.city"];

const extracted = _(apiResponse).at(requiredFields).value();

console.log(extracted);
// -> ["John Doe", "john@example.com", "New York"]

Example 4 — Missing paths become undefined

Lodash does not throw when a path is absent—the slot is undefined.

javascript
const config = { server: { host: "localhost" } };

const values = _(config)
  .at("server.host", "server.port", "database.name")
  .value();

console.log(values);
// -> ["localhost", undefined, undefined]

🚀 Beyond the Basics

When to use wrapper .at() versus direct _.at() or _.get().

Example 5 — Wrapper .at() vs direct _.at()

Both produce the same array—wrapper form fits inside longer chains.

javascript
const object = { a: [{ b: { c: 3 } }, 4] };
const paths = ["a[0].b.c", "a[1]"];

const chained = _(object).at(paths).value();
const direct = _.at(object, paths);

console.log(JSON.stringify(chained) === JSON.stringify(direct));
// -> true
Try It Yourself

Example 6 — .at() vs _.get() in a chain

Use .get() for one value; use .at() when you need several paths at once.

javascript
const user = {
  name: "Bob",
  profile: { age: 28, city: "Austin" }
};

const single = _(user).get("profile.city").value();
// -> "Austin" (one value)

const many = _(user).at("name", "profile.age", "profile.city").value();
// -> ["Bob", 28, "Austin"] (array)

console.log(single);
console.log(many);

🧠 How Wrapper .at() Works

1

Wrap your data

Start with _(object) or _.chain(object) so Lodash knows the source for path resolution.

Input
2

Call .at(paths)

Lodash resolves each path against the wrapped value—dot notation, brackets, and array indices all work.

Pluck
3

Unwrap with .value()

The pipeline runs and you receive a plain array of extracted values, ordered to match your paths.

Unwrap
=

Same logic as _.at()

Wrapper .at() delegates to _.at()—use it when path plucking belongs in the middle of a longer chain.

📝 Notes

  • There is no _.prototype.at() function—the correct name is wrapper .at() on a sequence object.
  • After .value(), the result is always an array, even for a single path ([value]).
  • Missing paths yield undefined at that index; Lodash does not throw.
  • For one nested value with a default, prefer chainable .get(path, default) or _.get().
  • For top-level keys only (returning an object), use _.pick() instead.
  • Path syntax matches the direct _.at() tutorial—including bracket notation for arrays.

Conclusion

Wrapper .at() lets you pluck one or many nested values inside a Lodash chain. Pass path strings, unwrap with .value(), and get an ordered array of results. It is the fluent companion to _.at()—ideal for API responses, form prefill, and config parsing when you are already chaining.

Next in the wrapper prototype series: .chain(), which re-wraps a value mid-pipeline for nested sequences.

💡 Best Practices

✅ Do

  • Use wrapper .at() when plucking several nested paths inside an existing chain
  • Keep path lists in named constants (const FIELDS = [...]) for reuse and clarity
  • Check for undefined slots when paths may be missing on partial data
  • Use .get() when you only need one value with an optional default
  • Read the _.at() tutorial for advanced path edge cases

❌ Don’t

  • Call it _.prototype.at()—that name does not exist in Lodash
  • Expect a single scalar when one path is passed—result is always an array
  • Use .at() for top-level key picking when .pick() returns a cleaner object
  • Forget .value() and treat the wrapper as the final array
  • Wrap just for .at() when a direct _.at(obj, paths) call is simpler

Key Takeaways

Knowledge Unlocked

Five things to remember about wrapper .at()

Use these when plucking nested paths inside Lodash chains.

5
Core concepts
📦 02

Array result

Always [values].

Return
🔗 03

Same as _.at

Direct equivalent.

Equivalent
📈 04

vs .get()

Many paths vs one.

Compare
⚠️ 05

Missing paths

undefined slots.

Safety

❓ Frequently Asked Questions

Inside a Lodash chain, .at(paths) plucks values from the wrapped object or array at the given path(s) and returns another wrapper. Call .value() to get the plain array of extracted values.
Yes—wrapper .at() delegates to the same logic as _.at(object, paths). The difference is syntax: _(obj).at('a.b').value() versus _.at(obj, 'a.b').
Always an array. One path yields a one-element array; multiple paths yield values in the same order as the paths you passed.
_.get reads one path and returns a single value (with optional default). .at reads one or many paths and always returns an array of values—better for plucking several fields at once.
The corresponding array slot is undefined. Lodash does not throw—check for undefined when paths may be absent.
Yes. .at() runs on the current wrapped value. Common pattern: _(apiResponse).at(['data.name', 'data.email']).value() to pull fields before further transforms.
Did you know?

Wrapper .at() always returns an array—even when you pass a single path like 'a.b.c', you get [value] after .value(). That is why _.get() is better when you need one scalar with a default, while .at() shines when plucking several fields in order.

Practice Wrapper .at() in the Live Editor

Pluck nested paths, compare with direct _.at(), and unwrap results instantly.

Open Try It editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful