*If object is null, default to empty object
This commit is contained in:
parent
03a5933394
commit
237e5796a8
|
@ -23,7 +23,7 @@ export function flatten(target: any, opts: any = {}): any[] {
|
|||
function step(object: any, prev?: any, currentDepth?: any) {
|
||||
currentDepth = currentDepth || 1;
|
||||
if (!Array.isArray(object)) {
|
||||
object = Object.keys(object);
|
||||
object = Object.keys(object ?? {});
|
||||
}
|
||||
object.forEach(function (key: any) {
|
||||
const value = object[key];
|
||||
|
|
Loading…
Reference in New Issue