julianlam / nodebb-plugin-session-sharing

Allows login sessions from your app to persist in NodeBB
MIT License
88 stars 65 forks source link

No underscore referenced in parent package.json #72

Closed uplift closed 5 years ago

uplift commented 5 years ago

Underscore isn't defined in Nodebb's package.json so theres no set version that it should pickup.

https://github.com/julianlam/nodebb-plugin-session-sharing/blob/98c826f3b396e7aeece7c9dedb0f957ee9dd3c00/library.js#L10

julianlam commented 5 years ago

v4.4.3

uplift commented 5 years ago

I've just updated to your change for this issue and noticed _.pick(settings, Boolean) is returning an empty object even though the settings object has data.

I think lodash version of pick expects an array of properties to pick from and has another function pickBy that accepts a function which seems to work locally for me.

julianlam commented 5 years ago

You're saying I should use _.pickBy instead? Just confirming before I make the change :+1:

uplift commented 5 years ago

Yeah .pickBy accepts truthy function where as .pick uses an array of object keys to pick. So with Boolean parameter fits _.pickBy api

uplift commented 5 years ago

I think the change you made on L397 can remain as _.pick as its an array of properties

.pick - Creates an object composed of the picked object properties. I.e. profileFields .pickBy - Creates an object composed of the object properties predicate returns truthy for. The predicate is invoked with two arguments: (value, key). I.e. Boolean

julianlam commented 5 years ago

Okey dokey, v4.4.4 thanks for the attention