message: feat: map - minor changes to script
diff: +/**
  + * Loads a json file of markers into a new or existing Algolia index.
  + * De
  + *
  + * @param param1 Name of json file
  + * @param param2 Name of new or existing Algolia index
  + * @param param3 Confirm parameter, if loading into markers index. Must have value 'confirm-markers' if loading into markers index.
  + * Parameter is the name of the production index, so value is required if loading into markers index.
  + */
  +
  +// TODO: add parameter for whether to delete or append, add example, change to await
  +
  /* eslint-disable no-console */
  import algoliasearch from 'algoliasearch';
  import dotenv from 'dotenv';
  @@ -6,7 +18,7 @@ import fs from 'fs';
  // eslint-disable-next-line import/extensions
  import { markerConfig } from './config-algolia-index.js';
  -dotenv.config();
  +dotenv.config(); // enables reading of process.env variables from node - not required for web javascript
  // argv holds an array of values passed to this script
  // argv[0] => info about node
  // argv[1] => file spec for the script
  @@ -24,19 +36,12 @@ if (indexName === 'markers' && confirm !== 'confirm-markers') {
  }
  /* eslint-disable no-console */
  -/**
  - * Loads a json file of markers into a new or existing Algolia index
  - *
  - * @param param1 Name of json file
  - * @param param2 Name of new or existing Algolia index
  - * @param param3 Confirm parameter, if loading into markers index. Must have value 'markers' if loading into markers index.
  - */
  const algoliaAdminKey = process.env.ALGOLIA_ADMIN_KEY || 'undefined';
  const algoliaAppId = process.env.ALGOLIA_APP_ID || 'undefined';
  const client = algoliasearch(algoliaAppId, algoliaAdminKey);
  const index = client.initIndex(indexName);
  -await index.clearObjects();
  +await index.clearObjects(); // deletes all records if index exists
  markerConfig(indexName);
  @@ -59,9 +64,7 @@ for (const marker of hits) {
  }
  index
  - .saveObjects(dataJSON, {
  - autoGenerateObjectIDIfNotExist: true,
  - })
  + .saveObjects(dataJSON)
  .then(console.log('Records processed..wait for completed'))
  .catch(err => console.log(`error ${JSON.stringify(err, null, 2)}`));
  