# install dependencies
$ npm install
# serve Nuxt app with hot reload at localhost:3000
$ npm run dev
# serve standalone Express app in /api with hot reload at localhost:4000
$ npm run dev:express
Production Build Setup
# install dependencies
$ npm install
# build and optimize your application with webpack
$ npm run build
# launch server
$ npm run start
# or launch server in the background
$ npm run pm2:start
CSV GroupBy in JavaScript
Source CSV
State
Month
Quantity
Johor
Jan
240
Johor
Feb
260
Johor
Feb
300
Penang
Jan
200
JavaScript Code
constdata=[{State: "Johor",Month: "Jan",Quantity: 240},{State: "Johor",Month: "Feb",Quantity: 260},{State: "Johor",Month: "Feb",Quantity: 300},{State: "Penang",Month: "Jan",Quantity: 200}];constformattedData=data.reduce((result,{ State, Month, Quantity })=>{// init empty object if not thereresult[State]=result[State]||{};// init empty object if not thereresult[State][Month]=result[State][Month]||{};// init zero if not thereresult[State][Month].Quantity=Quantity+(result[State][Month].Quantity||0);returnresult;},{});