<commit_before>'use strict';

var genId = require('time-uuid')

  , slice = Array.prototype.slice;

module.exports = function (domjs) {
	var form = domjs.form, p = domjs.p, button = domjs.button
	  , script = domjs.script;

	return function (attrs) {
		var id, confirm, message, value;
		attrs = Object(attrs);
		if (!attrs.hasOwnProperty('method')) attrs.method = 'post';
		if (!attrs.hasOwnProperty('id')) attrs.id = 'form-' + genId();
		id = String(attrs.id);
		if (attrs.confirm) {
			confirm = true;
			message = (attrs.confirm === true) ? null : String(attrs.confirm);
			delete attrs.confirm;
		}
		value = attrs.value;
		delete attrs.value;
		return [form(attrs,
			p(button({ type: 'submit' }, value), slice.call(arguments, 1))),
			confirm && script(function (formId, message) {
				$.confirmSubmit(formId, message);
			}, id, message)];
	};
};<commit_msg>Better options handling in postButton<commit_after>'use strict';

var genId = require('time-uuid')

  , slice = Array.prototype.slice;

module.exports = function (domjs) {
	var form = domjs.form, p = domjs.p, button = domjs.button
	  , script = domjs.script;

	return function (attrs) {
		var id, confirm, message, value, formAttrs = {};
		attrs = Object(attrs);
		formAttrs.method = attrs.hasOwnProperty('method') ? attrs.method : 'post';
		delete attrs.method;
		id = formAttrs.id =
			String(attrs.hasOwnProperty('id') ? attrs.id : 'form-' + genId());
		delete attrs.id;
		formAttrs.action = attrs.action;
		delete attrs.action;

		if (attrs.confirm) {
			confirm = true;
			message = (attrs.confirm === true) ? null : String(attrs.confirm);
			delete attrs.confirm;
		}
		value = attrs.value;
		delete attrs.value;
		attrs.type = 'submit';
		return [form(formAttrs,
			p(button(attrs, value), slice.call(arguments, 1))),
			confirm && script(function (formId, message) {
				$.confirmSubmit(formId, message);
			}, id, message)];
	};
};
{'fraction_non_alphanumeric': 0.16369359916054566, 'fraction_numerical': 0.001049317943336831, 'mean_word_length': 3.877237851662404, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4461511', 'n_tokens_mistral': 695, 'n_tokens_neox': 643, 'n_words': 154}