<commit_before>'use strict';

var isCopy      = require('es5-ext/lib/Array/prototype/is-copy')
  , d           = require('es5-ext/lib/Object/descriptor')
  , makeEl      = require('dom-ext/lib/Document/prototype/make-element')
  , Db          = require('dbjs')
  , DOMRadio    = require('./_controls/radio')
  , DOMCheckbox = require('./_controls/checkbox')

  , isArray = Array.isArray
  , BooleanType = Db.Boolean
  , Radio, Checkbox, arrResult = ['0', '1'].sort();

Radio = function (document, ns/*, options*/) {
	var trueText, falseText, tOption, fOption, options = Object(arguments[2]);
	DOMRadio.call(this, document, ns, options);
	this.relation = options && options.relation;
	trueText = (this.relation && this.relation.__trueLabel.__value) ?
			this.relation._trueLabel.toDOM(document) : ns._trueLabel.toDOM(document);
	falseText = (this.relation && this.relation.__falseLabel.__value) ?
			this.relation._falseLabel.toDOM(document) :
			ns._falseLabel.toDOM(document);
	tOption = this.createOption('1', trueText);
	fOption = this.createOption('0', falseText);

	if (Number(options.order) < 0) {
		this.dom.appendChild(fOption);
		this.dom.appendChild(document.createTextNode(' '));
		this.dom.appendChild(tOption);
	} else {
		this.dom.appendChild(tOption);
		this.dom.appendChild(document.createTextNode(' '));
		this.dom.appendChild(fOption);
	}
	this.trueInput = this.items['1'];
	this.trueInput.setAttribute('data-type', 'boolean');
	this.falseInput = this.items['0'];
	this.falseInput.setAttribute('data-type', 'boolean');
	this.castKnownAttributes(options);
};

Radio.prototype = Object.create(DOMRadio.prototype, {
	constructor: d(Radio),
	value: d.gs(function () {
		if (this.trueInput.checked) return true;
		else if (this.falseInput.checked) return false;<commit_msg>Support true and false labels via options<commit_after>'use strict';

var isCopy      = require('es5-ext/lib/Array/prototype/is-copy')
  , d           = require('es5-ext/lib/Object/descriptor')
  , makeEl      = require('dom-ext/lib/Document/prototype/make-element')
  , Db          = require('dbjs')
  , DOMRadio    = require('./_controls/radio')
  , DOMCheckbox = require('./_controls/checkbox')

  , isArray = Array.isArray
  , BooleanType = Db.Boolean
  , Radio, Checkbox, arrResult = ['0', '1'].sort();

Radio = function (document, ns/*, options*/) {
	var trueText, falseText, tOption, fOption, options = Object(arguments[2]);
	DOMRadio.call(this, document, ns, options);
	this.relation = options && options.relation;
	if (options.trueLabel) {
		trueText = options.trueLabel;
	} else if (this.relation && this.relation.__trueLabel.__value) {
		trueText = this.relation._trueLabel.toDOM(document);
	} else {
		trueText = ns._trueLabel.toDOM(document);
	}
	if (options.falseLabel) {
		falseText = options.falseLabel;
	} else if (this.relation && this.relation.__falseLabel.__value) {
		falseText = this.relation._falseLabel.toDOM(document);
	} else {
		falseText = ns._falseLabel.toDOM(document);
	}
	tOption = this.createOption('1', trueText);
	fOption = this.createOption('0', falseText);

	if (Number(options.order) < 0) {
		this.dom.appendChild(fOption);
		this.dom.appendChild(document.createTextNode(' '));
		this.dom.appendChild(tOption);
	} else {
		this.dom.appendChild(tOption);
		this.dom.appendChild(document.createTextNode(' '));
		this.dom.appendChild(fOption);
	}
	this.trueInput = this.items['1'];
	this.trueInput.setAttribute('data-type', 'boolean');
	this.falseInput = this.items['0'];
	this.falseInput.setAttribute('data-type', 'boolean');
	this.castKnownAttributes(options);
};

Radio.prototype = Object.create(DOMRadio.prototype, {
	constructor: d(Radio),
	value: d.gs(function () {
		if (this.trueInput.checked) return true;
		else if (this.falseInput.checked) return false;
{'fraction_non_alphanumeric': 0.16274768824306474, 'fraction_numerical': 0.005284015852047556, 'mean_word_length': 4.551319648093842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1497705', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1223, 'n_words': 207}