lodash / babel-plugin-lodash

Modular Lodash builds without the hassle.
Other
1.96k stars 92 forks source link

Method "_.get" returns undefined sometimes. #182

Closed kmvan closed 6 years ago

kmvan commented 6 years ago
import { get } from 'lodash'
const object = { 'a': [{ 'b': { 'c': 3 } }] }
console.log(get(object, 'a[0].b.c')) // output undefined
console.log(get(object, 'a')) // output object
console.log(get(object, 'a[0]')) // output undefined

Something wrong with my code?

jdalton commented 6 years ago

You're probably using this plugin with lodash-webpack-plugin and need to enable a feature set.

kmvan commented 6 years ago

Thank you man. And which feature set?

jdalton commented 6 years ago

You most likely need to enable the "paths" feature set.

kmvan commented 6 years ago

Got it. https://github.com/lodash/lodash-webpack-plugin#feature-sets