This commit is contained in:
Leifer Mendez
2022-11-08 21:41:16 +01:00
parent 2114800b84
commit 576092fc96
26 changed files with 408 additions and 801 deletions

View File

@@ -0,0 +1,20 @@
class FlowClass {
flow
constructor(_flow) {
this.flow = _flow
}
find = (message, ref = false) => {
let keyRef = ref
let ansRef = null
if (!keyRef) {
keyRef =
this.flow.find((n) => n.keyword.includes(message))?.ref || null
}
ansRef = this.flow.find((n) => n.keyword === keyRef)
if (ansRef) return ansRef
return false
}
}
module.exports = FlowClass

View File

@@ -1,4 +1,3 @@
const { addKeyword, addAnswer } = require('./methods')
module.exports = { addKeyword, addAnswer }
const FlowClass = require('./classes/flow.class')
module.exports = { addKeyword, addAnswer, instance: FlowClass }

View File

@@ -4,16 +4,6 @@
"description": "",
"main": "index.js",
"private": true,
"scripts": {
"io:dev": "node ./index.js",
"io:rollup": "node ../../node_modules/.bin/rollup index.js --config ./rollup-cli.config.js",
"format:check": "prettier --check .",
"format:write": "prettier --write .",
"lint:check": "eslint .",
"lint:fix": "eslint --fix .",
"test:io": "node ../../node_modules/uvu/bin.js tests",
"build:io": "npm run format:write && npm run lint:fix && npm run io:rollup"
},
"keywords": [],
"author": "",
"license": "ISC",

View File

@@ -3,7 +3,7 @@ const commonjs = require('@rollup/plugin-commonjs')
module.exports = {
input: 'index.js',
output: {
file: 'lib/io/bundle.cjs',
file: 'lib/io/bundle.io.cjs',
format: 'cjs',
},
plugins: [commonjs()],