<commit_before>#include "test.hpp"
#include <string.h>

static Value firstarg_function(Value& fnc, Value& ths, Value& arg) {
	assert(ths.isGlobal() || ths.isUndefined());
	assert(fnc.isFunction());
	assert(arg.isArray());
	assert(arg.get("length").to<int>() > 0);
	return arg.get(0);
}

static Value exception_function(Value& fnc, Value& ths, Value& arg) {
	return firstarg_function(fnc, ths, arg).toException();<commit_msg>cxx_function: make sure all the arguments are not null<commit_after>#include "test.hpp"
#include <string.h>

static Value firstarg_function(Value& fnc, Value& ths, Value& arg) {
	assert(fnc.borrowCValue());
	assert(ths.borrowCValue());
	assert(arg.borrowCValue());

	assert(ths.isGlobal() || ths.isUndefined());
	assert(fnc.isFunction());
	assert(arg.isArray());
	assert(arg.get("length").to<int>() > 0);
	return arg.get(0);
}

static Value exception_function(Value& fnc, Value& ths, Value& arg) {
	return firstarg_function(fnc, ths, arg).toException();
{'fraction_non_alphanumeric': 0.17707267144319344, 'fraction_numerical': 0.0040941658137154556, 'mean_word_length': 6.700787401574803, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '2618738', 'n_tokens_mistral': 357, 'n_tokens_neox': 352, 'n_words': 74}