Chickadee Class
Hyperlocal context associations store and API.
@param {Object} options The options as a JSON object.
@constructor
198117
function Chickadee(options) {
  var self = this;
  options = options || {};

  self.associations = options.associationManager ||
                      new associationManager(options);

  self.routes = {
    "/associations": require('./routes/associations'),
    "/contextat": require('./routes/contextat'),
    "/contextnear": require('./routes/contextnear'),
    "/": express.static(path.resolve(__dirname + '/../web'))
  };

  console.log("reelyActive Chickadee instance is curious to associate metadata in an open IoT");
}
537369
function(class_json, opts) {
	var options = util.extend({
		javascript: false, // true, false
		scope: '', // directory to look for initial file
		variables: {
			// contains a key->value object with variables to @extends
		}
	}, opts);

	// Stores JSON objects of files that have to be merged together:
	// ["a", "b"]
	var file_list = util.isArray(class_json[indicators.EXTENDS]) ?
		class_json[indicators.EXTENDS] :
		class_json[indicators.EXTENDS] != null ?
			[ class_json[indicators.EXTENDS] ] :
			[];

	// Delete @extends from base_json to avoid infinitive recursion
	delete class_json[indicators.EXTENDS];

	// Push class_json to the path list:
	file_list.push(class_json);

	/*****************************************************************************
	*  Merge file by file
	*****************************************************************************/

	// default config for each file required:
	// set asText = false so we get an object returned
	// set scope = file's directory so there can be relative references
	var json_config = util.defaults({
		asText: false,
		scope: options._as ? path.dirname(file_path) : options.scope,

		// _as is a hack so that we know its we are calling the function recursive
		_as: ANTI_SANITIZER
	}, options);

	// super_json is our output, start by containing first file in array
	var super_json = fromFile(file_list.shift(), json_config);

	// TODO: Figure out when to sanitize super_json hopefully we don't have to
	//   santize all returns. I'm not sure about this, and I'm not sure if we
	//   can even sanitize super_json when we return it.
	//   Is super_json used by anyone recursively?

	while (file_list.length) {
		var json = fromFile(file_list.shift(), json_config);

		merge(super_json, json);
	}

	// If this file is called from the outside eg json_merger.from...
	//   File('file_which_doesnt_extends_another_file.json')
	//   we need to sanitize the file and remove all indicators
	if (options._as != ANTI_SANITIZER) {
		super_json = util.sanitizeValue(super_json);
	}

	/*****************************************************************************
	*  Return super_json
	*****************************************************************************/

	return super_json;
}
1354891
function (options) {
  if (!(this instanceof Store)) {
    return new Store(options)
  }

  this._opts = options || {}
  this.db = new Datastore({ filename: this._opts.filename, autoload: true })
}
165010
function (options) {
  if (typeof options === 'string') {
    options = {
      path: options
    };
  }

  options = ul.merge(options, {
    path: './'
  });

  options.path = path.resolve(options.path);

  this.options = options;
  this.cwd = options.path;
}
956665
function init(options) {

    var fs = require('fs');
    var path = require('path');
    var rootdir = path.dirname(require.main);
    var options = options || {
        config: require(path.join(rootdir, 'config.json')),
        root: rootdir,
        callback: function (noop) {}
    };
    var def = {};
    function ModulePaths (moduledir) {
        this.moduledir = moduledir;
    }

    ModulePaths.prototype.then = function (accept, reject) {
      var moduledir = this.moduledir;
      fs.readdir(moduledir, function (err, files) {
        if (err) reject(err);
        files.forEach(function (file) {
            var name = path.basename(file, '.js');
            def[name] = path.join(moduledir, name);
        });
        accept();
      });
    };
    var pubpath = new ModulePaths(path.join(path.dirname(module.filename), '..', 'public', 'js'));
    var prvpath = new ModulePaths(path.join(path.dirname(module.filename), '..', 'private', 'js'));

    Promise.all([pubpath, prvpath])
        .then(function () {
            var requirejs = require('requirejs');
            requirejs.config({
                baseUrl: path.join(rootdir),
                paths: def
            });

            requirejs(['loader_factory'], function (LoaderFactory) {
                var fs = require('fs');
                var config = options.config;
                config.paths.push(path.dirname(pubpath.moduledir));
                var loader = 'loader_express';
                var db = 'db_mongo';
                if (config.loader) loader = config.loader;
                if (config.db) db = config.db;

                new LoaderFactory().create(loader, db, function (loader) {
                    loader.init(config, options.callback);
                });
            });
        })
    .catch(function (err) {
        console.error('err:', err);
    });
}
1075443
async function storeOptions(options){
    await _fs.writeFile(_configFilename, JSON.stringify(options, null, 4));
}
737974
function LokiStore (options) {
    if (!(this instanceof LokiStore)) {
      throw new TypeError('Cannot call LokiStore constructor as a function')
    }

    let self = this

    // Parse options

    options = options || {}
    Store.call(this, options)

    this.autosave = options.autosave !== false
    this.storePath = options.path || './session-store.db'
    this.ttl = options.ttl || 1209600
    if (this.ttl === 0) { this.ttl = null }

    // Initialize Loki.js

    this.client = new Loki(this.storePath, {
      env: 'NODEJS',
      autosave: self.autosave,
      autosaveInterval: 5000
    })

    // Setup error logging

    if (options.logErrors) {
      if (typeof options.logErrors !== 'function') {
        options.logErrors = function (err) {
          console.error('Warning: connect-loki reported a client error: ' + err)
        }
      }
      this.logger = options.logErrors
    } else {
      this.logger = _.noop
    }

    // Get / Create collection

    this.client.loadDatabase({}, () => {
      self.collection = self.client.getCollection('Sessions')
      if (_.isNil(self.collection)) {
        self.collection = self.client.addCollection('Sessions', {
          indices: ['sid'],
          ttlInterval: self.ttl
        })
      }
      self.collection.on('error', (err) => {
        return self.logger(err)
      })
      self.emit('connect')
    })
  }
