Skip to content

Commit

Permalink
Made the callback optional in the 'addSubTree' of the 'FileSystem' class
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 29, 2017
1 parent 489cf28 commit d81a883
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/manager/v2/fileSystem/FileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,10 @@ var FileSystem = (function () {
};
FileSystem.prototype.addSubTree = function (ctx, _rootPath, _tree, _callback) {
var _this = this;
var callback = _callback ? _callback : _tree;
var tree = _callback ? _tree : _rootPath;
var rootPath = _callback ? new Path_1.Path(_rootPath) : new Path_1.Path('/');
var callback = _callback ? _callback : _tree;
callback = callback ? callback : function () { };
if (tree.constructor === CommonTypes_1.ResourceType) {
this.create(ctx, rootPath, tree, callback);
}
Expand Down
3 changes: 2 additions & 1 deletion src/manager/v2/fileSystem/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,10 @@ export abstract class FileSystem implements ISerializableFileSystem
addSubTree(ctx : RequestContext, rootPath : Path | string, resourceType : ResourceType, callback : SimpleCallback)
addSubTree(ctx : RequestContext, _rootPath : Path | string | SubTree | ResourceType | SimpleCallback, _tree : SubTree | ResourceType | SimpleCallback, _callback ?: SimpleCallback)
{
const callback = _callback ? _callback : _tree as SimpleCallback;
const tree = _callback ? _tree as SubTree | ResourceType : _rootPath as SubTree | ResourceType;
const rootPath = _callback ? new Path(_rootPath as Path | string) : new Path('/');
let callback = _callback ? _callback : _tree as SimpleCallback;
callback = callback ? callback : () => {};

if(tree.constructor === ResourceType)
{
Expand Down

0 comments on commit d81a883

Please sign in to comment.