<commit_before>module.exports = (function Nfield () {
  
  var Promise = require('bluebird');
  
  var nfieldInstance;
  
  function createNfieldInstance (nfieldParams, requestParams) {
    
    var request;
    var nfieldOptions = nfieldParams || {};
    var requestOptions = requestParams || {};
    
  }
  
  return {
    init : function (nfieldParams, requestParams) {
      if (!nfieldInstance) {
        nfieldInstance = createNfieldInstance(nfieldParams, requestParams);
      }
      return nfieldInstance;
    }
  };
  
})();<commit_msg>Add signIn() and configure() methods to Nfield module<commit_after>module.exports = (function Nfield () {
  
  var Promise = require('bluebird');
  
  var nfieldInstance;
  
  function createNfieldInstance (nfieldParams, requestParams) {
    
    var request;
    var nfieldOptions = nfieldParams || {};
    var requestOptions = requestParams || {};
    
    function updateParams (nP, rP) {
      
      nfieldOptions = nP || nfieldOptions;
      requestOptions = rP || requestOptions;
      
      requestOptions.baseUrl = nfieldOptions.server || 'https://api.nfieldmr.com/';

      request = Promise.promisify(require('request').defaults(requestOptions));
      
    }

    function signIn (credentials, callback) {
      return request({
        method : 'post',
        uri : 'v1/SignIn',
        json : credentials
      }).nodeify(callback);
    }
    
    updateParams(nfieldOptions, requestOptions);
    
    return {
      configure : function publicConfigure (nP, rP) {
        updateParams(nP, rP);
      },
      signIn : function publicSignIn (cred, cb) {
        return signIn(cred, cb);
      }
    };
    
  }
  
  return {
    init : function (nfieldParams, requestParams) {
      if (!nfieldInstance) {
        nfieldInstance = createNfieldInstance(nfieldParams, requestParams);
      }
      return nfieldInstance;
    }
  };
  
})();
{'fraction_non_alphanumeric': 0.11157894736842106, 'fraction_numerical': 0.0005263157894736842, 'mean_word_length': 2.620952380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2071291', 'n_tokens_mistral': 557, 'n_tokens_neox': 554, 'n_words': 117}