Skip to content

Potential type error at normalizeOptions(...) #227

@yfwz100

Description

@yfwz100

See:

BrowserFS/src/core/FS.ts

Lines 79 to 87 in bef1dc0

function normalizeOptions(options: any, defEnc: string | null, defFlag: string, defMode: number | null): {encoding: string; flag: string; mode: number} {
switch (typeof options) {
case 'object':
return {
encoding: typeof options['encoding'] !== 'undefined' ? options['encoding'] : defEnc,
flag: typeof options['flag'] !== 'undefined' ? options['flag'] : defFlag,
mode: normalizeMode(options['mode'], defMode!)
};
case 'string':

If options in normalizeOptions(...) is null, typeof options equals "object" and the following code will throw a TypeError:

encoding: typeof options['encoding'] !== 'undefined' ? options['encoding'] : defEnc,

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions