Socket
Socket
Sign inDemoInstall

alice-renderer

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

2

package.json
{
"name": "alice-renderer",
"version": "1.3.0",
"version": "1.3.1",
"description": "Replies renderer for Yandex Alice skills",

@@ -5,0 +5,0 @@ "author": {

@@ -19,16 +19,10 @@ /**

const select = arr => {
if (config.disableRandom) return arr[0];
const key = hasUserId() && getKey(arr);
return key
? selectNextElement(arr, key)
: selectRandomElement(arr);
: getRandomElement(arr);
};
/**
* Like getRandomElement, but returns first item if disableRandom = true
*/
const selectRandomElement = arr => {
return config.disableRandom ? arr[0] : getRandomElement(arr);
};
/**
* Returns not-repeated array element.

@@ -43,3 +37,3 @@ * For strings tries to select element with non-repeated words with prev element.

const mostDifferentIndexes = getMostDifferentIndexes(excludedIndexes, allowedIndexes, arr);
const index = selectRandomElement(mostDifferentIndexes);
const index = getRandomElement(mostDifferentIndexes);
savedIndexes.push(index);

@@ -93,3 +87,5 @@ setValue(key, savedIndexes);

// For array of strings build shorter key than JSON.stringify
return isStrings(arr) ? buildKeyFromStrings(arr) : JSON.stringify(arr);
return isStrings(arr)
? buildKeyFromStrings(arr)
: JSON.stringify(arr);
} catch(e) {

@@ -96,0 +92,0 @@ // in case of error, return empty key to fallback on getRandomElement()

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc