lib/legacy.js
/**
   * Store/update in-memory copy of backup data.
   * Helps to understand if there were any changes and we shoud to save stored settings.
   * @param {Object} settings Settings object.
   * @return {number|false} Amount of changed settings or false if there we no changes.
   */
Store/update in-memory copy of backup data.
Helps to understand if there were any changes and we shoud to save stored settings.
@param {Object} settings Settings object.
@return {number|false} Amount of changed settings or false if there we no changes.
Store / update in - memory copy of backup data . Helps to understand if there were any changes and we shoud to save stored settings . @param { Object } settings Settings object . @return { number|false } Amount of changed settings or false if there we no changes .
updateData(settings = {}) {
    if (!isObject(settings)) return false;
    const firstUpdate = !isObject(this.data);
    if (firstUpdate) this.data = {};
    return Object.keys(settings)
      .filter((k) => this.keys.includes(k))
      .filter((k) => this.data[k] !== settings[k])
      .reduce((acc, k) => {
        if (!firstUpdate) {
          this.logMsg(`Changed option ${k}: ${this.data[k]} => ${settings[k]}`);
        }
        this.data[k] = settings[k];
        return acc + 1;
      }, 0) || false;
  }
updateData ( settings = { } ) { if ( ! isObject ( settings ) ) return false ; const firstUpdate = ! isObject ( this . data ) ; if ( firstUpdate ) this . data = { } ; return Object . keys ( settings ) . filter ( ( k ) => this . keys . includes ( k ) ) . filter ( ( k ) => this . data [ k ] !== settings [ k ] ) . reduce ( ( acc , k ) => { if ( ! firstUpdate ) { this . logMsg ( ` ${ k } ${ this . data [ k ] } ${ settings [ k ] } ` ) ; } this . data [ k ] = settings [ k ] ; return acc + 1 ; } , 0 ) || false ; }
Store/update in-memory copy of backup data.
Store / update in - memory copy of backup data .