@vanillaes/absurdum 2.0.7 → 2.0.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.
Files changed (127) hide show
  1. package/README.md +3 -3
  2. package/index.d.ts +3 -3
  3. package/index.js +2 -0
  4. package/index.min.js +3 -3
  5. package/package.json +6 -13
  6. package/src/arrays/chunk.d.ts +5 -6
  7. package/src/arrays/chunk.js +6 -6
  8. package/src/arrays/compact.d.ts +4 -5
  9. package/src/arrays/compact.js +5 -6
  10. package/src/arrays/difference.d.ts +5 -6
  11. package/src/arrays/difference.js +6 -7
  12. package/src/arrays/drop.d.ts +5 -6
  13. package/src/arrays/drop.js +5 -6
  14. package/src/arrays/dropRight.d.ts +5 -6
  15. package/src/arrays/dropRight.js +5 -6
  16. package/src/arrays/fill.d.ts +6 -7
  17. package/src/arrays/fill.js +5 -6
  18. package/src/arrays/filter.d.ts +4 -5
  19. package/src/arrays/filter.js +5 -6
  20. package/src/arrays/find.d.ts +3 -4
  21. package/src/arrays/find.js +7 -6
  22. package/src/arrays/findIndex.d.ts +3 -4
  23. package/src/arrays/findIndex.js +3 -4
  24. package/src/arrays/findLastIndex.d.ts +3 -4
  25. package/src/arrays/findLastIndex.js +4 -5
  26. package/src/arrays/flat.d.ts +5 -6
  27. package/src/arrays/flat.js +5 -6
  28. package/src/arrays/frequency.d.ts +6 -5
  29. package/src/arrays/frequency.js +8 -7
  30. package/src/arrays/intersection.d.ts +5 -6
  31. package/src/arrays/intersection.js +7 -6
  32. package/src/arrays/map.d.ts +4 -5
  33. package/src/arrays/map.js +5 -6
  34. package/src/arrays/pull.d.ts +4 -5
  35. package/src/arrays/pull.js +5 -6
  36. package/src/arrays/take.d.ts +5 -6
  37. package/src/arrays/take.js +5 -6
  38. package/src/arrays/takeRight.d.ts +5 -6
  39. package/src/arrays/takeRight.js +5 -6
  40. package/src/arrays/union.d.ts +4 -5
  41. package/src/arrays/union.js +4 -5
  42. package/src/arrays/unique.d.ts +4 -5
  43. package/src/arrays/unique.js +4 -5
  44. package/src/arrays/unzip.d.ts +4 -5
  45. package/src/arrays/unzip.js +6 -5
  46. package/src/arrays/without.d.ts +4 -4
  47. package/src/arrays/without.js +5 -6
  48. package/src/arrays/xor.d.ts +4 -5
  49. package/src/arrays/xor.js +5 -6
  50. package/src/arrays/zip.d.ts +6 -7
  51. package/src/arrays/zip.js +7 -8
  52. package/src/objects/assign.d.ts +1 -3
  53. package/src/objects/assign.js +3 -3
  54. package/src/objects/at.d.ts +2 -4
  55. package/src/objects/at.js +3 -3
  56. package/src/objects/defaults.d.ts +1 -3
  57. package/src/objects/defaults.js +3 -3
  58. package/src/objects/defaultsDeep.d.ts +1 -3
  59. package/src/objects/defaultsDeep.js +3 -3
  60. package/src/objects/entries.d.ts +1 -3
  61. package/src/objects/entries.js +3 -3
  62. package/src/objects/filter.d.ts +3 -5
  63. package/src/objects/filter.js +2 -3
  64. package/src/objects/findKey.d.ts +2 -4
  65. package/src/objects/findKey.js +2 -3
  66. package/src/objects/findLastKey.d.ts +2 -4
  67. package/src/objects/findLastKey.js +2 -3
  68. package/src/objects/forIn.d.ts +3 -5
  69. package/src/objects/forIn.js +3 -4
  70. package/src/objects/fromEntries.d.ts +1 -3
  71. package/src/objects/fromEntries.js +3 -3
  72. package/src/objects/get.d.ts +1 -4
  73. package/src/objects/get.js +2 -3
  74. package/src/objects/has.d.ts +1 -4
  75. package/src/objects/has.js +3 -3
  76. package/src/objects/invert.d.ts +1 -3
  77. package/src/objects/invert.js +3 -3
  78. package/src/objects/mapKeys.d.ts +3 -5
  79. package/src/objects/mapKeys.js +2 -3
  80. package/src/objects/mapValues.d.ts +3 -5
  81. package/src/objects/mapValues.js +2 -3
  82. package/src/objects/merge.d.ts +1 -3
  83. package/src/objects/merge.js +3 -3
  84. package/src/objects/pick.d.ts +1 -3
  85. package/src/objects/pick.js +3 -3
  86. package/src/objects/result.d.ts +1 -4
  87. package/src/objects/result.js +2 -3
  88. package/src/objects/transform.d.ts +3 -5
  89. package/src/objects/transform.js +2 -3
  90. package/src/objects/values.d.ts +2 -4
  91. package/src/objects/values.js +3 -3
  92. package/src/strings/camelCase.d.ts +2 -4
  93. package/src/strings/camelCase.js +2 -4
  94. package/src/strings/chomp.d.ts +1 -4
  95. package/src/strings/chomp.js +1 -3
  96. package/src/strings/deburr.d.ts +2 -4
  97. package/src/strings/deburr.js +3 -4
  98. package/src/strings/endsWith.d.ts +1 -4
  99. package/src/strings/endsWith.js +3 -3
  100. package/src/strings/includes.d.ts +1 -3
  101. package/src/strings/includes.js +1 -3
  102. package/src/strings/kebabCase.d.ts +2 -4
  103. package/src/strings/kebabCase.js +2 -4
  104. package/src/strings/pad.d.ts +2 -6
  105. package/src/strings/pad.js +1 -3
  106. package/src/strings/padEnd.d.ts +2 -6
  107. package/src/strings/padEnd.js +2 -4
  108. package/src/strings/padStart.d.ts +2 -6
  109. package/src/strings/padStart.js +2 -4
  110. package/src/strings/pascalCase.d.ts +2 -4
  111. package/src/strings/pascalCase.js +2 -4
  112. package/src/strings/repeat.d.ts +1 -3
  113. package/src/strings/repeat.js +1 -3
  114. package/src/strings/reverse.d.ts +0 -2
  115. package/src/strings/reverse.js +1 -3
  116. package/src/strings/snakeCase.d.ts +2 -4
  117. package/src/strings/snakeCase.js +2 -4
  118. package/src/strings/startsWith.d.ts +0 -3
  119. package/src/strings/startsWith.js +3 -3
  120. package/src/strings/trimEnd.d.ts +3 -5
  121. package/src/strings/trimEnd.js +2 -4
  122. package/src/strings/trimStart.d.ts +3 -5
  123. package/src/strings/trimStart.js +2 -4
  124. package/src/strings/truncate.d.ts +9 -11
  125. package/src/strings/truncate.js +3 -5
  126. package/src/strings/words.d.ts +3 -7
  127. package/src/strings/words.js +3 -5
