<commit_before>/*
* imfs.js
* Copyright (C) 2017 sabertazimi <<EMAIL>>
*
* Distributed under terms of the MIT license.
*/

'use strict';

const path = require('path');   // utils for resolve path

class Imfs {
    constructor(data) {
        this.data = data || {};
        this.cwd = '/';
    }

    /**
    * change path string to path array
    *
    * @method resolvePath
    * @param  {string} _path path string for target
    * @return {array}       path array
    */
    resolvePath(_path) {
        if ()
    }
    
    /**
    * change current working directory
    *
    * @method chdir
    * @param  {string}  _path path string for target
    * @return {object}      reference to imfs (this)
    */
    chdir(_path) {
    }

    /**
    * judge a dir/file whether exists or not
    *
    * @method isExist
    * @param  {string}  _path path string for target
    * @return {Boolean}       true stand for existance
    */
    isExist(_path) {
    }

    /**
    * read content of directory
    *
    * @method readdir
    * @param  {string} _path path string for target
    * @return {array}       string array of file/subdir name
    */
    readdir(_path) {
    }


    /**
    * make new directory
    *
    * @method mkdir
    * @param  {string} _path path string for target
    * @return {object}      reference to imfs (this)
    */
    mkdir(_path) {
        return this;
    }

    /**
    * delete directory/file
    *
    * @method rmdir
    * @param  {string} _path path string for target
    * @return {object}      reference to imfs (this)
    */
    rmdir(_path) {
        return this;
    }

    /**
    * read content of file
    *
    * @method readFile
    * @param  {string} _path path string for target
    * @return {string}       content of file
    */
    readFile(_path) {
    }

    /**
    * write content to file
    *
    * @method writeFile
    * @param  {string} _path path string for target
    * @param  {string} content content to write
    * @return {object}      reference to imfs (this)
    */
    writeFile(_path, content) {
        return this;
    }
}

module.exports = Imfs;<commit_msg>feat(os-final proj5-path): impl path resolve utils<commit_after>/*
* imfs.js
* Copyright (C) 2017 sabertazimi <<EMAIL>>
*
* Distributed under terms of the MIT license.
*/

'use strict';

const path = require('path');   // utils for resolve path

class Imfs {
    constructor(data) {
        this.data = data || {};
        this.cwd = '/';
    }
    
    /**
    * change path string to path array
    *
    * @method resolvePath
    * @param  {string} _path path string for target
    * @return {string}       normalized absolute path
    */
    resolvePath(_path) {
        let formatPath = _path;
        
        // combine path to absolute path
        if (!path.isAbsolute(formatPath)) {
            formatPath = path.join(this.cwd, formatPath);
        }
        
        formatPath = path.normalize(formatPath);
        
        return formatPath;
    }
    
    
    /**    
     * change normalized absolute path to array
     *      
     * @param  {string} formatPath normalized absolute path
     * @return {array}            path array
     */     
    path2arr(formatPath) {
        let patharr = fromatPath.substr(1).split("/");
        
        // remove tail '/'
        if (!patharr[patharr.length - 1]) {
            patharr.pop();
        }
        
        return patharr;
    }
    
    /**
    * change current working directory
    *
    * @method chdir
    * @param  {string}  _path path string for target
    * @return {object}      reference to imfs (this)
    */
    chdir(_path) {
        const formatPath = this.resolvePath(_path);
    }
    
    /**
    * judge a dir/file whether exists or not
    *
    * @method isExist
    * @param  {string}  _path path string for target
    * @return {Boolean}       true stand for existance
    */
    isExist(_path) {
    }
    
    /**
    * read content of directory
    *
    * @method readdir
    * @param  {string} _path path string for target
    * @return {array}       string array of file/subdir name
    */
    readdir(_path) {
    }
    
    
    /**
    * make new directory
    *
    * @method mkdir
    * @param  {string} _path path string for target
    * @return {object}      reference to imfs (this)
    */
    mkdir(_path) {
        return this;
    }
    
    /**
    * delete directory/file
    *
    * @method rmdir
    * @param  {string} _path path string for target
    * @return {object}      reference to imfs (this)
    */
    rmdir(_path) {
        return this;
    }
    
    /**
    * read content of file
    *
    * @method readFile
    * @param  {string} _path path string for target
    * @return {string}       content of file
    */
    readFile(_path) {
    }
    
    /**
    * write content to file
    *
    * @method writeFile
    * @param  {string} _path path string for target
    * @param  {string} content content to write
    * @return {object}      reference to imfs (this)
    */
    writeFile(_path, content) {
        return this;
    }
}

module.exports = Imfs;
{'fraction_non_alphanumeric': 0.11017776909552647, 'fraction_numerical': 0.002344207853096308, 'mean_word_length': 1.7690643591130342, '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': '2522126', 'n_tokens_mistral': 1597, 'n_tokens_neox': 1572, 'n_words': 462}