diff --git a/src/core/obj.js b/src/core/obj.js index 161e8ca29..be62eab55 100644 --- a/src/core/obj.js +++ b/src/core/obj.js @@ -135,6 +135,22 @@ var Dict = (function DictClosure() { return Promise.resolve(value); }, + // Same as get(), but dereferences all elements if the result is an Array. + getArray: function Dict_getArray(key1, key2, key3) { + var value = this.get(key1, key2, key3); + if (!isArray(value)) { + return value; + } + value = value.slice(); // Ensure that we don't modify the Dict data. + for (var i = 0, ii = value.length; i < ii; i++) { + if (!isRef(value[i])) { + continue; + } + value[i] = this.xref.fetch(value[i]); + } + return value; + }, + // no dereferencing getRaw: function Dict_getRaw(key) { return this.map[key];