<commit_before>/*
 * Paper.js
 *
 * This file is part of Paper.js, a JavaScript Vector Graphics Library,
 * based on Scriptographer.org and designed to be largely API compatible.
 * http://paperjs.org/
 * http://scriptographer.org/
 *
 * Copyright (c) 2011, <NAME> & <NAME>
 * http://lehni.org/ & http://jonathanpuckey.com/
 *
 * Distributed under the MIT license. See LICENSE file for details.
 *
 * All rights reserved.
 */

/**
 * @name HitResult
 *
 * @class A HitResult object contains information about the results of a hit
 * test. It is returned by {@link Item#hitTest(point)} and
 * {@link Project#hitTest(point)}.
 */
HitResult = Base.extend(/** @lends HitResult# */{
	initialize: function(type, item, values) {
		this.type = type;
		this.item = item;
		if (values) {
			// Copy over passed values, depending on use case.
			// DOCS: HitResult#location, #segment, #name, #point
			Base.each(values, function(value, key) {
				this[key] = value;
			}, this);
		}
	},

	/**
	 * Describes the type of the hit result. For example, if you hit a segment<commit_msg>Use inject() instead of a each() loop to add values to HitResult, so getters can be defined too (required for raster hit testing).<commit_after>/*
 * Paper.js
 *
 * This file is part of Paper.js, a JavaScript Vector Graphics Library,
 * based on Scriptographer.org and designed to be largely API compatible.
 * http://paperjs.org/
 * http://scriptographer.org/
 *
 * Copyright (c) 2011, <NAME> & <NAME>
 * http://lehni.org/ & http://jonathanpuckey.com/
 *
 * Distributed under the MIT license. See LICENSE file for details.
 *
 * All rights reserved.
 */

/**
 * @name HitResult
 *
 * @class A HitResult object contains information about the results of a hit
 * test. It is returned by {@link Item#hitTest(point)} and
 * {@link Project#hitTest(point)}.
 */
HitResult = Base.extend(/** @lends HitResult# */{
	initialize: function(type, item, values) {
		this.type = type;
		this.item = item;
		// Inject passed values, so we can be flexible about the HitResult
		// properties.
		// This allows the definition of getters too, e.g. for 'pixel'.
		if (values)
			this.inject(values);
	},

	/**
	 * Describes the type of the hit result. For example, if you hit a segment
{'fraction_non_alphanumeric': 0.13020134228187918, 'fraction_numerical': 0.0035794183445190158, 'mean_word_length': 3.3671875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5142176', 'n_tokens_mistral': 721, 'n_tokens_neox': 681, 'n_words': 257}