Group the sources into aliased modules and lint with the published plugins
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// Type guards for values read from JSON, which arrive as `unknown`.
|
||||
export type JsonObject = NodeJS.Dict<unknown>;
|
||||
|
||||
// Any non-null object, arrays included: reading a missing key yields undefined.
|
||||
export function isObject(value: unknown): value is JsonObject {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
// A plain mapping, which an array is not.
|
||||
export function isMapping(value: unknown): value is JsonObject {
|
||||
return isObject(value) && !Array.isArray(value);
|
||||
}
|
||||
Reference in New Issue
Block a user