You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> A class that maps between a variety of data types.
2
+
> A class that can map various data types back and forth between a string representation that can be transferred over the wire or evaluated using eval() or new Function() expressions and back to the native environment. This is equivalent to `JSON.parse()` and `JSON.stringify()` except with a much broader scope.
3
3
4
4
## Installation
5
5
Simply do: `npm install @wessberg/marshaller`.
6
6
7
7
## DISCLAIMER
8
8
9
-
This is an early version. There are still some data types that aren't fully handled.
10
-
You can use this now in production, but keep track of the roadmap inside this readme.
9
+
This is an early version. There may still be bugs. If you run into some, please submit an issue on GitHub.
@@ -55,12 +136,26 @@ The marshalled version of the input data.
55
136
*[X] Casting from/to `Date`.
56
137
*[X] Casting from/to `Function`
57
138
*[X] Casting from/to `Map`
58
-
*[ ] Casting from/to `WeakSet`
59
-
*[ ] Casting from/to `WeakMap`
60
-
*[ ] Casting from/to `RegExp`
139
+
*[X] Casting from/to `WeakSet` (*)
140
+
*[X] Casting from/to `WeakMap` (*)
141
+
*[X] Casting from/to `RegExp`
142
+
143
+
The (*) means that the types cannot be restored to their initial state since the keys are weak and not iterable. There are no way of restoring the state. Instead, new instances will be created.
61
144
62
145
## Changelog:
63
146
147
+
**v1.1.0**:
148
+
149
+
- Major overhaul. Where the Marshaller could previously map between any types, the Marshaller now has a sharp focus on being able to marshal any data to a string representation and be able to unmarshal the data back into the native representation in a non-destructive operation (e.g. all data should be re-retrievable).
150
+
151
+
-`RegExp`, `WeakMap` and `WeakSet` is now supported.
152
+
153
+
- Smaller size.
154
+
155
+
**v1.0.25**:
156
+
157
+
- Class instances can now be marshalled to strings and marshalled back into a native representation while stile preserving the instance values that has been set over time. This allows for, among other things, sending an instance of a class over the wire and then "reassembling" the class and instance values. For the user, this feels like sending a complex class instance via HTTP.
0 commit comments