@botmock-api/utils
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -25,2 +25,4 @@ "use strict"; | ||
}) | ||
// map each message that has an intent to arrays of key, value | ||
// tuples for the sake of the map constructor | ||
.map(function (message) { return [ | ||
@@ -68,3 +70,2 @@ message.message_id, | ||
var localCollected = collected; | ||
var witnessedMessages = []; | ||
// iterate over all next messages; if message not found in intent map, | ||
@@ -74,4 +75,3 @@ // explore this message's next messages | ||
var message_id = next_1[_i].message_id; | ||
witnessedMessages.push(message_id); | ||
if (!map.has(message_id) && !witnessedMessages.includes(message_id)) { | ||
if (!map.has(message_id)) { | ||
var next_message_ids = getMessage(message_id).next_message_ids; | ||
@@ -78,0 +78,0 @@ localCollected = f(next_message_ids, collected.concat([message_id])); |
{ | ||
"name": "@botmock-api/utils", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "utilities for handling data from the Botmock API", | ||
@@ -37,3 +37,3 @@ "main": "dist/index.js", | ||
"@types/jest": "24.0.15", | ||
"@types/node": "12.0.8", | ||
"@types/node": "12.0.10", | ||
"jest": "24.8.0", | ||
@@ -40,0 +40,0 @@ "ts-jest": "^24.0.2", |
@@ -15,4 +15,8 @@ # utils | ||
`createIntentMap(messages: Message[], intents: Intent[]): IntentMap` | ||
### `createIntentMap(messages: Message[], intents: Intent[]): IntentMap` | ||
Returns a map of message ids and any intents connected to them. | ||
### `createMessageCollector(map: IntentMap, getMessage: (id: string) => Message): () => string[]` | ||
Returns a function that collects all messages not connected by an intent. |
@@ -47,2 +47,4 @@ type Utterance = { | ||
.filter(({ intent = { value: "" } }) => intent.value) | ||
// map each message that has an intent to arrays of key, value | ||
// tuples for the sake of the map constructor | ||
.map(message => [ | ||
@@ -90,8 +92,6 @@ message.message_id, | ||
let localCollected = collected; | ||
const witnessedMessages: string[] = []; | ||
// iterate over all next messages; if message not found in intent map, | ||
// explore this message's next messages | ||
for (const { message_id } of next) { | ||
witnessedMessages.push(message_id); | ||
if (!map.has(message_id) && !witnessedMessages.includes(message_id)) { | ||
if (!map.has(message_id)) { | ||
const { next_message_ids } = getMessage(message_id); | ||
@@ -98,0 +98,0 @@ localCollected = f(next_message_ids, [...collected, message_id]); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16405
22