<commit_before>/*
 |----------------------------------------------------------------------------------------------------------------------
 | A utility singleton to help manage task-related paths more easily throughout the whole project.
 |----------------------------------------------------------------------------------------------------------------------
 */

/**
 * More information on [JavaScript Open Standards]{@link https://github.com/jsopenstd/jsopenstd}.
 *
 * @namespace js.task
 * @version 1.0.3
 *
 * @author <NAME> <<EMAIL>> [GitHub]{@link https://github.com/richrdkng}
 * @license [MIT]{@link https://github.com/jsopenstd/js-partial-foreach/blob/master/license.md}
 */

`use strict`;

const path    = require(`path`),
      appRoot = require(`app-root-path`),
      extend  = require(`extend`),
      foreach = require(`js-partial-foreach`);
/*
 |----------------------------------------------------------------------------------------------------------------------
 | Exceptions
 |----------------------------------------------------------------------------------------------------------------------
 */
const InvalidGlobException     = require(`./exception/InvalidGlobException`),
      InvalidPathNameException = require(`./exception/InvalidPathNameException`),
      PathNotFoundException    = require(`./exception/PathNotFoundException`),
      TypeException            = require(`./exception/TypeException`);

/*
 |----------------------------------------------------------------------------------------------------------------------
 | Helper Functions
 |----------------------------------------------------------------------------------------------------------------------
 */
const isPresent = (object) => {
    return typeof object !== `undefined` &&
           object !== null;
};

const isString = (object) => {
    return typeof object === `string`;
};

const isEmptyString = (object) => {
    return typeof object === `string` &&
           (
               object.length === 0 ||
               /^\s+$/.test(object) === true
           );
};

const isArray = (object) => {
    return Object.prototype.toString.call(object) === `[object Array]`;
};

const isObject = (object) => {
    return Object.prototype.toString.call(object) === `[object Object]`;
};

const arrayMerge = (array, ...rest) => {
    return array.concat(...rest);
};

const self = class Path {

    /**
     * The default values of options, when adding paths.
     *
     * @const
     * @type {Object} DEFAULTS
     * @memberOf js/task/Paths
     */
    static get DEFAULTS() {
        return {
            /**
             * Whether use path.normalize(...) on passed globs.
             *
             * @type {boolean}
             * @default true
             */
            autoNormalizePath : true,

            /**
             *
             * @type {RegExp}
             * @default \s*(<[\s\-\\\/\.\*\w]+>)\s* /i
             */
            nameTokenPattern : /\s*(<[\s\-\\\/\.\*\w]+>)\s*/i,
        };
    }

    constructor() {
        /**
         * The root of the project determined when the Paths class was instantiated.
         *
         * @private {string}
         * @default ``
         */
        this._root  = ``;

        /**
         * The storage object for the named glob paths.
         *
         * @private {Object}
         * @default {}
         */
        this._paths = {};

        this.setRoot(appRoot.toString());
    }

    /**
     * Gets the glob path by the given name.
     *
     * Alias: {@link js/task/Paths#get}
     *
     * @method getPath<commit_msg>Remove unneeded escapes from RegExp<commit_after>/*
 |----------------------------------------------------------------------------------------------------------------------
 | A utility singleton to help manage task-related paths more easily throughout the whole project.
 |----------------------------------------------------------------------------------------------------------------------
 */

/**
 * More information on [JavaScript Open Standards]{@link https://github.com/jsopenstd/jsopenstd}.
 *
 * @namespace js.task
 * @version 1.0.3
 *
 * @author <NAME> <<EMAIL>> [GitHub]{@link https://github.com/richrdkng}
 * @license [MIT]{@link https://github.com/jsopenstd/js-partial-foreach/blob/master/license.md}
 */

`use strict`;

const path    = require(`path`),
      appRoot = require(`app-root-path`),
      extend  = require(`extend`),
      foreach = require(`js-partial-foreach`);
/*
 |----------------------------------------------------------------------------------------------------------------------
 | Exceptions
 |----------------------------------------------------------------------------------------------------------------------
 */
const InvalidGlobException     = require(`./exception/InvalidGlobException`),
      InvalidPathNameException = require(`./exception/InvalidPathNameException`),
      PathNotFoundException    = require(`./exception/PathNotFoundException`),
      TypeException            = require(`./exception/TypeException`);

/*
 |----------------------------------------------------------------------------------------------------------------------
 | Helper Functions
 |----------------------------------------------------------------------------------------------------------------------
 */
const isPresent = (object) => {
    return typeof object !== `undefined` &&
           object !== null;
};

const isString = (object) => {
    return typeof object === `string`;
};

const isEmptyString = (object) => {
    return typeof object === `string` &&
           (
               object.length === 0 ||
               /^\s+$/.test(object) === true
           );
};

const isArray = (object) => {
    return Object.prototype.toString.call(object) === `[object Array]`;
};

const isObject = (object) => {
    return Object.prototype.toString.call(object) === `[object Object]`;
};

const arrayMerge = (array, ...rest) => {
    return array.concat(...rest);
};

const self = class Path {

    /**
     * The default values of options, when adding paths.
     *
     * @const
     * @type {Object} DEFAULTS
     * @memberOf js/task/Paths
     */
    static get DEFAULTS() {
        return {
            /**
             * Whether use path.normalize(...) on passed globs.
             *
             * @type {boolean}
             * @default true
             */
            autoNormalizePath : true,

            /**
             *
             * @type {RegExp}
             * @default \s*(<[\s\-\\\/\.\*\w]+>)\s* /i
             */
            nameTokenPattern : /\s*(<[\s\-\\\/.*\w]+>)\s*/i,
        };
    }

    constructor() {
        /**
         * The root of the project determined when the Paths class was instantiated.
         *
         * @private {string}
         * @default ``
         */
        this._root  = ``;

        /**
         * The storage object for the named glob paths.
         *
         * @private {Object}
         * @default {}
         */
        this._paths = {};

        this.setRoot(appRoot.toString());
    }

    /**
     * Gets the glob path by the given name.
     *
     * Alias: {@link js/task/Paths#get}
     *
     * @method getPath
{'fraction_non_alphanumeric': 0.32630995286942055, 'fraction_numerical': 0.0011089548100914888, 'mean_word_length': 1.1053399474759265, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, 'https://': 6, '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': '6845146', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1703, 'n_words': 379}