<commit_before>(function($) {
    var defaults = {}
    $.fn.pos = function(options) {
        //define instance for use in child functions
        var $this = $(this);
	var data = {
		scan: '',
		swipe: ''
	};
        //set default options
        defaults = {
            scan: true,
            swipe: true,
            events: {
                scan: {
                    barcode: 'scan.pos.barcode'
                },
                swipe: {
                    card: 'swipe.pos.card'
                }
            },
            regexp: {
                scan: {
                    barcode: '\\d+'
                },
                swipe: {
                    card: '\\%B(\\d+)\\^(\\w+)\\/(\\w+)\\^\\d+\\?;\\d+=(\\d\\d)(\\d\\d)\\d+\\?'
                }
            },
            prefix: {
                scan: {
                    barcode: ''
                },
                swipe: {
                    card: ''
                }
            }
        };
        //extend options
        $this.options = $.extend(true, {}, defaults, options);

        $this.keypress(function(event) {
            if ($this.options.scan) {
                if (event.which == 13) {
                    var scanexp = new RegExp('^' + $this.options.prefix.scan.barcode + $this.options.regexp.scan.barcode + '$');
                    if (defaults.data.scan.match(scanexp)) {
                        $this.trigger({
                            type: $this.options.events.scan.barcode,
                            code: data.scan,
                            time: new Date()
                        });
                    }
                    data.scan = '';
                } else {
                    var char = String.fromCharCode(event.which);
                    data.scan += char;
                }
            }

            if ($this.options.swipe) {
                if (event.which == 13) {
                    var swipexp = new RegExp('^' + $this.options.prefix.swipe.card + $this.options.regexp.swipe.card + '$');
                    if (data.swipe.match(swipexp)) {
                        var swipe_match = swipexp.exec(data.swipe);<commit_msg>fixed old ref to defaults.data<commit_after>(function($) {
    var defaults = {}
    $.fn.pos = function(options) {
        //define instance for use in child functions
        var $this = $(this);
	var data = {
		scan: '',
		swipe: ''
	};
        //set default options
        defaults = {
            scan: true,
            swipe: true,
            events: {
                scan: {
                    barcode: 'scan.pos.barcode'
                },
                swipe: {
                    card: 'swipe.pos.card'
                }
            },
            regexp: {
                scan: {
                    barcode: '\\d+'
                },
                swipe: {
                    card: '\\%B(\\d+)\\^(\\w+)\\/(\\w+)\\^\\d+\\?;\\d+=(\\d\\d)(\\d\\d)\\d+\\?'
                }
            },
            prefix: {
                scan: {
                    barcode: ''
                },
                swipe: {
                    card: ''
                }
            }
        };
        //extend options
        $this.options = $.extend(true, {}, defaults, options);

        $this.keypress(function(event) {
            if ($this.options.scan) {
                if (event.which == 13) {
                    var scanexp = new RegExp('^' + $this.options.prefix.scan.barcode + $this.options.regexp.scan.barcode + '$');
                    if (data.scan.match(scanexp)) {
                        $this.trigger({
                            type: $this.options.events.scan.barcode,
                            code: data.scan,
                            time: new Date()
                        });
                    }
                    data.scan = '';
                } else {
                    var char = String.fromCharCode(event.which);
                    data.scan += char;
                }
            }

            if ($this.options.swipe) {
                if (event.which == 13) {
                    var swipexp = new RegExp('^' + $this.options.prefix.swipe.card + $this.options.regexp.swipe.card + '$');
                    if (data.swipe.match(swipexp)) {
                        var swipe_match = swipexp.exec(data.swipe);
{'fraction_non_alphanumeric': 0.14437760296159186, 'fraction_numerical': 0.0018509949097639982, 'mean_word_length': 0.8673866090712743, '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': '7339432', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1140, 'n_words': 197}