investira.sdk 2.3.9 → 2.3.11

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.
package/CHANGELOG.md CHANGED
@@ -492,3 +492,11 @@ O contrutor para a criação das mensagem foi alterado.
492
492
  # 2.3.9
493
493
 
494
494
  - [dates] Correção da chamada as constantes
495
+
496
+ # 2.3.10
497
+
498
+ - [dates] Correção da função workingDaysInMonth
499
+
500
+ # 2.3.11
501
+
502
+ - [strings] Nova função joinWords
@@ -469,8 +469,8 @@ const dates = {
469
469
  * @returns {number}
470
470
  */
471
471
  workingDaysInMonth: pDate => {
472
- let xDate1 = dates.addDays(dates.startOf('month', dates.toUTCDate(pDate)), -1);
473
- let xDate2 = dates.endOf('month', dates.toUTCDate(pDate));
472
+ let xDate1 = dates.addDays(dates.startOf('month', pDate), -1);
473
+ let xDate2 = dates.endOf('month', pDate);
474
474
  return dates.workingDaysBetween(xDate1, xDate2);
475
475
  },
476
476
  /**
@@ -186,7 +186,7 @@ const strings = {
186
186
  },
187
187
 
188
188
  /**
189
- *
189
+ * Retorna Strginfy do JSON
190
190
  *
191
191
  * @param {object} pValue
192
192
  * @param {object} pReplacer
@@ -195,6 +195,26 @@ const strings = {
195
195
  */
196
196
  stringify: (pValue, pReplacer, pSpace) => {
197
197
  return stringify(pValue, pReplacer, pSpace);
198
+ },
199
+
200
+ /**
201
+ * Retorna palavas separadas pelo separador informado e a última separada pelo último separador informado
202
+ *
203
+ * @param {Array} pWords
204
+ * @param {string} [pSeparator=', ']
205
+ * @param {string} [pLastSeparator=' e ']
206
+ * @returns {String}
207
+ */
208
+ joinWords: (pWords, pSeparator = ', ', pLastSeparator = ' e ') => {
209
+ if (!Array.isArray(pWords) || pWords.length === 0) {
210
+ return '';
211
+ }
212
+ if (pWords.length === 1) {
213
+ return pWords[0];
214
+ }
215
+ const xAllTheRest = pWords.slice(0, -1);
216
+ const xLastWord = pWords[pWords.length - 1];
217
+ return xAllTheRest.join(pSeparator) + (pLastSeparator || ' ') + xLastWord;
198
218
  }
199
219
  };
200
220
 
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "investira.sdk",
3
- "version": "2.3.9",
3
+ "version": "2.3.11",
4
4
  "author": "Investira",
5
5
  "description": "Investira SDK",
6
6
  "main": "index.js",
7
7
  "type": "commonjs",
8
8
  "registry": true,
9
- "raw": "investira.sdk@2.3.9",
9
+ "raw": "investira.sdk@2.3.11",
10
10
  "escapedName": "investira.sdk",
11
- "rawSpec": "2.3.9",
11
+ "rawSpec": "2.3.11",
12
12
  "saveSpec": null,
13
- "fetchSpec": "2.3.9",
13
+ "fetchSpec": "2.3.11",
14
14
  "homepage": "https://investira.com.br/",
15
15
  "engines": {
16
16
  "node": ">=11.11.0 <=18.12",