FIX: prevents errors on /tags when a tag constructor exists (#10449)

This is due to js objects having a constructor property:

```
const obj = {};
obj['constructor'] // return [native code] and not undefined
```
This commit is contained in:
Joffrey JAFFEUX
2020-08-17 17:40:34 +02:00
committed by GitHub
parent ef9af004f7
commit 6d0eb7178d
2 changed files with 5 additions and 4 deletions

View File

@@ -25,21 +25,21 @@ function storeMap(type, id, obj) {
function fromMap(type, id) {
const byType = _identityMap[type];
if (byType) {
if (byType && byType.hasOwnProperty(id)) {
return byType[id];
}
}
function removeMap(type, id) {
const byType = _identityMap[type];
if (byType) {
if (byType && byType.hasOwnProperty(id)) {
delete byType[id];
}
}
function findAndRemoveMap(type, id) {
const byType = _identityMap[type];
if (byType) {
if (byType && byType.hasOwnProperty(id)) {
const result = byType[id];
delete byType[id];
return result;