<commit_before>angular.module('app').directive("validateBitcoinAddress", function() {
    return {
        require: 'ngModel',
        link: function(scope, ele, attrs, ctrl) {

            ctrl.$parsers.unshift(function(value) {

                // test and set the validity after update.
                var valid = window.bitcoinAddress.validate(value);
                ctrl.$setValidity('validateBitcoinAddress', valid);

                // if it's valid, return the value to the model,
                // otherwise return undefined.
                return valid ? value : undefined;
            });

            ctrl.$formatters.unshift(function(value) {
                // validate.
                ctrl.$setValidity('validateBitcoinAddress', window.bitcoinAddress.validate(value));

                // return the value or nothing will be written to the DOM.
                return value;
            });


        }
    };

});<commit_msg>Clean up comments and validity check<commit_after>angular.module('app').directive("validateBitcoinAddress", function() {
    return {
        require: 'ngModel',
        link: function(scope, ele, attrs, ctrl) {

            ctrl.$parsers.unshift(function(value) {
                var valid = window.bitcoinAddress.validate(value);
                ctrl.$setValidity('validateBitcoinAddress', valid);
                return valid ? value : undefined;
            });

            ctrl.$formatters.unshift(function(value) {
                var valid = window.bitcoinAddress.validate(value);
                ctrl.$setValidity('validateBitcoinAddress', valid);
                return value;
            });


        }
    };

});
{'fraction_non_alphanumeric': 0.1118421052631579, 'fraction_numerical': 0.0, 'mean_word_length': 1.850085178875639, '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': '119904', 'n_tokens_mistral': 424, 'n_tokens_neox': 395, 'n_words': 89}