diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-08-15 22:36:36 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-08-15 22:36:36 -0400 |
commit | eb8033aea536e817d49379f50530feca13d0c115 (patch) | |
tree | 3b1ebe6cb38390b9b4485bbe87fb3194c41a06ad /src/Utils.ts | |
parent | 5da62eef1dbf9509ac7bce73d927d835d98716d4 (diff) | |
parent | 46386fd73a06e52d606f891c812a9af0598eec79 (diff) |
Merge branch 'master' into monika_ellie_UI
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 502540eb0..959b89fe5 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -3,6 +3,7 @@ import v5 = require("uuid/v5"); import { Socket } from 'socket.io'; import { Message } from './server/Message'; import { RouteStore } from './server/RouteStore'; +import requestPromise = require('request-promise'); export class Utils { @@ -132,6 +133,8 @@ export function WithKeys(obj: any, keys: string[], addKeyFunc?: (dup: any) => vo return dup; } +export function numberRange(num: number) { return Array.from(Array(num)).map((v, i) => i); } + export function returnTrue() { return true; } export function returnFalse() { return false; } @@ -173,4 +176,14 @@ export namespace JSONUtils { return results; } +} + +export function PostToServer(relativeRoute: string, body: any) { + let options = { + method: "POST", + uri: Utils.prepend(relativeRoute), + json: true, + body: body + }; + return requestPromise.post(options); }
\ No newline at end of file |