Repository: dynamoosejs/dynamoose (js)

Issue:
[BUG] Nested Filters Don't Work
There is an issue when trying to filter nested properties. For example. The following doesn't work.

```js
Model.scan("name.first").eq("Charlie").exec();
```

The reason for this is the request being sent is:

```json
{
  "FilterExpression": "#a0 = :v0",
  "ExpressionAttributeNames": { "#a0": "name.first" },
  "ExpressionAttributeValues": { ":v0": { "S": "Charlie" } },
}
```

The request that should be sent is:

```json
{
  "FilterExpression": "#a0.#a1 = :v0",
  "ExpressionAttributeNames": { "#a0": "name", "#a1": "first" },
  "ExpressionAttributeValues": { ":v0": { "S": "Charlie" } },
}
```

Pull request description:
Nested condition keys fix
Closes #803 

Patch:
diff --git a/lib/Condition.js b/lib/Condition.js
index 5885cf46..cf1c308f 100644
--- a/lib/Condition.js
+++ b/lib/Condition.js
@@ -133,7 +133,17 @@ Condition.prototype.requestObject = function(settings = {"conditionString": "Con
 				const keys = {"name": `#a${index}`, "value": `:v${index}`};
 				setIndex(++index);
 
-				object.ExpressionAttributeNames[keys.name] = key;
+				const keyParts = key.split(".");
+				if (keyParts.length === 1) {
+					object.ExpressionAttributeNames[keys.name] = key;
+				} else {
+					keys.name = keyParts.reduce((finalName, part, index) => {
+						const name = `${keys.name}_${index}`;
+						object.ExpressionAttributeNames[name] = part;
+						finalName.push(name);
+						return finalName;
+					}, []).join(".");
+				}
 				object.ExpressionAttributeValues[keys.value] = Document.toDynamo(value, {"type": "value"});
 
 				switch (condition.type) {


Test patch:
diff --git a/test/Condition.js b/test/Condition.js
index 89fad13e..d80fe6e9 100644
--- a/test/Condition.js
+++ b/test/Condition.js
@@ -51,6 +51,10 @@ describe("Condition", () => {
 				"input": () => new Condition({"id": {"random": "5"}}),
 				"error": "The type: random is invalid."
 			},
+			{
+				"input": () => new Condition("name.first").eq("Charlie"),
+				"output": {"ConditionExpression": "#a0_0.#a0_1 = :v0", "ExpressionAttributeNames": {"#a0_0": "name", "#a0_1": "first"}, "ExpressionAttributeValues": {":v0": {"S": "Charlie"}}}
+			},
 			{
 				"input": () => new Condition().group(new Condition("id").eq("5")),
 				"output": {"ConditionExpression": "(#a0 = :v0)", "ExpressionAttributeNames": {"#a0": "id"}, "ExpressionAttributeValues": {":v0": {"S": "5"}}}