|
4 | 4 |
|
5 | 5 | // @flow |
6 | 6 |
|
7 | | -const { get, has } = require("lodash"); |
8 | 7 | const { maybeEscapePropertyName } = require("../../reps/rep-utils"); |
9 | 8 | const ArrayRep = require("../../reps/array"); |
10 | 9 | const GripArrayRep = require("../../reps/grip-array"); |
@@ -55,12 +54,12 @@ function getType(item: Node) : Symbol { |
55 | 54 | function getValue( |
56 | 55 | item: Node |
57 | 56 | ) : RdpGrip | NodeContents { |
58 | | - if (has(item, "contents.value")) { |
59 | | - return get(item, "contents.value"); |
| 57 | + if (item && item.contents && item.contents.hasOwnProperty("value")) { |
| 58 | + return item.contents.value; |
60 | 59 | } |
61 | 60 |
|
62 | | - if (has(item, "contents.getterValue")) { |
63 | | - return get(item, "contents.getterValue", undefined); |
| 61 | + if (item && item.contents && item.contents.hasOwnProperty("getterValue")) { |
| 62 | + return item.contents.getterValue; |
64 | 63 | } |
65 | 64 |
|
66 | 65 | if (nodeHasAccessors(item)) { |
@@ -419,11 +418,15 @@ function makeNodesForMapEntry( |
419 | 418 | } |
420 | 419 |
|
421 | 420 | function getNodeGetter(item: Node): ?Object { |
422 | | - return get(item, "contents.get", undefined); |
| 421 | + return item && item.contents |
| 422 | + ? item.contents.get |
| 423 | + : undefined; |
423 | 424 | } |
424 | 425 |
|
425 | 426 | function getNodeSetter(item: Node): ?Object { |
426 | | - return get(item, "contents.set", undefined); |
| 427 | + return item && item.contents |
| 428 | + ? item.contents.set |
| 429 | + : undefined; |
427 | 430 | } |
428 | 431 |
|
429 | 432 | function makeNodesForAccessors(item: Node) : Array<Node> { |
|
0 commit comments