UNPKG

contentful-management

Version:
27 lines (24 loc) 822 B
import { toPlainObject, freezeSys } from 'contentful-sdk-core'; import copy from 'fast-copy'; import enhanceWithMethods from '../enhance-with-methods.js'; import { wrapCollection } from '../common-utils.js'; /** * @internal * @param makeRequest - function to make requests via an adapter * @param data - Raw data * @returns Normalized user */ function wrapUser(_makeRequest, data) { const user = toPlainObject(copy(data)); const userWithMethods = enhanceWithMethods(user, {}); return freezeSys(userWithMethods); } /** * @internal * @param makeRequest - function to make requests via an adapter * @param data - Raw data collection * @returns Normalized user collection */ const wrapUserCollection = wrapCollection(wrapUser); export { wrapUser, wrapUserCollection }; //# sourceMappingURL=user.js.map