No description
Find a file
2025-05-24 20:20:15 -05:00
dist you know what fuck all the options 2025-05-24 16:21:05 -05:00
src oops sorry ts it was my bad 2025-05-24 20:20:15 -05:00
.gitignore update exports 2025-05-18 17:59:38 -05:00
package-lock.json use symbol.metadata 2025-05-18 21:42:39 -05:00
package.json prepare to add options 2025-05-22 03:35:53 -05:00
README.md i hate typescript generics!! i hate typescript generics!! 2025-05-24 17:14:32 -05:00
tsconfig.json update tsconfig 2025-05-18 20:37:00 -05:00

serde-ts

a library for serializing and deserializing javascript objects

Usage

this library makes no assumptions about formats and loosely follows the architecture of Rust's serde crate. the major difference are the particular data types. serde-ts's internal data model contains the following types

serde-ts data types

  • null/undefined
  • boolean
  • number
  • bigint
  • string
  • symbol
  • function
  • object
  • iterable
  • class

with the exception of iterables and classes, these types were chosen as they are the ones provided by Javascript's native typeof operator which is used internally for type checking.

there are four interfaces which are relevant to serde-ts users.

Serializer

a Serializer is responsible for transforming the internal serde-ts data model into the target serialization format. this means that it will have a serialize<Type> function for each of serde-ts's data types.

Deserializer

a Deserializer is responsible for transforming the target serialization format into the internal serde-ts data model. it will have a deserialize<Type> for each of the serde-ts's data types.

Serialize

Serialize is responsible for transforming a value to the internal data model. for example, a Vector2 may be internally serialized as an iterable of numbers.

Deserialize

Deserialize is responsible for transforming a value from the internal data model. it is the inverse of Serialize. depending on the Deserialize target, it may accept an iterable of numbers and produce a Vector2.