summaryrefslogtreecommitdiff
path: root/packages/backend/src/misc/json-value.ts
blob: bd7fe12058a03508283077de42ce9266d8f6c40b (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);
}