Skip to content

Commit 71eea6c

Browse files
committed
Bumped TypeDetector dependency. Allowed construction without explicitly calling the constructor with TypeDetector so it can be used by clients who does not directly depend on it.
1 parent 209ecaa commit 71eea6c

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ The (*) means that the types cannot be restored to their initial state since the
144144

145145
## Changelog:
146146

147+
**v2.0.1**:
148+
149+
- Bumped TypeDetector dependency. Allowed construction without explicitly calling the constructor with TypeDetector so it can be used by clients who does not directly depend on it.
150+
147151
**v2.0.0**:
148152

149153
- 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).

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
"license": "MIT",
2626
"devDependencies": {
2727
"ava": "^0.19.1",
28-
"typescript": "^2.4.0"
28+
"typescript": "^2.4.1"
2929
},
3030
"dependencies": {
3131
"@wessberg/globalobject": "^1.0.5",
32-
"@wessberg/typedetector": "^1.0.5"
32+
"@wessberg/typedetector": "^1.0.6"
3333
}
3434
}

src/Marshaller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ITypeDetector} from "@wessberg/typedetector";
1+
import {ITypeDetector, TypeDetector} from "@wessberg/typedetector";
22
import {IMarshaller} from "./interface/IMarshaller";
33
import {GlobalObject, GlobalObjectIdentifier} from "@wessberg/globalobject";
44

@@ -25,7 +25,7 @@ export class Marshaller implements IMarshaller {
2525
private static readonly DEFAULT_DATE_STRING_REGEX: RegExp = /\w{3} \w{3} \d{2} \d{4} \d{2}:\d{2}:\d{2} GMT(\+\d+)? \(\w{1,9}\)/;
2626
private static readonly REGEX_REGEX: RegExp = /^\/(.*)\/(\w*)$/;
2727

28-
constructor (private typeDetector: ITypeDetector) {
28+
constructor (private typeDetector: ITypeDetector = new TypeDetector()) {
2929
}
3030

3131
/**
@@ -555,7 +555,7 @@ export class Marshaller implements IMarshaller {
555555

556556
private handleComputedItem (data: {}|null|undefined|string): {}|null|undefined|string {
557557
if (this.shouldUnmarshalComputedItem(data)) return this.unmarshal(data);
558-
if (this.typeDetector.isClassInstance(data)) return this.reconstructClassInstance(data);
558+
if (data != null && this.typeDetector.isClassInstance(data)) return this.reconstructClassInstance(data);
559559
return data;
560560
}
561561

0 commit comments

Comments
 (0)