mirror of https://github.com/grpc/grpc-node.git
isArray instead of instanceof for consistent checking
This commit is contained in:
parent
04395a0bc8
commit
1d7ed8167a
|
|
@ -269,7 +269,7 @@ export function load(filename: string, options?: Options): Promise<PackageDefini
|
|||
const root: Protobuf.Root = new Protobuf.Root();
|
||||
options = options || {};
|
||||
if (!!options.includeDirs) {
|
||||
if (!(options.includeDirs instanceof Array)) {
|
||||
if (!(Array.isArray(options.includeDirs))) {
|
||||
return Promise.reject(new Error('The includeDirs option must be an array'));
|
||||
}
|
||||
addIncludePathResolver(root, options.includeDirs as string[]);
|
||||
|
|
@ -284,7 +284,7 @@ export function loadSync(filename: string, options?: Options): PackageDefinition
|
|||
const root: Protobuf.Root = new Protobuf.Root();
|
||||
options = options || {};
|
||||
if (!!options.includeDirs) {
|
||||
if (!(options.includeDirs instanceof Array)) {
|
||||
if (!(Array.isArray(options.includeDirs))) {
|
||||
throw new Error('The include option must be an array');
|
||||
}
|
||||
addIncludePathResolver(root, options.includeDirs as string[]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue