From 9e6873c2f1f2a622b622f5de3ecb78d95274f62d Mon Sep 17 00:00:00 2001 From: P42 <72252241+p42-ai[bot]@users.noreply.github.com> Date: Mon, 7 Dec 2020 21:46:12 +0000 Subject: [PATCH] Split Multi-Variable Declarations **Convert variable declarations with multiple variables into separate declarations that declare one variable each.** For example, ``` let a = 2, b; ``` is converted into ``` let a = 2; let b; ``` --- scripts/flights.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/flights.js b/scripts/flights.js index cf5651ad..8b29bc8a 100644 --- a/scripts/flights.js +++ b/scripts/flights.js @@ -1,8 +1,11 @@ -const fs = require('fs'), - dl = require('datalib'); +const fs = require('fs'); +const dl = require('datalib'); function getRandomSubarray(arr, size) { - let shuffled = arr.slice(0), i = arr.length, temp, index; + let shuffled = arr.slice(0); + let i = arr.length; + let temp; + let index; while (i--) { index = Math.floor((i + 1) * Math.random()); temp = shuffled[index]; @@ -20,8 +23,8 @@ const flights = dl.csv('data/flights-3m.csv', { parse: {date: 'string', 'delay': 'number', 'distance': 'number'} }); -const N = +process.argv[2] || 2000, - fmt = dl.format.auto.number('s'); +const N = +process.argv[2] || 2000; +const fmt = dl.format.auto.number('s'); const randFlights = getRandomSubarray(flights, N).map(function(d) { return (d.date = formatDate(d.date), d);