UNPKG

contentful-sdk-core

Version:
20 lines (19 loc) 600 B
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 */ export default 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); }, }); }