lib/map.js
function mapObjects(root, list, callback) {
	var ret = {};
	var sent = false;
	var count = list.length;
	if (count === 0) {
		callback(null, ret);
	}
	list.forEach(function (pointer) {
		var name = path.join(root._path, pointer);
		fp.define({filePath: name, parent: root}, function (err, obj) {
			if (err) {
				if (!sent) {
					callback(err);
					sent = true;
				}
				return;
			}
			ret[name] = obj;
			if (ret[name]._type === 'directory') {
				addMaping(ret[name]);
			}
			if (--count === 0) {
				callback(null, ret);
			}
		});
	});

}
function mapObjects(root, list, callback) {
	var ret = {};
	var sent = false;
	var count = list.length;
	if (count === 0) {
		callback(null, ret);
	}
	list.forEach(function (pointer) {
		var name = path.join(root._path, pointer);
		fp.define({filePath: name, parent: root}, function (err, obj) {
			if (err) {
				if (!sent) {
					callback(err);
					sent = true;
				}
				return;
			}
			ret[name] = obj;
			if (ret[name]._type === 'directory') {
				addMaping(ret[name]);
			}
			if (--count === 0) {
				callback(null, ret);
			}
		});
	});

}
function mapObjects ( root , list , callback ) { var ret = { } ; var sent = false ; var count = list . length ; if ( count === 0 ) { callback ( null , ret ) ; } list . forEach ( function ( pointer ) { var name = path . join ( root . _path , pointer ) ; fp . define ( { filePath : name , parent : root } , function ( err , obj ) { if ( err ) { if ( ! sent ) { callback ( err ) ; sent = true ; } return ; } ret [ name ] = obj ; if ( ret [ name ] . _type === 'directory' ) { addMaping ( ret [ name ] ) ; } if ( -- count === 0 ) { callback ( null , ret ) ; } } ) ; } ) ; }
Function for mapping a list of objects relative to root object

@param root - Folder object
@param list - Array of file names
@param callback(err, result) - Function
Function for mapping a list of objects relative to root object