From 003f594f6348b55109dd66416e75fcc2a88faade Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 26 Nov 2022 23:44:08 -0400 Subject: finish up cosmetic style changes --- src/data/serialize.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/data/serialize.js') diff --git a/src/data/serialize.js b/src/data/serialize.js index a4206fd0..52aacb07 100644 --- a/src/data/serialize.js +++ b/src/data/serialize.js @@ -1,6 +1,4 @@ -/** @format */ - -// serialize-util.js: simple interface and utility functions for converting +// serialize.js: simple interface and utility functions for converting // Things into a directly serializeable format // Utility functions @@ -27,17 +25,14 @@ export const serializeDescriptors = Symbol(); export function serializeThing(thing) { const descriptors = thing.constructor[serializeDescriptors]; + if (!descriptors) { - throw new Error( - `Constructor ${thing.constructor.name} does not provide serialize descriptors` - ); + throw new Error(`Constructor ${thing.constructor.name} does not provide serialize descriptors`); } return Object.fromEntries( - Object.entries(descriptors).map(([property, transform]) => [ - property, - transform(thing[property]), - ]) + Object.entries(descriptors) + .map(([property, transform]) => [property, transform(thing[property])]) ); } -- cgit 1.3.0-6-gf8a5