Skip to content

lodash.pick has different behaviour from _.pick (does not support dot in the path) #4459

@AntonBazhal

Description

@AntonBazhal
const doc2 = {
  "source": {
    "name": "foo",
    "event": "bar",
    "data": {
      "businessUnit": {
        "name": "baz"
      }
    }
  }
};

const pick1 = require('lodash.pick');
const pick2 = require('lodash/pick');

console.log('lodash.pick:', pick1(doc2, [
  'source.name',
  'source.event',
  'source.data.businessUnit.name'
]));

console.log('lodash/pick:', pick2(doc2, [
  'source.name',
  'source.event',
  'source.data.businessUnit.name'
]));

Result:

lodash.pick: {}
lodash/pick: { source: { name: 'foo', event: 'bar', data: { businessUnit: [Object] } } }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions