contentful-sdk-core
Version:
Core modules for the Contentful JS SDKs
24 lines (21 loc) • 668 B
JavaScript
import copy from 'fast-copy';
/**
* Mixes in a method to return just a plain object with no additional methods
* @private
* @param data - Any plain JSON response returned from the API
* @return Enhanced object with toPlainObject method
*/
function toPlainObject(data) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
return Object.defineProperty(data, 'toPlainObject', {
enumerable: false,
configurable: false,
writable: false,
value: function () {
return copy(this);
},
});
}
export { toPlainObject as default };
//# sourceMappingURL=to-plain-object.js.map