@indra.ai/deva 1.1.80 → 1.1.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +26 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -763,7 +763,7 @@ class Deva {
763
763
  method, // set method to track function use
764
764
  params, // set any params that are associated
765
765
  },
766
- text, // set the text for the packet
766
+ text, // set the text for the packet.
767
767
  data, // set the data object
768
768
  created: Date.now(), // timestamp the question
769
769
  }
@@ -1783,6 +1783,31 @@ class Deva {
1783
1783
  return parseFloat(n).toFixed(dec) + '%';
1784
1784
  }
1785
1785
 
1786
+ /**************
1787
+ func: trimText
1788
+ params:
1789
+ - text: The text to trim.
1790
+ - maxwords: The number of words to max.
1791
+ describe:
1792
+ A utility function to trimText intput to a specific word count.
1793
+ ***************/
1794
+ trimWords(text, maxwords) {
1795
+ const splitter = text.split(' ');
1796
+ if (splitter < maxwords) return text;
1797
+ return splitter.slice(0, maxwords).join(' ');
1798
+ }
1799
+
1800
+ dupes(dupers) {
1801
+ if (!Array.isArray(dupers)) return dupers;
1802
+ const check = [];
1803
+ return dupers.filter(dupe => {
1804
+ if (!check.includes(dupe)) {
1805
+ check.push(dupe);
1806
+ return dupe;
1807
+ }
1808
+ });
1809
+ }
1810
+
1786
1811
  /**************
1787
1812
  func: error
1788
1813
  params:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.80",
3
+ "version": "1.1.82",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {