src/statorgfc.js
function(key_or_new_store, value) {
    if (arguments.length === 1) {
      // replace the whole store
      let new_store = key_or_new_store
      for (let k in new_store) {
        store.set(k, new_store[k])
      }
      return
    }

    let key = key_or_new_store
    if (!store._store.hasOwnProperty(key)) {
      // use hasOwnProperty for better performance (entrie prototype chain is not traversed)
      throw `cannot create new key after initialization (attempted to create ${key})`
    }

    let oldval = store._store[key]
    checkTypeMatch(key, oldval, value)
    if (valueHasChanged(oldval, value)) {
      let update_store = store._runUserMiddleware(key, oldval, value)
      if (update_store) {
        store._store[key] = value
        store._publishChangeToSubscribers(key, oldval, value)
      }
    }
  }
function(key_or_new_store, value) {
    if (arguments.length === 1) {
      // replace the whole store
      let new_store = key_or_new_store
      for (let k in new_store) {
        store.set(k, new_store[k])
      }
      return
    }

    let key = key_or_new_store
    if (!store._store.hasOwnProperty(key)) {
      // use hasOwnProperty for better performance (entrie prototype chain is not traversed)
      throw `cannot create new key after initialization (attempted to create ${key})`
    }

    let oldval = store._store[key]
    checkTypeMatch(key, oldval, value)
    if (valueHasChanged(oldval, value)) {
      let update_store = store._runUserMiddleware(key, oldval, value)
      if (update_store) {
        store._store[key] = value
        store._publishChangeToSubscribers(key, oldval, value)
      }
    }
  }
function ( key_or_new_store , value ) { if ( arguments . length === 1 ) { // replace the whole store let new_store = key_or_new_store for ( let k in new_store ) { store . set ( k , new_store [ k ] ) } return } let key = key_or_new_store if ( ! store . _store . hasOwnProperty ( key ) ) { // use hasOwnProperty for better performance (entrie prototype chain is not traversed) throw ` ${ key } ` } let oldval = store . _store [ key ] checkTypeMatch ( key , oldval , value ) if ( valueHasChanged ( oldval , value ) ) { let update_store = store . _runUserMiddleware ( key , oldval , value ) if ( update_store ) { store . _store [ key ] = value store . _publishChangeToSubscribers ( key , oldval , value ) } } }
set key or keys of store object
@param {str/obj} key_or_new_store: if str, this key is replaced. If obj, all keys of the obj replace store's keys.
@param {any} value: If key was provided, the associated value. The type of the value for this key cannot change. Exceptions to this rule
are to/from null or undefined. Otherwise if you try to change, say, `1` to `'2'`, a type error will occur (int to string is not permitted).
set key or keys of store object