react-native-drawing
Version:
A React Native library that provides a canvas to perform drawing actions
21 lines (20 loc) • 458 B
JavaScript
/**
* An object to serialize structurable data
*/
export class Codec {
constructor(fixStruct) {
Object.defineProperty(this, "fixStruct", {
enumerable: true,
configurable: true,
writable: true,
value: fixStruct
});
}
toData(json) {
const struct = JSON.parse(json);
return this.fixStruct(struct);
}
toJSON(data) {
return JSON.stringify(data);
}
}