<commit_before>/**
* @author       <NAME> <<EMAIL>>
* @copyright    2016 Photon Storm Ltd.
* @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/

/**
* @class Phaser.Utils
* @static
*/
Phaser.Utils = {

    /**
    * Takes the given string and reverses it, returning the reversed string.
    * For example if given the string `Atari 520ST` it would return `TS025 iratA`.
    *
    * @method Phaser.Utils.reverseString
    * @param {string} string - The string to be reversed.
    * @return {string} The reversed string.
    */
    reverseString: function (string) {

        return string.split('').reverse().join('');

    },

    /**
     * Gets an object's property by string.
     *
     * @method Phaser.Utils.getProperty
     * @param {object} obj - The object to traverse.
     * @param {string} prop - The property whose value will be returned.
     * @return {any} - The value of the property or `undefined` if the property isn't found.
     */
    getProperty: function(obj, prop) {

        var parts = prop.split('.'),
            len = parts.length,
            i = 0,
            val = obj;

        while (i < len)
        {
            var key = parts[i];

            if (val != null)
            {
                val = val[key];
                i++;
            }
            else
            {
                return undefined;
            }
        }

        return val;

    },

    /**
     * Sets an objects property by string.
     *
     * @method Phaser.Utils.setProperty
     * @param {object} obj - The object to traverse
     * @param {string} prop - The property whose value will be changed
     * @return {object} The object on which the property was set.
     */
    setProperty: function(obj, prop, value) {

        var parts = prop.split('.'),
            last = parts.pop(),
            l = parts.length,
            i = 1,
            current = parts[0];

        while (i < l && (obj = obj[current]))
        {
            current = parts[i];
            i++;
        }<commit_msg>Add Phaser.Utils.setProperties<commit_after>/**
* @author       <NAME> <<EMAIL>>
* @copyright    2016 Photon Storm Ltd.
* @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/

/**
* @class Phaser.Utils
* @static
*/
Phaser.Utils = {

    /**
    * Takes the given string and reverses it, returning the reversed string.
    * For example if given the string `Atari 520ST` it would return `TS025 iratA`.
    *
    * @method Phaser.Utils.reverseString
    * @param {string} string - The string to be reversed.
    * @return {string} The reversed string.
    */
    reverseString: function (string) {

        return string.split('').reverse().join('');

    },

    /**
     * Gets an object's property by string.
     *
     * @method Phaser.Utils.getProperty
     * @param {object} obj - The object to traverse.
     * @param {string} prop - The property whose value will be returned.
     * @return {any} - The value of the property or `undefined` if the property isn't found.
     */
    getProperty: function(obj, prop) {

        var parts = prop.split('.'),
            len = parts.length,
            i = 0,
            val = obj;

        while (i < len)
        {
            var key = parts[i];

            if (val != null)
            {
                val = val[key];
                i++;
            }
            else
            {
                return undefined;
            }
        }

        return val;

    },

    /**
     * Sets an object's properties from a map of property names and values.
     *
     * @example
     * Phaser.Utils.setProperties(sprite, {
     *  'animations.paused': true,
     *  'body.enable': false,
     *  'input.draggable': true,
     * });
     *
     * @method Phaser.Utils.setProperties
     * @param  {object} obj - The object to modify.
     * @param  {object} props - The property names and values to set on the object (see {@link #setProperty}).
     * @return {object} The modified object.
     */
    setProperties: function(obj, props) {

        for (var name in props)
        {
            this.setProperty(obj, name, props[name]);
        }

        return obj;

    },

    /**
     * Sets an object's property by name and value.
     *
     * @example
     * Phaser.Utils.setProperty(sprite, 'body.velocity.x', 60);
     *
     * @method Phaser.Utils.setProperty
     * @param {object} obj - The object to modify.
     * @param {string} prop - The property name, or a series of names separated by `.` (for nested properties).
     * @param {any} value - The value.
     * @return {object} The modified object.
     */
    setProperty: function(obj, prop, value) {

        var parts = prop.split('.'),
            last = parts.pop(),
            l = parts.length,
            i = 1,
            current = parts[0];

        while (i < l && (obj = obj[current]))
        {
            current = parts[i];
            i++;
        }
{'fraction_non_alphanumeric': 0.1251247256036719, 'fraction_numerical': 0.0055877070445020955, 'mean_word_length': 1.6917293233082706, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '2085438', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1426, 'n_words': 450}