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
SAGO
@SAGOlab
noone?
SAGO
@SAGOlab
there is a way to remove object from array that has specific value?
{type: "start", location: Array(2), load: Array(1), arrival: 1590066680, duration: 0, …}
1: {type: "job", location: Array(2), job: 10, service: 420, waiting_time: 0, …}
2: {type: "job", location: Array(2), job: 9, service: 420, waiting_time: 0, …}
3: {type: "job", location: Array(2), job: 7, service: 420, waiting_time: 0, …}
4: {type: "job", location: Array(2), job: 3, service: 420, waiting_time: 0, …}
5: {type: "end", location: Array(2), load: Array(1), arrival: 1590080738, duration: 12378, …}
6: {type: "start", location: Array(2), load: Array(1), arrival: 1590066680, duration: 0, …}
7: {type: "job", location: Array(2), job: 0, service: 420, waiting_time: 0, …}
8: {type: "job", location: Array(2), job: 5, service: 420, waiting_time: 0, …}
9: {type: "job", location: Array(2), job: 4, service: 420, waiting_time: 0, …}
10: {type: "job", location: Array(2), job: 2, service: 420, waiting_time: 0, …}
11: {type: "end", location: Array(2), load: Array(1), arrival: 1590076873, duration: 8513, …}
12: {type: "start", location: Array(2), load: Array(1), arrival: 1590066680, duration: 0, …}
13: {type: "job", location: Array(2), job: 1, service: 420, waiting_time: 0, …}
14: {type: "job", location: Array(2), job: 11, service: 420, waiting_time: 0, …}
15: {type: "job", location: Array(2), job: 8, service: 420, waiting_time: 0, …}
16: {type: "job", location: Array(2), job: 6, service: 420, waiting_time: 0, …}
17: {type: "end", location: Array(2), load: Array(1), arrival: 1590080203, duration: 11843, …}
I want to remove all object that have type:"start" and type:"end"
illuminist
@illuminist
const newArray = yourarray.filter(obj => !(obj.type === 'start' || obj.type === 'end'))
SAGO
@SAGOlab
@illuminist thanks a lot
illuminist
@illuminist
👍
ankit jain
@ankitmjain_twitter
Hi All
i am looking for the solution to fix the lodash vulranability
Patrik Jajcay
@iFarmGolems

Hey guys!

When using lodash/fp, why is this not equivalent?

_.flip(_.divide)(100)(500)
=> 0.2

