<commit_before>define([
    'jquery',
    'angular'
], function($, angular) {
    'use strict';

    var wrapper = function(methodName) {
        var interval = 1000;
        var func = _[methodName];

        return {
            require: ['ngModel'],
            link: function($scope, element, attrs, ctrl) {
                if (attrs.interval !== '' && attrs.interval !== undefined) {
                    interval = attrs.interval;
                }
                element.unbind('input').unbind('keydown').unbind('change');
                element.bind('input', func(function() {
                    $scope.$apply(function() {
                        ctrl[0].$setViewValue(element.val());
                    });
                }, interval));
            }
        };
    };

    
    angular.module('superdesk.directives')
        /**
         * sdDebounce debounces model update.
         *
         * Usage:
         * <input sd-debounce data-interval="1500" ng-model="keyword">
         *
         * Params:
         * @param {number} interval
         * @param {object} ngModel
         */
        .directive('sdDebounce', function() {
            return wrapper('debounce');
        }).

        /**
         * sdThrottle throttles model update.
         *
         * Usage:
         * <input sd-throttle data-interval="1500" ng-model="keyword">
         *
         * Params:
         * @param {number} interval
         * @param {object} ngModel
         */
        .directive('sdThrottle', function() {
            return wrapper('throttle');
        });
});<commit_msg>Fixed minor problems.<commit_after>define([
    'jquery',
    'angular'
], function($, angular) {
    'use strict';

    var wrapper = function(methodName) {
        var interval = 1000;
        var func = _[methodName];

        return {
            require: ['ngModel'],
            link: function($scope, element, attrs, ctrl) {
                if (attrs.interval !== '' && attrs.interval !== undefined) {
                    interval = attrs.interval;
                }
                element.unbind('input').unbind('keydown').unbind('change');
                element.bind('input', func(function() {
                    $scope.$apply(function() {
                        ctrl[0].$setViewValue(element.val());
                    });
                }, interval));
            }
        };
    };

    
    angular.module('superdesk.directives').
        /**
         * sdDebounce debounces model update.
         *
         * Usage:
         * <input sd-debounce data-interval="1500" ng-model="keyword">
         *
         * Params:
         * @param {number} interval
         * @param {object} ngModel
         */
        directive('sdDebounce', function() {
            return wrapper('debounce');
        }).

        /**
         * sdThrottle throttles model update.
         *
         * Usage:
         * <input sd-throttle data-interval="1500" ng-model="keyword">
         *
         * Params:
         * @param {number} interval
         * @param {object} ngModel
         */
        directive('sdThrottle', function() {
            return wrapper('throttle');
        });
});
{'fraction_non_alphanumeric': 0.1422725841989298, 'fraction_numerical': 0.008183821214982689, 'mean_word_length': 1.4427363566487317, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2976668', 'n_tokens_mistral': 881, 'n_tokens_neox': 828, 'n_words': 156}