<commit_before>/**
 * Dependencies
 */

// Third party libraries
var debug = require('debug')('wakizashi');
var merge = require('merge-descriptors');

// Wakizashi libraries
var domoweb = require('./domoweb');
var auth = require('./auth');
var dataset = require('./dataset');

/**
 * Expose `createInstance()`
 */

exports = module.exports = createInstance;

/**
 * Create a new instance of Wakizashi. Pass in a Domo Developer API Token
 *
 * @paran token
 * @return {Function}
 * @api public
 */

function createInstance(instance, token)
{

	// Store globally-accessible settings
	this.settings = {

		// Authentication details
		_authtoken: token,
		_instance: instance,

		// The DataSource Type to upload as
		// This can be overridden per create
		_type: "Wakizashi"
	};

	// Create empty container function
	var app = function(){};

	// Add in library functions
	merge(app, domoweb, false);
	merge(app, auth, false);
	merge(app, dataset, false);

	// And away we go!
	return app; 

}<commit_msg>Adding option to configure with .creds file, and including dataflow module<commit_after>/* global process */
/**
 * Dependencies
 */

// Third party libraries
var debug = require('debug')('wakizashi');
var merge = require('merge-descriptors');
var fs = require('fs');

// Wakizashi libraries
var domoweb = require('./domoweb');
var auth = require('./auth');
var dataset = require('./dataset');
var dataflow = require('./dataflow');

/**
 * Expose `createInstance()`
 */

exports = module.exports = createInstance;

/**
 * Create a new instance of Wakizashi. Pass in a Domo Developer API Token
 *
 * @paran token
 * @return {Function}
 * @api public
 */

function createInstance(instance, token)
{
	
	// Look for a credentials file
	if (instance == null || token == null)
	{
		try {
			var credFile = fs.readFileSync(".creds", 'utf8');
			var creds = JSON.parse(credFile);
			token = creds.token;
			instance = creds.instance;
		}
		catch(error)
		{
			console.log("Not configured! Create a .creds file in the root folder.");
		}
		
	}

	// Store globally-accessible settings
	this.settings = {

		// Authentication details
		_authtoken: token,
		_instance: instance,

		// The DataSource Type to upload as
		// This can be overridden per create
		_type: "Wakizashi"
	};

	// Create empty container function
	var app = function(){};

	// Add in library functions
	merge(app, domoweb, false);
	merge(app, auth, false);
	merge(app, dataset, false);
	merge(app, dataflow, false);

	// And away we go!
	return app; 

}
{'fraction_non_alphanumeric': 0.14001591089896578, 'fraction_numerical': 0.0003977724741447892, 'mean_word_length': 3.5644283121597096, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3464362', 'n_tokens_mistral': 831, 'n_tokens_neox': 773, 'n_words': 252}