Skip to content

Commit

Permalink
better way to check if a JSONValue has a member
Browse files Browse the repository at this point in the history
  • Loading branch information
skilion committed Oct 3, 2015
1 parent 2acd002 commit 9da9b72
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/sync.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@ private long thresholdFileSize = 10 * 2^^20; // 10 Mib

private bool isItemFolder(const ref JSONValue item)
{
scope (failure) return false;
JSONValue folder = item["folder"];
return true;
return (("folder" in item.object) !is null);
}

private bool isItemFile(const ref JSONValue item)
{
scope (failure) return false;
JSONValue folder = item["file"];
return true;
return (("file" in item.object) !is null);
}

private bool isItemDeleted(const ref JSONValue item)
{
scope (failure) return false;
return !item["deleted"].isNull();
return (("deleted" in item.object) !is null);
}

private bool testCrc32(string path, const(char)[] crc32)
Expand Down

0 comments on commit 9da9b72

Please sign in to comment.