28327
function (app) {
    this.options = this.options || {}
    this.options.babel = this.options.babel || {}
    this.options.babel.optional = this.options.babel.optional || []

    if (this.options.babel.optional.indexOf('es7.decorators') === -1) {
      this.options.babel.optional.push('es7.decorators')
    }

    /* eslint-disable no-unused-expressions */
    this._super.init && this._super.init.apply(this, arguments)
    /* eslint-enable no-unused-expressions */
  }
711611
function createOptions( options ) {
    var object = optionsCache[ options ] = {};
    _each( options.split( /\s+/ ), function( flag ) {
      object[ flag ] = true;
    });
    return object;
  }
593124
function(options)
	{
		options = conbo.clone(options || {});
		options.app = this;
		
		this.context = new this.contextClass(options);
	}
1029195
function(options)
{
    if ('undefined' === typeof options) {
        throw new Error('No options defined');
    }

    this.path    = options.path || null;
    this.default = options.default || {};
    this.values  = options.values || {};

    if (options.default && options.values) {
        this.merge(options.values);
    }

    if (this.path) {
        this.load();
    }
}
768668
function(options){
        this.type = options.type || EJS.type;
		this.cache = options.cache != null ? options.cache : EJS.cache;
		this.text = options.text || null;
		this.name =  options.name || null;
		this.ext = options.ext || EJS.ext;
		this.extMatch = new RegExp(this.ext.replace(/\./, '\.'));
	}
631694
function NjsCompiler(options) {
    this.nodeSequence = 0;
    this.options = options || {};
    if (!this.options.runtime) {
        this.options.runtime = 'njs';
    }
    this.parseBooleanOptions("exceptions", true);
}
989147
function CanaryStore() {
  var self = this;
  EventEmitter.call(self);
  var counter = self._counter = new Counter();
  counter.on('resource', self._onresource.bind(self));

  self._id = 0;
  self._variants = {};
  self._callbacks = {};
  self._assigners = [];
  self._assignments = {};
  self._overrides = {};
  self._pending = 0;

  // create a global context for simple cases
  var context = this._globalContext = this.context(this.emit.bind(this, 'change'));
  this.get = context.get.bind(context);
  this.start = context.start.bind(context);
  this.stop = context.stop.bind(context);
}
1157991
function (options) {
        options = options || {};
        var qs = '';
        if (typeof options === 'string') {
            qs = options;
            options = this.parseOptions(qs);
        }

        for (var key in options) {
            if (!(key in DEFAULT_OPTIONS)) {
                throw new Error('No such option.');
            }
        }
        if (qs.length && !Object.keys(options).length) {
            throw new Error('Invalid argument syntax.');
        }

        this.options = extend(DEFAULT_OPTIONS, options);
    }
152097
function createOptions( options ) {
	var object = optionsCache[ options ] = {};
	jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
		object[ flag ] = true;
	});
	return object;
}
1327572
function(options, zookeeperOptions) {
    EventEmitter.call(this);

    this.modules = {};
    this.middlewares = [];

    this.options = options || {};
    this.zookeeperOptions = zookeeperOptions || {};

    this.zookeeper = undefined;
    if(this.zookeeperOptions && Object.keys(this.zookeeperOptions).length) {
        this.zookeeper = new Zookeeper(
            this.zookeeperOptions.connectString,
            this.zookeeperOptions,
            this.zookeeperOptions.root,
            this.zookeeperOptions.prefix);
    }

    this.server = helper.createServer(options, this._onClientConnected.bind(this));
}