summaryrefslogtreecommitdiff
path: root/packages/backend/src/misc/json-value.ts
blob: 195f7c4d476e2908d6a8be8e0ef3a121ef71c9ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

export type JsonValue = JsonArray | JsonObject | string | number | boolean | null;
export type JsonObject = { [K in string]?: JsonValue };
export type JsonArray = JsonValue[];

export function isJsonObject(value: JsonValue | undefined): value is JsonObject {
	return typeof value === 'object' && value !== null && !Array.isArray(value);
}