Add File Commands (#571)

* Add File Commands

* pr updates w/ feedback

* run format

* fix lint/format

* slight update with an example in the docs

* pr feedback
This commit is contained in:
Thomas Boop
2020-09-23 11:19:20 -04:00
committed by GitHub
parent da34bfb74d
commit 0759cdc230
6 changed files with 203 additions and 61 deletions

View File

@@ -0,0 +1,15 @@
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string
*/
export function toCommandValue(input: any): string {
if (input === null || input === undefined) {
return ''
} else if (typeof input === 'string' || input instanceof String) {
return input as string
}
return JSON.stringify(input)
}