-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathisTextOutput.ts
More file actions
21 lines (19 loc) · 953 Bytes
/
isTextOutput.ts
File metadata and controls
21 lines (19 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { isFunction, isObject } from "../../lang";
type TextOutput = GoogleAppsScript.Content.TextOutput;
/**
* Checks if the given value is a Google Apps Script <a href="https://developers.google.com/apps-script/reference/content/text-output"><code>TextOutput</code></a> object.
*
* @param {unknown} value - The value to check.
* @returns {boolean} `true` if the value is an <a href="https://developers.google.com/apps-script/reference/content/text-output"><code>TextOutput</code></a> object, `false` otherwise.
* @see <a href="https://developers.google.com/apps-script/reference/content/text-output"><code>TextOutput</code></a>
* @since 1.0.0
* @version 1.0.0
* @environment `Google Apps Script`
*/
export function isTextOutput(value: unknown): value is TextOutput {
return (
isObject(value) &&
isFunction((value as TextOutput)?.getMimeType) &&
isFunction((value as TextOutput)?.getContent)
);
}