<commit_before>package lime.utils;

#if (js && !doc_gen)
typedef ArrayBuffer = #if haxe4 js.lib.ArrayBuffer #else js.html.ArrayBuffer #end;
#else
import haxe.io.Bytes;

@:forward
abstract ArrayBuffer(Bytes) from Bytes to Bytes
#if doc_gen from Dynamic to Dynamic
#end
{
	public inline function new(byteLength:Int)
	{
		this = Bytes.alloc(byteLength);
	}
}
#end // !js
<commit_msg>Implement missing ArrayBuffer methods/properties<commit_after>package lime.utils;

#if (js && !doc_gen)
typedef ArrayBuffer = #if haxe4 js.lib.ArrayBuffer #else js.html.ArrayBuffer #end;
#else
import haxe.io.Bytes;

@:forward
abstract ArrayBuffer(Bytes) from Bytes to Bytes
#if doc_gen from Dynamic to Dynamic
#end
{
	public var byteLength(get, never):Int;
	private inline function get_byteLength() { return this.length; }

	public inline function new(byteLength:Int)
	{
		this = Bytes.alloc(byteLength);
	}

	public static inline function isView(arg:Dynamic):Bool
	{
		return (arg != null && Std.is(arg, ArrayBufferView));
	}

	public inline function slice(begin:Int, end:Null<Int> = null)
	{
		if (end == null) end = this.length;
		if (begin < 0) begin = 0;
		if (end > this.length) end = this.length;
		var length = end - begin;
		if (begin < 0 || length <= 0)
		{
			return new ArrayBuffer(0);
		}
		else
		{
			var bytes = Bytes.alloc(length);
			bytes.blit(0, this, begin, length);
			return cast bytes;
		}
	}
}
#end // !js

{'fraction_non_alphanumeric': 0.12756909992912827, 'fraction_numerical': 0.005669737774627924, 'mean_word_length': 4.172161172161172, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5260834', 'n_tokens_mistral': 536, 'n_tokens_neox': 494, 'n_words': 143}