<commit_before>"use strict";

var Data = require("lazuli-data/index.js");

/**
* To represent a yes/no field
*/
module.exports = Data.Text.clone({
    id: "Boolean",
    css_type: "boolean",
    search_oper_list: "sy.search_oper_list_boolean",
    auto_search_oper: "",
    data_length: 1,
    // default_val: "N"
});


module.exports.override("resetVal", function () {
    Data.Text.resetVal.call(this);
    this.val = "N";
    this.orig_val = "N";
    this.prev_val = "N";
});


module.exports.define("beforeSet", function (val) {
    if (typeof val !== "string") {
        this.throwError("argument not string: " + this.owner.id + ":" + this.id);
    }
    if (val.length > 1) {
        val = val.substr(0, 1);
    }
    if (val === "") {
        val = "N";
    }
    return val;
});


module.exports.override("setFromParamValue", function (str) {
    try {
        str = str.replace(/\|/g, " ");
        str = Core.Format.parseDateExpressionToDate(str, this.update_format)
            .format(this.internal_format);
    } catch (e) {
        this.debug(e);
    }
    this.set(str);
});


module.exports.override("setInitial", function (new_val) {
    Data.Text.setInitial.call(this, this.beforeSet(new_val));
});


module.exports.override("set", function (new_val) {
    return Data.Text.set.call(this, this.beforeSet(new_val));
});<commit_msg>removing code copied and pasted<commit_after>"use strict";

var Data = require("lazuli-data/index.js");

/**
* To represent a yes/no field
*/
module.exports = Data.Text.clone({
    id: "Boolean",
    css_type: "boolean",
    search_oper_list: "sy.search_oper_list_boolean",
    auto_search_oper: "",
    data_length: 1,
    // default_val: "N"
});


module.exports.override("resetVal", function () {
    Data.Text.resetVal.call(this);
    this.val = "N";
    this.orig_val = "N";
    this.prev_val = "N";
});


module.exports.define("beforeSet", function (val) {
    if (typeof val !== "string") {
        this.throwError("argument not string: " + this.owner.id + ":" + this.id);
    }
    if (val.length > 1) {
        val = val.substr(0, 1);
    }
    if (val === "") {
        val = "N";
    }
    return val;
});


module.exports.override("setInitial", function (new_val) {
    Data.Text.setInitial.call(this, this.beforeSet(new_val));
});


module.exports.override("set", function (new_val) {
    return Data.Text.set.call(this, this.beforeSet(new_val));
});
{'fraction_non_alphanumeric': 0.18249688925756946, 'fraction_numerical': 0.0033181252592285357, 'mean_word_length': 3.006644518272425, 'pattern_counts': {'":': 2, '<': 3, '<?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': '4402607', 'n_tokens_mistral': 855, 'n_tokens_neox': 838, 'n_words': 152}