Source: lib/state.js

/**
 * ### State management library
 *
 * All functions that are related to state management
 *
 * State as a singleton can be accessed anywhere in the application by a simple
 * require, making it very simple to check the current state.
 * State should be the ONLY mutated object in the app. Its properties will be
 * replaced by updated ones over and over again during the app lifecycle,
 * ensuring that all functions remain pure.
 *
 * @module Library/State
 */
"use strict";

const {
    set,
    get
    // This is the only time we will use regular lodash instead of lodash
    // FP, because state is the only allowed mutated object
} = require("lodash");

/**
 * State getter
 * @param {String} path - Path to create/update
 * @param {Any} value - Value to create/update
 * @return {Object} This module with given value set at given path
 */
exports.set = (path, value) => set(exports, path, value);

/**
 * State setter
 * @param {String} path - Path to retrieve
 * @return {Any} Value located at path in this module
 */
exports.get = (path) => get(exports, path);