(target, key, isReadonly = false, isShallow = false)
| 1035 | const toShallow = (value) => value; |
| 1036 | const getProto = (v) => Reflect.getPrototypeOf(v); |
| 1037 | function get(target, key, isReadonly = false, isShallow = false) { |
| 1038 | // #1772: readonly(reactive(Map)) should return readonly + reactive version |
| 1039 | // of the value |
| 1040 | target = target["__v_raw" /* ReactiveFlags.RAW */]; |
| 1041 | const rawTarget = toRaw(target); |
| 1042 | const rawKey = toRaw(key); |
| 1043 | if (!isReadonly) { |
| 1044 | if (key !== rawKey) { |
| 1045 | track(rawTarget, "get" /* TrackOpTypes.GET */, key); |
| 1046 | } |
| 1047 | track(rawTarget, "get" /* TrackOpTypes.GET */, rawKey); |
| 1048 | } |
| 1049 | const { has } = getProto(rawTarget); |
| 1050 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; |
| 1051 | if (has.call(rawTarget, key)) { |
| 1052 | return wrap(target.get(key)); |
| 1053 | } |
| 1054 | else if (has.call(rawTarget, rawKey)) { |
| 1055 | return wrap(target.get(rawKey)); |
| 1056 | } |
| 1057 | else if (target !== rawTarget) { |
| 1058 | // #3602 readonly(reactive(Map)) |
| 1059 | // ensure that the nested reactive `Map` can do tracking for itself |
| 1060 | target.get(key); |
| 1061 | } |
| 1062 | } |
| 1063 | function has(key, isReadonly = false) { |
| 1064 | const target = this["__v_raw" /* ReactiveFlags.RAW */]; |
| 1065 | const rawTarget = toRaw(target); |
nothing calls this directly
no test coverage detected