lib/extends/_mkdirp.js
function _mkdirp (directory, mode, callback) {

			if ("undefined" === typeof directory) {
				throw new ReferenceError("missing \"directory\" argument");
			}
				else if ("string" !== typeof directory) {
					throw new TypeError("\"directory\" argument is not a string");
				}
				else if ("" === directory.trim()) {
					throw new Error("\"directory\" argument is empty");
				}
			else if ("undefined" !== typeof callback && "number" !== typeof mode) {
				throw new TypeError("\"mode\" argument is not a number");
			}
			else if ("undefined" === typeof callback && "undefined" === typeof mode) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback && "function" !== typeof mode) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				let _callback = callback;
				let _mode = mode;

				if ("undefined" === typeof _callback) {
					_callback = mode;
					_mode = DEFAULT_OPTION;
				}

				isDirectoryProm(directory).then((exists) => {

					return exists ? Promise.resolve() : Promise.resolve().then(() => {

						const SUB_DIRECTORY = dirname(directory);

						return isDirectoryProm(SUB_DIRECTORY).then((_exists) => {

							return _exists ? new Promise((resolve, reject) => {

								mkdir(directory, _mode, (err) => {
									return err ? reject(err) : resolve();
								});

							}) : new Promise((resolve, reject) => {

								_mkdirp(SUB_DIRECTORY, _mode, (err) => {

									return err ? reject(err) : mkdir(directory, _mode, (_err) => {
										return _err ? reject(_err) : resolve();
									});

								});

							});

						});

					});

				}).then(() => {
					_callback(null);
				}).catch(callback);

			}

		}
function _mkdirp (directory, mode, callback) {

			if ("undefined" === typeof directory) {
				throw new ReferenceError("missing \"directory\" argument");
			}
				else if ("string" !== typeof directory) {
					throw new TypeError("\"directory\" argument is not a string");
				}
				else if ("" === directory.trim()) {
					throw new Error("\"directory\" argument is empty");
				}
			else if ("undefined" !== typeof callback && "number" !== typeof mode) {
				throw new TypeError("\"mode\" argument is not a number");
			}
			else if ("undefined" === typeof callback && "undefined" === typeof mode) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback && "function" !== typeof mode) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				let _callback = callback;
				let _mode = mode;

				if ("undefined" === typeof _callback) {
					_callback = mode;
					_mode = DEFAULT_OPTION;
				}

				isDirectoryProm(directory).then((exists) => {

					return exists ? Promise.resolve() : Promise.resolve().then(() => {

						const SUB_DIRECTORY = dirname(directory);

						return isDirectoryProm(SUB_DIRECTORY).then((_exists) => {

							return _exists ? new Promise((resolve, reject) => {

								mkdir(directory, _mode, (err) => {
									return err ? reject(err) : resolve();
								});

							}) : new Promise((resolve, reject) => {

								_mkdirp(SUB_DIRECTORY, _mode, (err) => {

									return err ? reject(err) : mkdir(directory, _mode, (_err) => {
										return _err ? reject(_err) : resolve();
									});

								});

							});

						});

					});

				}).then(() => {
					_callback(null);
				}).catch(callback);

			}

		}
function _mkdirp ( directory , mode , callback ) { if ( "undefined" === typeof directory ) { throw new ReferenceError ( "missing \"directory\" argument" ) ; } else if ( "string" !== typeof directory ) { throw new TypeError ( "\"directory\" argument is not a string" ) ; } else if ( "" === directory . trim ( ) ) { throw new Error ( "\"directory\" argument is empty" ) ; } else if ( "undefined" !== typeof callback && "number" !== typeof mode ) { throw new TypeError ( "\"mode\" argument is not a number" ) ; } else if ( "undefined" === typeof callback && "undefined" === typeof mode ) { throw new ReferenceError ( "missing \"callback\" argument" ) ; } else if ( "function" !== typeof callback && "function" !== typeof mode ) { throw new TypeError ( "\"callback\" argument is not a function" ) ; } else { let _callback = callback ; let _mode = mode ; if ( "undefined" === typeof _callback ) { _callback = mode ; _mode = DEFAULT_OPTION ; } isDirectoryProm ( directory ) . then ( ( exists ) => { return exists ? Promise . resolve ( ) : Promise . resolve ( ) . then ( ( ) => { const SUB_DIRECTORY = dirname ( directory ) ; return isDirectoryProm ( SUB_DIRECTORY ) . then ( ( _exists ) => { return _exists ? new Promise ( ( resolve , reject ) => { mkdir ( directory , _mode , ( err ) => { return err ? reject ( err ) : resolve ( ) ; } ) ; } ) : new Promise ( ( resolve , reject ) => { _mkdirp ( SUB_DIRECTORY , _mode , ( err ) => { return err ? reject ( err ) : mkdir ( directory , _mode , ( _err ) => { return _err ? reject ( _err ) : resolve ( ) ; } ) ; } ) ; } ) ; } ) ; } ) ; } ) . then ( ( ) => { _callback ( null ) ; } ) . catch ( callback ) ; } }
methods 
Async mkdirp
@param {string} directory : directory path
@param {number} mode : creation mode
@param {function|null} callback : operation's result
@returns {void}
methods Async mkdirp