{"size": 994, "ext": "js", "max_stars_repo_path": "function-roles/2-data-access/sandbox.js", "max_stars_repo_name": "firity/architecture", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "function-roles/2-data-access/sandbox.js", "max_issues_repo_name": "firity/architecture", "max_issues_repo_issues_event_min_datetime": "2021-09-03T14:13:07.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-05T06:55:30.000Z", "max_forks_repo_path": "function-roles/2-data-access/sandbox.js", "max_forks_repo_name": "firity/architecture", "max_forks_repo_forks_event_min_datetime": "2021-08-24T17:49:23.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-01T19:45:29.000Z"}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": 17, "avg_line_length": 20.7083333333, "max_line_length": 58, "alphanum_fraction": 0.6287726358}
// no need to import the store!
//  the functions access the store for you
//  that's the whole point of a data access layer ;)

import { load } from './load.js';
import { insert } from './insert.js';
import { find } from './find.js';
import { findAll } from './find-all.js';
import { save } from './save.js';
import { remove } from './remove.js';

// --- initialize store ---

debugger;

const data = {
  userName: 'pilyard',
  name: 'louisa',
  age: 31,
  email: 'pily.ard@somewhere.org',
};

load(data);

// --- create a new field ---

insert('hair', 'orange');

const hairColor = find('hair');
console.log("louisa's hair color is " + hairColor);

// --- update an existing field ---

save('age', 32);

const newAge = find('age');
console.log(`louisa is now ${newAge}`);

// --- delete a field ---

remove('email');
console.log('email has been removed');

// --- final state ---

console.log('final key/value pairs in store:', findAll());
console.log('initial data has not changed:', data);
