<commit_before>function isABN(input, strictFormat) {
    if(strictFormat && !/^\d{2} \d{3} \d{3} \d{3}$/.test(input)) {
        return false;
    }

    var abnStr = input.replace(' ', '');

    if(abnStr.length !== 11) {
        return false;
    }

    var abn = abnStr.split('');
    var weight = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];

    var total = abn.reduce(function(prev, curr, i) {
        return prev + (parseInt(curr, 10) * weight[i]);
    }, 0);

    if(total % 89 === 0) {
        return true;
    }

    return false;
}<commit_msg>Support calling from browser or as node module<commit_after>'use strict';

(function() {
    var context = this;

    function isABN(input, strictFormat) {
        if(strictFormat && !/^\d{2} \d{3} \d{3} \d{3}$/.test(input)) {
            return false;
        }

        var abnStr = input.replace(' ', '');

        if(abnStr.length !== 11) {
            return false;
        }

        var abn = abnStr.split('');
        var weight = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];

        var total = abn.reduce(function(prev, curr, i) {
            return prev + (parseInt(curr, 10) * weight[i]);
        }, 0);

        if(total % 89 === 0) {
            return true;
        }

        return false;
    }


    if(typeof exports !== 'undefined') {
        if(typeof module !== 'undefined' && module.exports) {
            exports = module.exports = isABN;
        }

        exports.isABN = isABN;
    } else {
        context.isABN = isABN;
    }
}).call(this);
{'fraction_non_alphanumeric': 0.17293729372937294, 'fraction_numerical': 0.03828382838283828, 'mean_word_length': 1.8876190476190475, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3655708', 'n_tokens_mistral': 581, 'n_tokens_neox': 519, 'n_words': 131}