<commit_before>#include <nan.h>
#include "functions.h"

NAN_METHOD(nothing) {
    NanScope();
    NanReturnUndefined();
}

NAN_METHOD(aString) {
    NanScope();
    NanReturnValue(NanNew<v8::String>("This is a thing."));
}

NAN_METHOD(aBoolean) {
    NanScope();
    NanReturnValue(NanFalse());
}

NAN_METHOD(aNumber) {
    NanScope();
    NanReturnValue(NanNew<v8::Number>(1.75));
}

NAN_METHOD(anObject) {
    NanScope();
    v8::Local<v8::Object> obj = NanNew<v8::Object>();
    obj->Set(NanNew<v8::String>("key"), NanNew<v8::String>("value")); 
    NanReturnValue(obj);
}

NAN_METHOD(anArray) {
    NanScope();
    v8::Local<v8::Array> arr = NanNew<v8::Array>(3);
    arr->Set(0, NanNew<v8::Number>(1));
    arr->Set(1, NanNew<v8::Number>(2));
    arr->Set(2, NanNew<v8::Number>(3));
    NanReturnValue(arr);
}

NAN_METHOD(callback) {
    NanScope();

    v8::Local<v8::Function> callbackHandle = args[0].As<v8::Function>();
    NanCallback *callback = new NanCallback(callbackHandle);

    callback->Call(0, NULL);

    delete callback;

  NanReturnUndefined();
}<commit_msg>Simplify callback example<commit_after>#include <nan.h>
#include "functions.h"

NAN_METHOD(nothing) {
    NanScope();
    NanReturnUndefined();
}

NAN_METHOD(aString) {
    NanScope();
    NanReturnValue(NanNew<v8::String>("This is a thing."));
}

NAN_METHOD(aBoolean) {
    NanScope();
    NanReturnValue(NanFalse());
}

NAN_METHOD(aNumber) {
    NanScope();
    NanReturnValue(NanNew<v8::Number>(1.75));
}

NAN_METHOD(anObject) {
    NanScope();
    v8::Local<v8::Object> obj = NanNew<v8::Object>();
    obj->Set(NanNew<v8::String>("key"), NanNew<v8::String>("value")); 
    NanReturnValue(obj);
}

NAN_METHOD(anArray) {
    NanScope();
    v8::Local<v8::Array> arr = NanNew<v8::Array>(3);
    arr->Set(0, NanNew<v8::Number>(1));
    arr->Set(1, NanNew<v8::Number>(2));
    arr->Set(2, NanNew<v8::Number>(3));
    NanReturnValue(arr);
}

NAN_METHOD(callback) {
    NanScope();
    v8::Local<v8::Function> callbackHandle = args[0].As<v8::Function>();
    NanMakeCallback(NanGetCurrentContext()->Global(), callbackHandle, 0, NULL);
    NanReturnUndefined();
}
{'fraction_non_alphanumeric': 0.20009350163627865, 'fraction_numerical': 0.026180458158017766, 'mean_word_length': 4.944444444444445, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 41, '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': '169623', 'n_tokens_mistral': 869, 'n_tokens_neox': 808, 'n_words': 104}