Category : lodash

I got a problem that I struggle with for a long time and it’s about importing modules to my main JS script. I downloaded a lodash library via npm and I want to import it into my main script in order to use its functionalities. Here’s the code: import * as _ from ‘./node_modules/lodash/lodash.js’; console.log(_.head([1,2,3])) ..

Read more

I have a list of properties, like so: const list = [ ‘creditCardNumber’, ‘orderDetails.amount’, ‘customerInformation.details.email’, ] Given an object like this: const someObj = { creditCardNumber: ‘000 0000 0000 0000’, orderNumber: ‘1234’, orderDetails: { amount: 20, date: ‘some date’ }, customerInformation: { details: { email: ‘[email protected]’, joinedOn: ‘someDate’ } }, someOtherProp: ‘some value’, } Using ..

Read more

I have a list of times slots here eg: const times = [ { start_time: ‘2020-07-09T08:00:00.000+02:00’, endTime: ‘2020-07-09T09:30:00.000+02:00’ }, { start_time: ‘2020-07-09T08:30:00.000+02:00’, endTime: ‘2020-07-09T10:00:00.000+02:00’ }, { start_time: ‘2020-07-09T09:00:00.000+02:00’, endTime: ‘2020-07-09T10:30:00.000+02:00′ } ] While I’m trying to sort and group them by day using momentjs and lodash to get something like: { Monday: [ {startTime: ’08:00′, ..

Read more