(js: NodeCompiler)
| 1065 | readonly structMorph: Morph | undefined = getPossibleMorph(this) |
| 1066 | |
| 1067 | compile(js: NodeCompiler): unknown { |
| 1068 | if (js.trav === "Transform") return this.jsTf(js) |
| 1069 | if (js.trav === "Apply" && this.sharesTfs) { |
| 1070 | js.if(`${js.ref(transformsValid)}(ctx)`, () => |
| 1071 | js.return( |
| 1072 | `${js.ref(this)}.applySharedKeys(data, ctx${js.inPlace ? ", true" : ""})` |
| 1073 | ) |
| 1074 | ) |
| 1075 | } |
| 1076 | |
| 1077 | const conjunction = js.trav === "Apply" ? this.jsConjunction(js) : undefined |
| 1078 | if (conjunction !== undefined) return js.return(conjunction) |
| 1079 | |
| 1080 | for (const prop of this.propsOf(js)) js.check(prop) |
| 1081 | |
| 1082 | if (this.sequence) js.check(this.sequence) |
| 1083 | |
| 1084 | if (this.index) { |
| 1085 | js.const("keys", "Object.keys(data)") |
| 1086 | .const("isArray", "Array.isArray(data)") |
| 1087 | .for("i < keys.length", () => |
| 1088 | this.jsEntry(js.const("k", "keys[i]"), "string") |
| 1089 | ) |
| 1090 | if (this.indexSyms) { |
| 1091 | js.loop("for (const k of Object.getOwnPropertySymbols(data))", () => |
| 1092 | this.jsEntry(js, "symbol") |
| 1093 | ) |
| 1094 | } |
| 1095 | } else if (this.undeclared === "reject") { |
| 1096 | if (js.trav === "Allows" && js.jsonInput && this.countsKeys) |
| 1097 | this.jsKeyCount(js, () => js.return(true)) |
| 1098 | js.forIn("data", () => this.jsEntry(js, "string")) |
| 1099 | } |
| 1100 | |
| 1101 | return js.return(true) |
| 1102 | } |
| 1103 | |
| 1104 | // not where it declares a key Object.prototype has, which `in` finds even unheld |
| 1105 | get countsKeys(): boolean { |
nothing calls this directly
no test coverage detected