UNPKG

semantic-network

Version:

A utility library for manipulating a list of links that form a semantic interface to a network of resources.

20 lines 812 B
export class JsonSerialiser { /** * A replacer function to strip the state from a model * see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify */ static ToJsonReplacer(key, value) { return key !== 'createForm' && key !== 'editForm' ? value : undefined; } /** * Returns a representation from a model that is already hydrated and looks close as possible to what * it looked like when it came over the wire. In this case, it removes the state attribute. * * @param resource * @param space number of spaces in the pretty print JSON */ static toJson(resource, space) { return JSON.stringify(resource, JsonSerialiser.ToJsonReplacer, space); } } //# sourceMappingURL=jsonSerialiser.js.map