<commit_before>#define UNICODE
#include <iostream>
#include <string>

#include <node.h>
#include "nan.h"

using namespace v8;


#ifdef _WIN32
#define SECURITY_WIN32
#include <windows.h>
#include <security.h>
#include <secext.h>
#include <lmcons.h>
#include <tchar.h>
NAN_METHOD(name) {
	NanScope();

	TCHAR username[UNLEN+1];
	ULONG size = sizeof(username);

	if (GetUserNameEx(NameDisplay, username, &size) != 0) {
		NanReturnValue(String::New((uint16_t*)username, wcslen(username)));
	}

	NanReturnNull();
}
#else
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
NAN_METHOD(name) {
	NanScope();

	struct passwd *pw = getpwuid(getuid());

	if (pw != NULL && pw->pw_gecos != NULL && strlen(pw->pw_gecos) > 0) {
		std::string gecos(pw->pw_gecos);

		// get everything before the first comma
		// since `gecos` is defined as a comma seperated list
		std::string name = gecos.substr(0, gecos.find(",", 0));

		if (name.length() > 0) {
			NanReturnValue(String::New(gecos.c_str()));
		}
	}

	NanReturnNull();
}
#endif

void init(Handle<Object> exports, Handle<Object> module) {
	NODE_SET_METHOD(module, "exports", name);
}

NODE_MODULE(binding, init)<commit_msg>add support for Node 0.12 and iojs<commit_after>#define UNICODE
#include <iostream>
#include <string>

#include <node.h>
#include <nan.h>

using namespace v8;


#ifdef _WIN32
#define SECURITY_WIN32
#include <windows.h>
#include <security.h>
#include <secext.h>
#include <lmcons.h>
#include <tchar.h>
NAN_METHOD(name) {
	NanScope();

	TCHAR username[UNLEN+1];
	ULONG size = sizeof(username);

	if (GetUserNameEx(NameDisplay, username, &size) != 0) {
		NanReturnValue(NanNew<String>((uint16_t*)username, wcslen(username)));
	}

	NanReturnNull();
}
#else
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
NAN_METHOD(name) {
	NanScope();

	struct passwd *pw = getpwuid(getuid());

	if (pw != NULL && pw->pw_gecos != NULL && strlen(pw->pw_gecos) > 0) {
		std::string gecos(pw->pw_gecos);

		// get everything before the first comma
		// since `gecos` is defined as a comma seperated list
		std::string name = gecos.substr(0, gecos.find(",", 0));

		if (name.length() > 0) {
			NanReturnValue(NanNew<String>(gecos.c_str()));
		}
	}

	NanReturnNull();
}
#endif

void init(Handle<Object> exports, Handle<Object> module) {
	NODE_SET_METHOD(module, "exports", name);
}

NODE_MODULE(binding, init)
{'fraction_non_alphanumeric': 0.16871035940803383, 'fraction_numerical': 0.01226215644820296, 'mean_word_length': 5.161458333333333, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 42, 'https://': 0, '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': '7602639', 'n_tokens_mistral': 983, 'n_tokens_neox': 913, 'n_words': 205}