<commit_before>(function () {

    'use strict';
    var mainModule = angular.module('ui.sortable');

    /**
     * Controller for Sortable.
     * @param $scope - the sortable scope.
     */
    mainModule.controller('sortableController', ['$scope', function ($scope) {

        this.scope = $scope;

        $scope.modelValue = null; // sortable list.
        $scope.callbacks = null;
        $scope.type = 'sortable';

        /**
         * Inserts the item in to the sortable list.
         *
         * @param index - the item index.
         * @param itemData - the item model data.
         */
        $scope.insertItem = function (index, itemData) {
            $scope.safeApply(function () {
                $scope.modelValue.splice(index, 0, itemData);
            });
        };

        /**
         * Removes the item from the sortable list.
         *
         * @param index - index to be removed.
         * @returns {*} - removed item.
         */
        $scope.removeItem = function (index) {
            var removedItem = null;
            if (index > -1) {
                $scope.safeApply(function () {
                    removedItem = $scope.modelValue.splice(index, 1)[0];
                });
            }
            return removedItem;
        };

        /**
         * Checks whether the sortable list is empty.
         *
         * @returns {null|*|$scope.modelValue|boolean}
         */
        $scope.isEmpty = function () {
            return ($scope.modelValue && $scope.modelValue.length === 0);
        };

        /**
         * Wrapper for the accept callback delegates to callback.
         *
         * @param sourceItemScope - drag item scope
         * @param destScope - sortable target scope.
         * @returns {*|boolean} - true if drop is allowed for the drag item in drop target.
         */
        $scope.accept = function (sourceItemScope, destScope) {
            return $scope.callbacks.accept(sourceItemScope, destScope);
        };

        /**
         * Checks the current phase before executing the function.
         *
         * @param fn the function to execute.
         */
        $scope.safeApply = function (fn) {
            var phase = this.$root.$$phase;
            if (phase == '$apply' || phase == '$digest') {
                if (fn && (typeof(fn) === 'function')) {
                    fn();
                }
            } else {
                this.$apply(fn);
            }
        };

    }]);

    /**
     * Sortable directive - defines callbacks.
     * Parent directive for draggable and sortable items.
     * Sets modelValue, callbacks, element in scope.
     */
    mainModule.directive('sortable',
        function () {
            return {
                require: 'ngModel', // get a hold of NgModelController
                restrict: 'A',
                scope: true,
                controller: 'sortableController',
                link: function (scope, element, attrs, ngModelController) {<commit_msg>changed '==' checks to '==='.<commit_after>(function () {

    'use strict';
    var mainModule = angular.module('ui.sortable');

    /**
     * Controller for Sortable.
     * @param $scope - the sortable scope.
     */
    mainModule.controller('sortableController', ['$scope', function ($scope) {

        this.scope = $scope;

        $scope.modelValue = null; // sortable list.
        $scope.callbacks = null;
        $scope.type = 'sortable';

        /**
         * Inserts the item in to the sortable list.
         *
         * @param index - the item index.
         * @param itemData - the item model data.
         */
        $scope.insertItem = function (index, itemData) {
            $scope.safeApply(function () {
                $scope.modelValue.splice(index, 0, itemData);
            });
        };

        /**
         * Removes the item from the sortable list.
         *
         * @param index - index to be removed.
         * @returns {*} - removed item.
         */
        $scope.removeItem = function (index) {
            var removedItem = null;
            if (index > -1) {
                $scope.safeApply(function () {
                    removedItem = $scope.modelValue.splice(index, 1)[0];
                });
            }
            return removedItem;
        };

        /**
         * Checks whether the sortable list is empty.
         *
         * @returns {null|*|$scope.modelValue|boolean}
         */
        $scope.isEmpty = function () {
            return ($scope.modelValue && $scope.modelValue.length === 0);
        };

        /**
         * Wrapper for the accept callback delegates to callback.
         *
         * @param sourceItemScope - drag item scope
         * @param destScope - sortable target scope.
         * @returns {*|boolean} - true if drop is allowed for the drag item in drop target.
         */
        $scope.accept = function (sourceItemScope, destScope) {
            return $scope.callbacks.accept(sourceItemScope, destScope);
        };

        /**
         * Checks the current phase before executing the function.
         *
         * @param fn the function to execute.
         */
        $scope.safeApply = function (fn) {
            var phase = this.$root.$$phase;
            if (phase === '$apply' || phase === '$digest') {
                if (fn && (typeof(fn) === 'function')) {
                    fn();
                }
            } else {
                this.$apply(fn);
            }
        };

    }]);

    /**
     * Sortable directive - defines callbacks.
     * Parent directive for draggable and sortable items.
     * Sets modelValue, callbacks, element in scope.
     */
    mainModule.directive('sortable',
        function () {
            return {
                require: 'ngModel', // get a hold of NgModelController
                restrict: 'A',
                scope: true,
                controller: 'sortableController',
                link: function (scope, element, attrs, ngModelController) {
{'fraction_non_alphanumeric': 0.12063808574277168, 'fraction_numerical': 0.001661681621801263, 'mean_word_length': 1.4810387469084914, 'pattern_counts': {'":': 0, '<': 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': '4468242', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1539, 'n_words': 425}