Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@botmock-api/utils

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@botmock-api/utils - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

6

dist/index.js

@@ -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]);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc