A JavaScript utility library delivering consistency, modularity, performance, & extras.
0
votes
0answers
11 views
Dep map in JavaScript
Here I'm getting the job done but I'm looking for some efficiency. I hate combing through each and exporting to a top level object, so I'd prefer to use a map. I'm using Lodash here, so I'm open to ...
2
votes
1answer
88 views
Check deep object property and find duplicate value
I use the following code to find if there is duplicate value in property path:
...
1
vote
0answers
21 views
0
votes
1answer
40 views
Function to ensure that at least one choice is selected
First here is my settings object below. insight, spike and ...
1
vote
1answer
54 views
Create new array by filter origin array
I'm getting an array and I needed to find a duplicate ID inside:
...
4
votes
1answer
207 views
Generating an HTML table with colspan and rowspan from a one-dimensional array
I will be given the following input:
...
3
votes
1answer
70 views
0
votes
0answers
17 views
1
vote
1answer
65 views
5
votes
1answer
64 views
Animation Template Method for Snake Game
I have recently finished my first iteration of a template method implementation for a JavaScript canvas animation of the snake game. However, I would love for the community to critique this code and ...
1
vote
1answer
65 views
Group similar objects into array of arrays
I have the following code, that groups similar todos into an array of arrays, using lodash (https://lodash.com). Here is a plnkr http://plnkr.co/edit/t4J5bKGjMlQxW2z9Zh7x?p=preview (open your console ...
0
votes
4answers
435 views
1
vote
3answers
96 views
Converting an array into an object
I have an array of this fashion:
var arr = ["akira",9248,"padilla",100];
I'm using filter to take the names and the points:
<...
3
votes
1answer
3k views
1
vote
1answer
4k views
Order array of objects by date property
Here's a function that sorts an array of objects with a dateProp by the date. First it uses moment to convert the Date object to ...
2
votes
0answers
50 views
Extremely redundant HTML templating
This is horrendous.
I'm using lodash's templating engine for this table. Here's the template for an individual record's row. I've got 5 different table and ...
0
votes
4answers
2k views
Generating an array of unique values of a specific property in an object array
Given a table represented as a javascript array of objects, I would like create a list of unique values for a specific property.
...
3
votes
1answer
245 views
Iterating through a range using lodash/AngularJS and saving data
The code below doesn't seem right to me. The scenario is:
User enters in a "quantity" into a form field.
If the user enters in 5, the loop below should iterate 5 times.
There should now be 5 new ...
2
votes
1answer
44 views
Data transformation using Lodash in a more readable way
I don't like how transforming the data requires a bunch of nested functions. It's not very readable. Is there a more readable way to do the same transformations in Lodash?
...
-1
votes
1answer
68 views
Filtering/mapping strategies
This is real JavaScript/Lodash code used in a project I'm currently working on, but actually this particular question bothers me quite often regardless of the language. Say, I need to generate some ...
2
votes
1answer
3k views
Object deep diff function using Lodash
I'm working on an API testing algorithm within the Postman REST client and I wanted a simple and elegant deep diff function to test my JSON responses. I only have access to Lodash within Postman's ...
10
votes
1answer
141 views
Hunt the wumpus: Functional JavaScript (Node) with Lodash
I'd like a code review of the following simple implementation of the classic game Hunt the Wumpus
I'm trying to use JavaScript in the most "functional" way. To help me, I'm using lodash and ES6.
<...
4
votes
2answers
1k views
“Invert” a JavaScript object hash whose values are arrays to produce a new object hash with keys as the elements of those original value vectors
Background
lodash and underscore have an invert function that takes an object hash and converts it to a new one, which has keys as the input object's values and ...
1
vote
1answer
1k views
Lodash chain implementation
I am mainly trying to avoid the nested forEach statements and am trying to move towards a lazy evaluation type solution.
jsFiddle
...
2
votes
4answers
2k views
Fill an array of objects with some default object
I have an array of objects. Whatever may be the size of this array, I need to ensure the size of the array as n using a default object.
...
3
votes
2answers
26 views
Function that groups rows returned from SQL DB
I have a data set returned from an SQL database contained below, as you can see all data remains the same apart from one property, "name_alt".
...
17
votes
2answers
29k views
Deep pick using lodash/underscore
Use Case
_.pick creates a shallow clone of an object given a predicate that identifies which keys to keep. pickDeep would ...
26
votes
5answers
52k views
Convert object array to hash map using lodash
The use case is to convert an array of objects into a hash map where one property is the key and the other property is the value. Common case of using this is converting a "link" object in a ...
2
votes
1answer
656 views
Rendering a large collection using BackboneJS and LoDash
I have a Playlist object which contains many PlaylistItem children. If I have 10,000 children then the UI gets blocked from ...
3
votes
0answers
617 views
Implementing “day wise task management” system using Django and AngularJS
I have a Task model in Django which looks like the following:
...
1
vote
1answer
401 views
Layout manager: decouple DOM insertion from construction and rendering? [closed]
I'm refactoring a responsive report builder in JavaScript. Here's what it looks like:
This started as a small set of objects that transformed data, rendered the graphs with D3.js, and managed the ...