better way to check if a JSONValue has a member

This commit is contained in:
skilion 2015-10-03 10:45:43 +02:00
parent 2acd00209f
commit 9da9b7240d

View file

@ -9,22 +9,17 @@ private long thresholdFileSize = 10 * 2^^20; // 10 Mib
private bool isItemFolder(const ref JSONValue item) private bool isItemFolder(const ref JSONValue item)
{ {
scope (failure) return false; return (("folder" in item.object) !is null);
JSONValue folder = item["folder"];
return true;
} }
private bool isItemFile(const ref JSONValue item) private bool isItemFile(const ref JSONValue item)
{ {
scope (failure) return false; return (("file" in item.object) !is null);
JSONValue folder = item["file"];
return true;
} }
private bool isItemDeleted(const ref JSONValue item) private bool isItemDeleted(const ref JSONValue item)
{ {
scope (failure) return false; return (("deleted" in item.object) !is null);
return !item["deleted"].isNull();
} }
private bool testCrc32(string path, const(char)[] crc32) private bool testCrc32(string path, const(char)[] crc32)