Skip to content

Commit e7d4d71

Browse files
committed
Fix null/undefined check.
Fixes #18
1 parent 28366b7 commit e7d4d71

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ function ParseNumber(v: number | string, isInt = false): number {
1515
return (isInt ? parseInt(v) : parseFloat(v)) || 0;
1616
}
1717

18-
function FromArray<T>(Ctor: { new(v: any): T }, data?: any[] | any, def = null): T[] | null {
18+
function FromArray<T>(Ctor: { new (v: any): T }, data?: any[] | any, def = null): T[] | null {
1919
if (!data || !Object.keys(data).length) return def;
2020
const d = Array.isArray(data) ? data : [data];
2121
return d.map((v: any) => new Ctor(v));
2222
}
2323

2424
function ToObject(o: any, typeOrCfg: any = {}, child = false): any {
25-
if (!o) return null;
25+
if (o == null) return null;
2626
if (typeof o.toObject === 'function' && child) return o.toObject();
2727

2828
switch (typeof o) {

0 commit comments

Comments
 (0)