diff --git a/package.json b/package.json index 794699e..99a5d04 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,7 @@ "fuse.js": "^3.2.0", "loglevel": "^1.6.1", "loglevel-plugin-prefix": "^0.8.4", - "node-fetch": "^2.1.2", - "ramda": "^0.25.0" + "node-fetch": "^2.1.2" }, "devDependencies": { "@types/node-fetch": "^2.1.2", diff --git a/src/context.ts b/src/context.ts index 6f1738e..a0e4061 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,5 +1,4 @@ -import { compose } from 'ramda' -import { reversedInterpolation, selectCommand } from './utils' +import { reversedInterpolation, selectCommand, compose } from './utils' import Session from './session' import Scene from './scene' @@ -91,7 +90,9 @@ export default class Context implements IContext { } public enterScene(scene: Scene): void { - if (!scene) throw new Error('Please provide scene you want to enter in') + if (!scene) { + throw new Error('Please provide scene you want to enter in') + } const matchedScene = this.scenes.find(candidateScene => candidateScene.name === scene.name) this.session.setData('currentScene', matchedScene.name) } diff --git a/src/utils/index.ts b/src/utils/index.ts index 7c2368e..9e609e1 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -57,6 +57,9 @@ export const isFunction = (fn: (args: any) => any) => fn && typeof fn === 'funct export const delay = (ms: number): Promise => new Promise(resolve => setTimeout(resolve, ms)) export const rejectsIn = (ms: number) => new Promise((resolve, reject) => setTimeout(reject, ms)) +export const compose = (...fns) => + fns.reduceRight((prevFn, nextFn) => (...args) => nextFn(prevFn(...args)), value => value) + export default { getFiguresRegexp, selectCommand, diff --git a/tsconfig.json b/tsconfig.json index 7a5d955..87ebaf0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "paths": { "*": ["node_modules/*"] }, - "types": ["node", "jest", "express"], + "types": ["node", "jest"], "typeRoots": [ "node_modules/@types" ]