File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ The marshalled version of the input data.
5353
5454## Changelog:
5555
56+ ** v1.14.0** :
57+
58+ - Added a proxy for the ` getTypeOf ` method of the dependent ` typeDetector ` library.
59+
5660** v1.13.0** :
5761
5862- Small fixes to the function regexes.
Original file line number Diff line number Diff line change 11import { IMarshaller , Newable } from "./interface/IMarshaller" ;
2- import { ITypeDetector , IArbitraryObject } from "@wessberg/typedetector" ;
2+ import { ITypeDetector , IArbitraryObject , TypeOf } from "@wessberg/typedetector" ;
33
44/**
55 * A class that maps between a variety of data types.
@@ -26,6 +26,15 @@ export class Marshaller implements IMarshaller {
2626 else return < U | null > this . marshalToBestGuess < T > ( data ) ;
2727 }
2828
29+ /**
30+ * A proxy for the 'getTypeOf' operation of the typeDetector.
31+ * @param {T } data
32+ * @returns {TypeOf }
33+ */
34+ public getTypeOf < T > ( data : T ) : TypeOf {
35+ return this . typeDetector . getTypeof ( data ) ;
36+ }
37+
2938 /**
3039 * Marshals a string into null.
3140 * @param {string } _
@@ -989,7 +998,7 @@ export class Marshaller implements IMarshaller {
989998 if ( typeof to === null ) return this . marshalToNull ( data ) ;
990999 if ( typeof to === "symbol" || to === Symbol ) return this . marshalToSymbol ( data ) ;
9911000 if ( this . typeDetector . isString ( to ) || to === String ) return this . marshalToString ( data ) ;
992- if ( data instanceof Set || to === Set ) return this . marshalToSet ( data ) ;
1001+ if ( to instanceof Set || to === Set ) return this . marshalToSet ( data ) ;
9931002 if ( Array . isArray ( to ) || to === Array ) return this . marshalToArray ( data ) ;
9941003 if ( this . typeDetector . isObject ( to ) || to === Object ) return this . marshalToObject ( data ) ;
9951004 if ( this . typeDetector . isBoolean ( to ) || to === Boolean ) return this . marshalToBoolean ( data ) ;
Original file line number Diff line number Diff line change 1+ export { TypeOf } from '@wessberg/typedetector' ;
12export { IMarshaller , Newable } from "./interface/IMarshaller" ;
23export { Marshaller } from "./Marshaller" ;
You can’t perform that action at this time.
0 commit comments