tunnckoCore/dush-options

emit `option`, `enable` and `disable` events

tunnckoCore opened this issue · 0 comments

    app.option = function option (key, value) {
      if (!arguments.length) {
        app.emit('option', app.options)
        // option:getAll app.options
        return app.options
      }
      if (arguments.length === 1 && typeof key === 'string') {
        app.emit('option', app.options, key)
        // option:get key
        return get(app.options, key)
      }
      if (isObject(key)) {
        app.emit('option', app.options, key)
        // option:setAll key
        app.options = merge({}, app.options, key)
      } else {
        app.emit('option', app.options, key, value)
        // option:set key, value
        set(app.options, key, value)
      }
      return app.options
    }

and probably option:getAll, option:get, option:setAll and option:set?