Вход Регистрация
Файл: error-kitty/node_modules/mocha/node_modules/mkdirp/index.js
Строк: 52
<?php
var path = require('path');
var 
fs = require('fs');

module.exports mkdirP.mkdirp mkdirP.mkdirP mkdirP;

function 
mkdirP (pmodefmade) {
    if (
typeof mode === 'function' || mode === undefined) {
        
mode;
        
mode 0777 & (~process.umask());
    }
    if (!
mademade null;

    var 
cb || function () {};
    if (
typeof mode === 'string'mode parseInt(mode8);
    
path.resolve(p);

    
fs.mkdir(pmode, function (er) {
        if (!
er) {
            
made made || p;
            return 
cb(nullmade);
        }
        switch (
er.code) {
            case 
'ENOENT':
                
mkdirP(path.dirname(p), mode, function (ermade) {
                    if (
ercb(ermade);
                    else 
mkdirP(pmodecbmade);
                });
                break;

            
// In the case of any other error, just see if there's a dir
            // there already.  If so, then hooray!  If not, then something
            // is borked.
            
default:
                
fs.stat(p, function (er2stat) {
                    
// if the stat fails, then that's super weird.
                    // let the original error be the failure reason.
                    
if (er2 || !stat.isDirectory()) cb(ermade)
                    else 
cb(nullmade);
                });
                break;
        }
    });
}

mkdirP.sync = function sync (pmodemade) {
    if (
mode === undefined) {
        
mode 0777 & (~process.umask());
    }
    if (!
mademade null;

    if (
typeof mode === 'string'mode parseInt(mode8);
    
path.resolve(p);

    try {
        
fs.mkdirSync(pmode);
        
made made || p;
    }
    catch (
err0) {
        switch (
err0.code) {
            case 
'ENOENT' :
                
made sync(path.dirname(p), modemade);
                
sync(pmodemade);
                break;

            
// In the case of any other error, just see if there's a dir
            // there already.  If so, then hooray!  If not, then something
            // is borked.
            
default:
                var 
stat;
                try {
                    
stat fs.statSync(p);
                }
                catch (
err1) {
                    throw 
err0;
                }
                if (!
stat.isDirectory()) throw err0;
                break;
        }
    }

    return 
made;
};
?>
Онлайн: 1
Реклама