_.partial(_.flip(_.divide), [100])(500)
=> 5
Patrik Jajcay
@iFarmGolems
Found the issue: lodash/lodash#2071
Cameron Moon
@cmrn
Hi folks! Just wanted to draw peoples attention to lodash/lodash#4759
This is the PR to fix the vulnerability previously reported by snyk and sonatype, and now also published by npm. Are there any maintainers here who could jump back into this PR?
1 reply
pinging some members of the lodash org (https://github.com/orgs/lodash/people) - @jdalton @jridgewell @veksen
fcastillo
@fcastillo_twitter
Hi everybody, just wanted to ask if anybody has a workaround for lodash/lodash#4842 On templates, is there a way to prevent creating new lines from evaluating only tags? Similar to how ejs has -%>
enricofadly
@enricofadly
guys anyone had idea why search bar in lodash docs site is slow at chrome?
Jeffrey Spies
@JeffSpies

Hi, all; big fan of lodash. I'm working on a programmer interface and would like users to be able to use lodash chains. What I need is the following:

chain().flatten().value()

that would be equivalent to

(i) => _.chain(i)._flatten()._value()

I can accomplish this by creating a class, dynamically adding methods that collect the chained function names and args, and then returning the chained result when value() is invoked, but I suspect there's a more functional/lodash way of doing this. Thoughts? Thanks in advance!

ZeonWang
@scplay
hi everyone, I just pull source code in my local machine, I want run lodash/test, but the code was use es6 module that node cannot recognize, How can I run test correctly? Thx
aditya
@adibro500
i have an array: ''' arr=[ {"key": "a_bcv", "value": "ji"}, {"key": "am_hjk", "value": "hello"}, {"key": "k_bcv", "value": "hi"} ] '''
i have an array: arr=[ {"key": "a_bcv", "value": "ji"}, {"key": "am_hjk", "value": "hello"}, {"key": "k_bcv", "value": "hi"} ]
i want output: arr = [{"key": ["a_bcv", "k_bcv"], value: ["ji", "hi"]}, {"key": "am_hjk", "value": "hello"}]
the string following the first underscore must match
Marin Kapranov
@Biseamon
How can I join 2 arrays of objects to form parent child relationship
[
{
"id": "1f3d0b56-01bd-4a7e-b019-56676682b48a",
"total_price": 8
},
{
"id": "200a2543-a035-4048-b0c9-bba78ee668a3",
"total_price": 8
}
]

And below is the child array:

[
{
"id":"product 1",
"order_id":"1f3d0b56-01bd-4a7e-b019-56676682b48a",
"price":1,
"quantity":4
},
{
"id":"product 2",
"order_id":"1f3d0b56-01bd-4a7e-b019-56676682b48a",
"price":1,
"quantity":4
},
{
"id":"product 3",
"order_id":"200a2543-a035-4048-b0c9-bba78ee668a3",
"price":1,
"quantity":4
}
]

I want to combine to become like this:

[
{
"id":"1f3d0b56-01bd-4a7e-b019-56676682b48a",
"total_price":8,
"products":[
{
"id":"product 1",
"order_id":"1f3d0b56-01bd-4a7e-b019-56676682b48a",
"price":1,
"quantity":4
},
{
"id":"product 2",
"order_id":"1f3d0b56-01bd-4a7e-b019-56676682b48a",
"price":1,
"quantity":4
}
]
},
{
"id":"200a2543-a035-4048-b0c9-bba78ee668a3",
"total_price":8,
"products":[
{
"id":"product 3",
"order_id":"200a2543-a035-4048-b0c9-bba78ee668a3",
"price":1,
"quantity":4
}
]
}
]

Mikael Larsson
@indiehjaerta
Anyone have a good solution how I could merge the category array into the categoryGroups array where ids are equal.
let categoryGroups = [
    {
        id: '5f6dae6698bf749541d07ae0',
        name: 'Group 1',
        categories: [
            { id: '5f6daf2698bf749541d07ae4', name: 'Category 1' },
            { id: '5f6daf3398bf749541d07ae6', name: 'Category 2' },
        ],
    },
    {
        id: '5f6daed098bf749541d07ae1',
        name: 'Group 2',
        categories: [{ id: '5f6daf2c98bf749541d07ae5', name: 'Category3' }],
    },
];

let categories = [
    {
        category: { id: '5f6daf2698bf749541d07ae4' },
        amount: 400,
    },
];
aditya
@adibro500
how can i achieve SQL query: SELECT A,B from TABLE WHERE A in (1,2,3) and B in (4,5,6);
in lodash
?
SELECT A,B from TABLE WHERE A in (1,2,3) and B in (4,5,6)
Ali Heidari
@ali-heidari
Hello everyone, happy new year...
Ali Heidari
@ali-heidari
I wonder why almost all of the utility libraries available for javascript(including Lodash) have flat-file structure!? I just checked some libraries written for other languages such as C# and Java, they are categorized by sub-folder! Does flat-file provide any specific advantage over the categorized?
Sam Garfinkel
@sgarfinkel
Hey folks I’m currently importing lodash functions directly to support tree shaking. However the license header for lodash is only on the main lodash.is script. Terser is not extracting the license header as a result. Does anyone have a workaround for this?
Samuele Zanca
@metruzanca
@ali-heidari "Flat-file" is simply due to the fact that java / c# functions MUST be inside classes. JS like most scripting languages, e.g. python and bash, can have functions outside of classes. Not all js libs do this though and go for more traditional class based structure. lodash specifically does this because you can npm install lodash.fileName to only install a specific function if you only need 1, this is to reduce bundle size.
George Batalinski
@georgebatalinski
has anyone encountered this error?
Property 'values' does not exist on type 'Collection<{ a: number; b: number; }>'. Did you mean 'value'?(2551)
_([{ a: 1, b: 2 }])
  .values()
  .value();
Alex
@42ae
Hello, I am trying to get my head around a simple problem:

Given the following map:

var users = { 'david': true, 'alex': false, 'kalid': false };

How can I have a map of all true value?

Thanks!

Abhisek Pattnaik
@abhisekp
Object.toEntries can be used
Or _.toPair
张宗伟
@ZhangDaZongWei
have a post/article to parse the source code of .debounce and .throttle function ?
i am very confused about some parts in it.
ahmadhajali
@ahmadhajali
Hi, where can I find generated lodash.js file for version 4.17.21?
Acterion
@Acterion
Hello, just used .merge and it mutated const variable. I know it should mutate the first object, but wouldn't it be nice if it could mutate only mutatable vars? Is there some ideology behind the decision to mutate all types of vars?
Justin Grote
@JustinGrote
Hello, I'm making vscode extensions which uses Node 14. Should I be importing from lodash or lodash-es these days? I use esbuild and I would like it to tree-shake to only use the functions I'm using. Thanks, I can't find a straight answer
Taegyu Min
@taegyumin
Hello there,
Is there any way to groupBy a collection of objects that are identified by two or more properties?
There must have been discussions in the past. I would appreciate it if anyone leaves a link related to this.
xkem
@xkem

Lets say you have an array:

var x = [{id: null, value: "cat"}, { id: null, value: "dog"}]

If you groupBy id, which is null, the items will be grouped by string "null".

Surely this is not intended behaviour?

What if my id is actually string "null"? The results are grouped along with values that are null...

Nasif Imtiaz
@nasifimtiazohi
HI, I asked a question on SO on extra files (possible auto-generated, not present in the GitHub repo) in lodash tarball downloaded from npm registry - https://stackoverflow.com/questions/69950479/extra-files-in-lodash-tarball-in-npm-registry . Would appreciated if someone has an answer