I have a utils/constant.js
file with:
// Key of total elements in remote collection
export const TOTAL_ELEMENTS = "totalElements";
I need to access to totalElements
via the constant.
import { TOTAL_ELEMENTS } from "./constants.js";
[...]
let data = {
content: "foo",
totalElements: 54
};
if(TOTAL_ELEMENTS in data) {
// pseudocode, of course it doesn't work.
// of course in my case need to return 54
const { TOTAL_ELEMENTS } = data;
return TOTAL_ELEMENTS;
}