Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 29 2016 21:28
  • Dec 29 2016 21:28
  • Dec 29 2016 21:28
  • Dec 29 2016 21:28
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
  • Dec 29 2016 21:27
Alexander Saenen
@AlexSaenen
Yep you're right, tried with another chrome account and it worked, thanks and sorry :D
illuminist
@illuminist
No worry 👍
Alexander Saenen
@AlexSaenen
Okay I dug deeper, seems to be an issue with the service worker, I ticked the "bypass for network" and everything worked
Alex Brasetvik
@alexbrasetvik_twitter
Hey. I'm looking for the right venue to report a security concern with lodash, as a public GitHub issue seems to be the only option. (https://github.com/lodash/lodash/security/policy is empty, no mention in contributor guidelines, etc) Anyone aware of a private option?
Sparsh Yadav
@sparshy
Hi I have an object like
var object = { 'list':[ { fname: 'bob', lname: 'yadav'}, { fname: 'elon', lname: 'musk'}] , 'b': '2', 'c': 3 };

if I do

_.pick(object, ['list[0].fname', 'c']);

this gives me just the first item in the list, is there a way i can get fname for all the items in the list

I want my output to be
{ list : [ { fname: 'bob'}, { fname: 'musk'}],  c : 3}
Sparsh Yadav
@sparshy

can not do this

_.pick(object, ['list[0].fname','list[1].fname', 'c']);

as i wont be sure about the length of the list

illuminist
@illuminist
I think it will should be a good idea to extract and map object.list first then assign to object from _.pick(object, 'c') later
There is no need to end all of this in one line
Sparsh Yadav
@sparshy

I was hoping for something like

_.pick(object, [ 'list[*].fname '])

:D

can you please share a snippet of how you said it could be done?
@illuminist
Oh I get it what you mean. dont worry abt it, but do we have any direct way?
illuminist
@illuminist
Not sure, seem to require at least 2 steps for this
illuminist
@illuminist
@sparshy Do you still need the snippet?
Sparsh Yadav
@sparshy
If you have it, please.
illuminist
@illuminist
var object = { 'list':[ { fname: 'bob', lname: 'yadav'}, { fname: 'elon', lname: 'musk'}] , 'b': '2', 'c': 3 };
var mappedList = _.map(object.list, o=> _.pick(o, 'fname'))
var finalObject = {..._.pick(object, 'c'), list: mappedList}
or
var finalObject = {c: object.c, list: mappedList}
Sparsh Yadav
@sparshy
thanks @illuminist
Алексей Данчин
@Aleksey-Danchin
Hi guys! I have a suggestion for a new feature for the library. Where and how can I leave an offer?
illuminist
@illuminist
Post it to issues in github is good enough, I think
Dmytro Yurchenko
@1inuxoid
Hey everyone, quick question, lodash-cli was moved to the archive here https://github.com/lodash-archive/lodash-cli but is still being updated. However, there were no new releases published to npmjs registry since 4.17.5. Are you guys planning to publish v4.17.15?
BRadHoc
@BRadHoc
anyone know how to make _.isEqual not care about the order of values?
illuminist
@illuminist
@BRadHoc convert arrays to Set then use isEqual
or
_.isEqualWith([1,2],[2,1],arr => new Set(arr))
Tvrqvoise
@Tvrqvoise
Hey, this is really weird -- I have a built file containing lodash-es. For whatever reason, get does not work when passed a string path, but DOES work when invoked with an array of paths
Object(pe.a)(o, "media.primaryImage.path")

Does not return anything, but

Object(pe.a)(o, ["media", "primaryImage", "path"])

Does. Any ideas as to why?

apologies about the symbol mangling there -- this is all uglified
Package lock says I'm on 4.17
Oh, and another oddity -- pe.a(o, 'media') does get the top level node, so the string based syntax does work, but it refuses to traverse any deeper
illuminist
@illuminist
@Tvrqvoise What is a structure of your object? Have you tried with simpler object?
Tvrqvoise
@Tvrqvoise
Object(pe.a)({ foo: { bar: { baz: 2 } } }, 'foo.bar.baz')
undefined
Object(pe.a)({ foo: { bar: { baz: 2 } } }, ['foo', 'bar', 'baz'])
2
same strange behavior with that hardcoded object structure
but, when I try the same thing on the docs site, it works:
_.get({ foo: { bar: { baz: 2 } } }, 'foo.bar.baz')
2
_.get({ foo: { bar: { baz: 2 } } }, ['foo', 'bar', 'baz'])
2
illuminist
@illuminist
I've tested trying to import from 'lodash-es/get' it works fine also
Tvrqvoise
@Tvrqvoise
I don't think it's a lodash bug, so much as something in my build -- maybe a version mismatch or similar?
illuminist
@illuminist
Hard to tell exactly
Tvrqvoise
@Tvrqvoise
so, it looks like get does a null-ish check, then steps into a function where it loops over the path and extracts object properties
illuminist
@illuminist
Did you also try set ?
Tvrqvoise
@Tvrqvoise
I can't, it's not in my build
on the lodash docs site, there's a split function invoked before the loop begins, but I don't see that happening in mine

The loop function on the docs site:

function kt(n, t) {
    t = Sr(t, n);
    for (var r = 0, e = t.length; null != n && r < e; )
        n = n[Me(t[r++])];
    return r && r == e ? n : T
}

The loop function in my bundle:

var r = n(57)
  , o = n(54);
t.a = function(e, t) {
    for (var n = 0, i = (t = Object(r.a)(t, e)).length; null != e && n < i; )
        e = e[Object(o.a)(t[n++])];
    return n && n == i ? e : void 0
}
that n(57) / n(54) thing implies to me that maybe concat plugin in broken in my build....hrm
Oh wait, Sr is the function I was saying was missing, but it's actually just r.a
But! It doesn't work:
Object(r.a)(t, e) // → undefined
Sr(t, n) // → ["foo", "bar", "baz"]
illuminist
@illuminist
I think that is some castPath function
https://github.com/lodash/lodash/blob/es/_baseGet.js you should look in here so you might get some idea about your built
Tvrqvoise
@Tvrqvoise
ah, perfect! Yeah, that's "the loop function"
Tvrqvoise
@Tvrqvoise
Found it -- nothing related to lodash. https://github.com/lodash/lodash/blob/es/_stringToPath.js was getting removed from my build, after we upgraded UglifyJS last week. I don't know why. Downgrading Uglify or switching to Terser fixes it.