Move the isEmptyObj helper function from src/shared/util.js to test/unit/test_utils.js

Since this helper function is no longer used anywhere in the main code-base, but only in a couple of unit-tests, it's thus being moved to a more appropriate spot.

Finally, the implementation of `isEmptyObj` is also tweaked slightly by removing the manual loop.
This commit is contained in:
Jonas Jenwald 2020-06-09 16:48:03 +02:00
parent 159e13c4e4
commit 88fdb482b0
4 changed files with 10 additions and 20 deletions

View file

@ -175,6 +175,14 @@ function createIdFactory(pageIndex) {
return page.idFactory;
}
function isEmptyObj(obj) {
assert(
typeof obj === "object" && obj !== null,
"isEmptyObj - invalid argument."
);
return Object.keys(obj).length === 0;
}
export {
DOMFileReaderFactory,
NodeFileReaderFactory,
@ -184,4 +192,5 @@ export {
buildGetDocumentParams,
TEST_PDFS_PATH,
createIdFactory,
isEmptyObj,
};