@@ -1,15 +1,12 @@
1
1
  /**
2
2
  * StartsWith tests a string to see if it starts with a substring
3
- *
4
3
  * @param {string} string input string
5
4
  * @param {string} substr substring to test
6
5
  * @returns {boolean} does the input start with the substring?
7
- *
8
6
  * @example
9
7
  * const result = strings.startsWith('This sentence starts with', 'This');
10
8
  * console.log(result);
11
9
  * > true
12
- *
13
10
  * @example
14
11
  * const result = strings.startsWith('This sentence does not start with', 'Nope');
15
12
  * console.log(result);
@@ -1,3 +1,5 @@
1
+ // @ts-nocheck TODO: Fix types on this late
2
+
1
3
  /**
2
4
  * StartsWith tests a string to see if it starts with a substring
3
5
  * @param {string} string input string
@@ -12,7 +14,7 @@
12
14
  * console.log(result);
13
15
  * > false
14
16
  */
15
- function startsWith (string, substr) {
17
+ export function startsWith (string, substr) {
16
18
  let chars = string.split('')
17
19
 
18
20
  const reducer = (acc, curr, idx, arr) => {
@@ -31,5 +33,3 @@ function startsWith (string, substr) {
31
33
 
32
34
  return chars.reduce(reducer, null)
33
35
  }
34
-
35
- export { startsWith }
@@ -1,13 +1,11 @@
1
1
  /**
2
2
  * TrimEnd trims any whitespace or the selected characters from the end of the string
3
- *
4
- * @param {string} [string] input string
5
- * @param {string} [chars=' '] characters to remove from end of the string
3
+ * @param {string} string input string
4
+ * @param {string} [chars] characters to remove from end of the string (default ' ')
6
5
  * @returns {string} string with the characters removed from end of the string
7
- *
8
6
  * @example
9
7
  * const result = strings.trimEnd('-_-abc-_-', '_-');
10
8
  * console.log(result);
11
9
  * > '-_-abc'
12
10
  */
13
- export function trimEnd(string?: string, chars?: string): string;
11
+ export function trimEnd(string: string, chars?: string): string;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TrimEnd trims any whitespace or the selected characters from the end of the string
3
- * @param {string} [string] input string
3
+ * @param {string} string input string
4
4
  * @param {string} [chars] characters to remove from end of the string (default ' ')
5
5
  * @returns {string} string with the characters removed from end of the string
6
6
  * @example
@@ -8,7 +8,7 @@
8
8
  * console.log(result);
9
9
  * > '-_-abc'
10
10
  */
11
- function trimEnd (string, chars = ' ') {
11
+ export function trimEnd (string, chars = ' ') {
12
12
  const testChars = new Set([...chars])
13
13
  let end = true
14
14
  return [...string].reduceRight((acc, curr) => {
@@ -24,5 +24,3 @@ function trimEnd (string, chars = ' ') {
24
24
  }
25
25
  }, '')
26
26
  }
27
-
28
- export { trimEnd }
@@ -1,13 +1,11 @@
1
1
  /**
2
2
  * TrimStart trims any whitespace or the selected characters from the beginning of the string
3
- *
4
- * @param {string} [string] input string
5
- * @param {string} [chars=' '] characters to remove from beginning of string
3
+ * @param {string} string input string
4
+ * @param {string} [chars] characters to remove from beginning of string (default ' ')
6
5
  * @returns {string} string with the characters removed from beginning
7
- *
8
6
  * @example
9
7
  * const result = strings.trimStart('-_-abc-_-', '_-');
10
8
  * console.log(result);
11
9
  * > 'abc-_-'
12
10
  */
13
- export function trimStart(string?: string, chars?: string): string;
11
+ export function trimStart(string: string, chars?: string): string;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TrimStart trims any whitespace or the selected characters from the beginning of the string
3
- * @param {string} [string] input string
3
+ * @param {string} string input string
4
4
  * @param {string} [chars] characters to remove from beginning of string (default ' ')
5
5
  * @returns {string} string with the characters removed from beginning
6
6
  * @example
@@ -8,7 +8,7 @@
8
8
  * console.log(result);
9
9
  * > 'abc-_-'
10
10
  */
11
- function trimStart (string, chars = ' ') {
11
+ export function trimStart (string, chars = ' ') {
12
12
  const testChars = new Set([...chars])
13
13
  let first = true
14
14
  return [...string].reduce((acc, curr) => {
@@ -24,5 +24,3 @@ function trimStart (string, chars = ' ') {
24
24
  }
25
25
  }, '')
26
26
  }
27
-
28
- export { trimStart }
@@ -1,21 +1,19 @@
1
1
  /**
2
2
  * Truncates string if it's longer than the given maximum string length. The last characters
3
3
  * of the truncated string are replaced with the omission string which defaults to "...".
4
- *
5
- * @param {string} [string] string to truncate
6
- * @param {Object} [options={}] object containing options
7
- * @param {number} [options.length=30] Max length of truncated string
8
- * @param {string} [options.omission='...'] string to indicate omitted text
4
+ * @param {string} string string to truncate
5
+ * @param {object} [options] object containing options (default {})
6
+ * @param {number} [options.length] Max length of truncated string (default 30)
7
+ * @param {string} [options.omission] string to indicate omitted text (default '...')
9
8
  * @param {RegExp|string} [options.separator] the pattern to end truncation
10
9
  * @returns {string} returns truncated string
11
- *
12
10
  * @example
13
11
  * const result = strings.truncate('This sentence starts with', 'This');
14
12
  * console.log(result);
15
13
  * > true
16
- **/
17
- export function truncate(string?: string, options?: {
18
- length?: number;
19
- omission?: string;
20
- separator?: string | RegExp;
14
+ */
15
+ export function truncate(string: string, options?: {
16
+ length?: number | undefined;
17
+ omission?: string | undefined;
18
+ separator?: string | RegExp | undefined;
21
19
  }): string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Truncates string if it's longer than the given maximum string length. The last characters
3
3
  * of the truncated string are replaced with the omission string which defaults to "...".
4
- * @param {string} [string] string to truncate
4
+ * @param {string} string string to truncate
5
5
  * @param {object} [options] object containing options (default {})
6
6
  * @param {number} [options.length] Max length of truncated string (default 30)
7
7
  * @param {string} [options.omission] string to indicate omitted text (default '...')
@@ -12,7 +12,7 @@
12
12
  * console.log(result);
13
13
  * > true
14
14
  */
15
- function truncate (string, options = {}) {
15
+ export function truncate (string, options = {}) {
16
16
  let length = 30
17
17
  let omission = '...'
18
18
  let separator
@@ -29,7 +29,7 @@ function truncate (string, options = {}) {
29
29
  let result = string.slice(0, end)
30
30
  if (separator === undefined) { return result + omission }
31
31
 
32
- let strSeparator
32
+ let strSeparator = ''
33
33
  let regexSeparator
34
34
  if (typeof separator === 'string') {
35
35
  strSeparator = separator
@@ -60,5 +60,3 @@ function truncate (string, options = {}) {
60
60
  }
61
61
  return result + omission
62
62
  }
63
-
64
- export { truncate }
@@ -1,23 +1,19 @@
1
1
  /**
2
2
  * Splits `string` into an array of its words.
3
- *
4
- * @param {string} [string] string to inspect for words
3
+ * @param {string} string string to inspect for words
5
4
  * @param {RegExp|string} [pattern] regex pattern to match words or string of characters to split words by.
6
- * @returns {Array} Returns an array of words
7
- *
5
+ * @returns {string[]} Returns an array of words
8
6
  * @example
9
7
  * const result = words('I can, I should, & I will');
10
8
  * console.log(result);
11
9
  * // => ['I', 'can', 'I', 'should', 'I', 'will']
12
- *
13
10
  * @example
14
11
  * const result = words('I can, I should, & I will', ' ,');
15
12
  * console.log(result);
16
13
  * // => ['I', 'can', 'I', 'should', '&', 'I', 'will']
17
- *
18
14
  * @example
19
15
  * const result = words('I can, I should, & I will', /[^, ]+/g);
20
16
  * console.log(result);
21
17
  * // => ['I', 'can', 'I', 'should', '&', 'I', 'will']
22
18
  */
23
- export function words(string?: string, pattern?: string | RegExp): any[];
19
+ export function words(string: string, pattern?: RegExp | string): string[];
@@ -2,9 +2,9 @@
2
2
 
3
3
  /**
4
4
  * Splits `string` into an array of its words.
5
- * @param {string} [string] string to inspect for words
5
+ * @param {string} string string to inspect for words
6
6
  * @param {RegExp|string} [pattern] regex pattern to match words or string of characters to split words by.
7
- * @returns {Array} Returns an array of words
7
+ * @returns {string[]} Returns an array of words
8
8
  * @example
9
9
  * const result = words('I can, I should, & I will');
10
10
  * console.log(result);
@@ -18,7 +18,7 @@
18
18
  * console.log(result);
19
19
  * // => ['I', 'can', 'I', 'should', '&', 'I', 'will']
20
20
  */
21
- function words (string, pattern) {
21
+ export function words (string, pattern) {
22
22
  if (pattern === undefined) { return string.match(reUnicodeWords) || [] }
23
23
  if (typeof pattern === 'string') {
24
24
  return string.match(new RegExp('[^' + pattern + ']+', 'g')) || []
@@ -84,5 +84,3 @@ const reUnicodeWords = RegExp([
84
84
  `${rsDigit}+`,
85
85
  rsEmoji
86
86
  ].join('|'), 'g')
87
-
88
- export { words }