@valkyriestudios/utils 11.0.0 → 11.2.0

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 (186) hide show
  1. package/array/dedupe.d.ts +8 -0
  2. package/array/is.d.ts +8 -0
  3. package/array/isNotEmpty.d.ts +8 -0
  4. package/array/join.d.ts +36 -0
  5. package/array/mapFn.d.ts +40 -0
  6. package/array/mapKey.d.ts +38 -0
  7. package/array/mapPrimitive.d.ts +40 -0
  8. package/array/shuffle.d.ts +9 -0
  9. package/array/sort.d.ts +58 -0
  10. package/boolean/is.d.ts +8 -0
  11. package/caching/memoize.d.ts +10 -0
  12. package/date/addUTC.d.ts +10 -0
  13. package/date/diff.d.ts +10 -0
  14. package/{dist/date → date}/endOfUTC.d.ts +8 -0
  15. package/date/is.d.ts +8 -0
  16. package/date/nowUnix.d.ts +6 -0
  17. package/date/nowUnixMs.d.ts +6 -0
  18. package/{dist/date → date}/startOfUTC.d.ts +8 -0
  19. package/date/toUTC.d.ts +8 -0
  20. package/date/toUnix.d.ts +8 -0
  21. package/{dist/deep → deep}/freeze.d.ts +7 -0
  22. package/deep/get.d.ts +27 -0
  23. package/{dist/deep → deep}/seal.d.ts +7 -0
  24. package/deep/set.d.ts +42 -0
  25. package/equal.d.ts +10 -0
  26. package/function/is.d.ts +8 -0
  27. package/function/noop.d.ts +6 -0
  28. package/function/noopresolve.d.ts +9 -0
  29. package/function/noopreturn.d.ts +8 -0
  30. package/function/sleep.d.ts +9 -0
  31. package/hash/fnv1A.d.ts +10 -0
  32. package/hash/guid.d.ts +6 -0
  33. package/index.d.ts +358 -0
  34. package/number/is.d.ts +8 -0
  35. package/number/isAbove.d.ts +9 -0
  36. package/number/isAboveOrEqual.d.ts +9 -0
  37. package/number/isBelow.d.ts +9 -0
  38. package/number/isBelowOrEqual.d.ts +10 -0
  39. package/number/isBetween.d.ts +12 -0
  40. package/number/isInteger.d.ts +8 -0
  41. package/number/isIntegerAbove.d.ts +9 -0
  42. package/number/isIntegerAboveOrEqual.d.ts +10 -0
  43. package/number/isIntegerBelow.d.ts +9 -0
  44. package/number/isIntegerBelowOrEqual.d.ts +10 -0
  45. package/number/isIntegerBetween.d.ts +12 -0
  46. package/number/isNumericalNaN.d.ts +8 -0
  47. package/number/randomBetween.d.ts +9 -0
  48. package/number/randomIntBetween.d.ts +10 -0
  49. package/number/round.d.ts +9 -0
  50. package/number/toPercentage.d.ts +11 -0
  51. package/object/define.d.ts +15 -0
  52. package/object/is.d.ts +8 -0
  53. package/object/isNotEmpty.d.ts +8 -0
  54. package/object/merge.d.ts +18 -0
  55. package/object/pick.d.ts +13 -0
  56. package/package.json +1 -305
  57. package/regexp/is.d.ts +8 -0
  58. package/regexp/sanitize.d.ts +11 -0
  59. package/string/humanizeBytes.d.ts +40 -0
  60. package/string/humanizeNumber.d.ts +52 -0
  61. package/string/is.d.ts +8 -0
  62. package/string/isBetween.d.ts +13 -0
  63. package/string/isNotEmpty.d.ts +9 -0
  64. package/string/shorten.d.ts +10 -0
  65. package/dist/array/dedupe.d.ts +0 -1
  66. package/dist/array/is.d.ts +0 -1
  67. package/dist/array/isNotEmpty.d.ts +0 -1
  68. package/dist/array/join.d.ts +0 -8
  69. package/dist/array/mapFn.d.ts +0 -14
  70. package/dist/array/mapKey.d.ts +0 -12
  71. package/dist/array/mapPrimitive.d.ts +0 -10
  72. package/dist/array/shuffle.d.ts +0 -1
  73. package/dist/array/sort.d.ts +0 -11
  74. package/dist/boolean/is.d.ts +0 -1
  75. package/dist/caching/memoize.d.ts +0 -1
  76. package/dist/date/addUTC.d.ts +0 -1
  77. package/dist/date/diff.d.ts +0 -1
  78. package/dist/date/is.d.ts +0 -1
  79. package/dist/date/nowUnix.d.ts +0 -1
  80. package/dist/date/nowUnixMs.d.ts +0 -1
  81. package/dist/date/toUTC.d.ts +0 -1
  82. package/dist/date/toUnix.d.ts +0 -1
  83. package/dist/deep/get.d.ts +0 -5
  84. package/dist/deep/set.d.ts +0 -5
  85. package/dist/equal.d.ts +0 -2
  86. package/dist/function/is.d.ts +0 -1
  87. package/dist/function/noop.d.ts +0 -1
  88. package/dist/function/noopresolve.d.ts +0 -1
  89. package/dist/function/noopreturn.d.ts +0 -1
  90. package/dist/function/sleep.d.ts +0 -1
  91. package/dist/hash/fnv1A.d.ts +0 -1
  92. package/dist/hash/guid.d.ts +0 -1
  93. package/dist/number/is.d.ts +0 -1
  94. package/dist/number/isAbove.d.ts +0 -1
  95. package/dist/number/isAboveOrEqual.d.ts +0 -1
  96. package/dist/number/isBelow.d.ts +0 -1
  97. package/dist/number/isBelowOrEqual.d.ts +0 -1
  98. package/dist/number/isBetween.d.ts +0 -1
  99. package/dist/number/isInteger.d.ts +0 -1
  100. package/dist/number/isIntegerAbove.d.ts +0 -1
  101. package/dist/number/isIntegerAboveOrEqual.d.ts +0 -1
  102. package/dist/number/isIntegerBelow.d.ts +0 -1
  103. package/dist/number/isIntegerBelowOrEqual.d.ts +0 -1
  104. package/dist/number/isIntegerBetween.d.ts +0 -1
  105. package/dist/number/isNumericalNaN.d.ts +0 -1
  106. package/dist/number/randomBetween.d.ts +0 -1
  107. package/dist/number/randomIntBetween.d.ts +0 -1
  108. package/dist/number/round.d.ts +0 -1
  109. package/dist/number/toPercentage.d.ts +0 -1
  110. package/dist/object/define.d.ts +0 -7
  111. package/dist/object/is.d.ts +0 -1
  112. package/dist/object/isNotEmpty.d.ts +0 -1
  113. package/dist/object/merge.d.ts +0 -8
  114. package/dist/object/pick.d.ts +0 -5
  115. package/dist/regexp/is.d.ts +0 -1
  116. package/dist/regexp/sanitize.d.ts +0 -1
  117. package/dist/string/humanizeBytes.d.ts +0 -8
  118. package/dist/string/humanizeNumber.d.ts +0 -10
  119. package/dist/string/is.d.ts +0 -1
  120. package/dist/string/isBetween.d.ts +0 -1
  121. package/dist/string/isNotEmpty.d.ts +0 -1
  122. package/dist/string/shorten.d.ts +0 -1
  123. /package/{dist/array → array}/dedupe.js +0 -0
  124. /package/{dist/array → array}/is.js +0 -0
  125. /package/{dist/array → array}/isNotEmpty.js +0 -0
  126. /package/{dist/array → array}/join.js +0 -0
  127. /package/{dist/array → array}/mapFn.js +0 -0
  128. /package/{dist/array → array}/mapKey.js +0 -0
  129. /package/{dist/array → array}/mapPrimitive.js +0 -0
  130. /package/{dist/array → array}/shuffle.js +0 -0
  131. /package/{dist/array → array}/sort.js +0 -0
  132. /package/{dist/boolean → boolean}/is.js +0 -0
  133. /package/{dist/caching → caching}/memoize.js +0 -0
  134. /package/{dist/date → date}/addUTC.js +0 -0
  135. /package/{dist/date → date}/diff.js +0 -0
  136. /package/{dist/date → date}/endOfUTC.js +0 -0
  137. /package/{dist/date → date}/is.js +0 -0
  138. /package/{dist/date → date}/nowUnix.js +0 -0
  139. /package/{dist/date → date}/nowUnixMs.js +0 -0
  140. /package/{dist/date → date}/startOfUTC.js +0 -0
  141. /package/{dist/date → date}/toUTC.js +0 -0
  142. /package/{dist/date → date}/toUnix.js +0 -0
  143. /package/{dist/deep → deep}/freeze.js +0 -0
  144. /package/{dist/deep → deep}/get.js +0 -0
  145. /package/{dist/deep → deep}/seal.js +0 -0
  146. /package/{dist/deep → deep}/set.js +0 -0
  147. /package/{dist/equal.js → equal.js} +0 -0
  148. /package/{dist/function → function}/is.js +0 -0
  149. /package/{dist/function → function}/noop.js +0 -0
  150. /package/{dist/function → function}/noopresolve.js +0 -0
  151. /package/{dist/function → function}/noopreturn.js +0 -0
  152. /package/{dist/function → function}/sleep.js +0 -0
  153. /package/{dist/hash → hash}/fnv1A.js +0 -0
  154. /package/{dist/hash → hash}/guid.js +0 -0
  155. /package/{dist/is.d.ts → is.d.ts} +0 -0
  156. /package/{dist/is.js → is.js} +0 -0
  157. /package/{dist/number → number}/is.js +0 -0
  158. /package/{dist/number → number}/isAbove.js +0 -0
  159. /package/{dist/number → number}/isAboveOrEqual.js +0 -0
  160. /package/{dist/number → number}/isBelow.js +0 -0
  161. /package/{dist/number → number}/isBelowOrEqual.js +0 -0
  162. /package/{dist/number → number}/isBetween.js +0 -0
  163. /package/{dist/number → number}/isInteger.js +0 -0
  164. /package/{dist/number → number}/isIntegerAbove.js +0 -0
  165. /package/{dist/number → number}/isIntegerAboveOrEqual.js +0 -0
  166. /package/{dist/number → number}/isIntegerBelow.js +0 -0
  167. /package/{dist/number → number}/isIntegerBelowOrEqual.js +0 -0
  168. /package/{dist/number → number}/isIntegerBetween.js +0 -0
  169. /package/{dist/number → number}/isNumericalNaN.js +0 -0
  170. /package/{dist/number → number}/randomBetween.js +0 -0
  171. /package/{dist/number → number}/randomIntBetween.js +0 -0
  172. /package/{dist/number → number}/round.js +0 -0
  173. /package/{dist/number → number}/toPercentage.js +0 -0
  174. /package/{dist/object → object}/define.js +0 -0
  175. /package/{dist/object → object}/is.js +0 -0
  176. /package/{dist/object → object}/isNotEmpty.js +0 -0
  177. /package/{dist/object → object}/merge.js +0 -0
  178. /package/{dist/object → object}/pick.js +0 -0
  179. /package/{dist/regexp → regexp}/is.js +0 -0
  180. /package/{dist/regexp → regexp}/sanitize.js +0 -0
  181. /package/{dist/string → string}/humanizeBytes.js +0 -0
  182. /package/{dist/string → string}/humanizeNumber.js +0 -0
  183. /package/{dist/string → string}/is.js +0 -0
  184. /package/{dist/string → string}/isBetween.js +0 -0
  185. /package/{dist/string → string}/isNotEmpty.js +0 -0
  186. /package/{dist/string → string}/shorten.js +0 -0
package/index.d.ts ADDED
@@ -0,0 +1,358 @@
1
+ declare module "number/isNumericalNaN" {
2
+ export default function isNumericalNaN(val: any): boolean;
3
+ }
4
+ declare module "equal" {
5
+ function equal(a: any, b: any): boolean;
6
+ export default equal;
7
+ }
8
+ declare module "array/isNotEmpty" {
9
+ export default function isNotEmptyArray(val: any): boolean;
10
+ }
11
+ declare module "array/is" {
12
+ export default function isArray(val: any): boolean;
13
+ }
14
+ declare module "boolean/is" {
15
+ export default function isBoolean(val: any): boolean;
16
+ }
17
+ declare module "date/is" {
18
+ export default function isDate(val: any): boolean;
19
+ }
20
+ declare module "function/is" {
21
+ export default function isFunction(val: any): boolean;
22
+ }
23
+ declare module "number/is" {
24
+ export default function isNumber(val: any): boolean;
25
+ }
26
+ declare module "number/isBetween" {
27
+ export default function isNumberBetween(val: any, min: number, max: number): boolean;
28
+ }
29
+ declare module "number/isBelow" {
30
+ export default function isNumberBelow(val: any, ref: number): boolean;
31
+ }
32
+ declare module "number/isBelowOrEqual" {
33
+ export default function isNumberBelowOrEqual(val: any, ref: number): boolean;
34
+ }
35
+ declare module "number/isAbove" {
36
+ export default function isNumberAbove(val: any, ref: number): boolean;
37
+ }
38
+ declare module "number/isAboveOrEqual" {
39
+ export default function isNumberAboveOrEqual(val: any, ref: number): boolean;
40
+ }
41
+ declare module "number/isInteger" {
42
+ export default function isInteger(val: any): boolean;
43
+ }
44
+ declare module "number/isIntegerBetween" {
45
+ export default function isIntegerBetween(val: any, min: number, max: number): boolean;
46
+ }
47
+ declare module "number/isIntegerBelow" {
48
+ export default function isIntegerBelow(val: any, ref: number): boolean;
49
+ }
50
+ declare module "number/isIntegerBelowOrEqual" {
51
+ export default function isIntegerBelowOrEqual(val: any, ref: number): boolean;
52
+ }
53
+ declare module "number/isIntegerAbove" {
54
+ export default function isIntegerAbove(val: any, ref: number): boolean;
55
+ }
56
+ declare module "number/isIntegerAboveOrEqual" {
57
+ export default function isIntegerAboveOrEqual(val: any, ref: number): boolean;
58
+ }
59
+ declare module "regexp/is" {
60
+ export default function isRegExp(val: any): boolean;
61
+ }
62
+ declare module "object/is" {
63
+ export default function isObject(val: any): boolean;
64
+ }
65
+ declare module "object/isNotEmpty" {
66
+ export default function isNotEmptyObject(val: any): boolean;
67
+ }
68
+ declare module "string/is" {
69
+ export default function isString(val: any): boolean;
70
+ }
71
+ declare module "string/isBetween" {
72
+ export default function isStringBetween(val: any, min: number, max: number, trimmed?: boolean): boolean;
73
+ }
74
+ declare module "string/isNotEmpty" {
75
+ export default function isNotEmptyString(val: any, trimmed?: boolean): boolean;
76
+ }
77
+ declare module "is" {
78
+ import equal from "equal";
79
+ import isNotEmptyArray from "array/isNotEmpty";
80
+ import isArray from "array/is";
81
+ import isBoolean from "boolean/is";
82
+ import isDate from "date/is";
83
+ import isFunction from "function/is";
84
+ import isNumber from "number/is";
85
+ import isNumberBetween from "number/isBetween";
86
+ import isNumberBelow from "number/isBelow";
87
+ import isNumberBelowOrEqual from "number/isBelowOrEqual";
88
+ import isNumberAbove from "number/isAbove";
89
+ import isNumberAboveOrEqual from "number/isAboveOrEqual";
90
+ import isInteger from "number/isInteger";
91
+ import isIntegerBetween from "number/isIntegerBetween";
92
+ import isIntegerBelow from "number/isIntegerBelow";
93
+ import isIntegerBelowOrEqual from "number/isIntegerBelowOrEqual";
94
+ import isIntegerAbove from "number/isIntegerAbove";
95
+ import isIntegerAboveOrEqual from "number/isIntegerAboveOrEqual";
96
+ import isRegExp from "regexp/is";
97
+ import isObject from "object/is";
98
+ import isNotEmptyObject from "object/isNotEmpty";
99
+ import isString from "string/is";
100
+ import isStringBetween from "string/isBetween";
101
+ import isNotEmptyString from "string/isNotEmpty";
102
+ const Is: Readonly<{
103
+ Array: typeof isArray;
104
+ NeArray: typeof isNotEmptyArray;
105
+ NotEmptyArray: typeof isNotEmptyArray;
106
+ Boolean: typeof isBoolean;
107
+ Date: typeof isDate;
108
+ Function: typeof isFunction;
109
+ Num: typeof isNumber;
110
+ NumBetween: typeof isNumberBetween;
111
+ NumAbove: typeof isNumberAbove;
112
+ NumAboveOrEqual: typeof isNumberAboveOrEqual;
113
+ NumBelow: typeof isNumberBelow;
114
+ NumBelowOrEqual: typeof isNumberBelowOrEqual;
115
+ NumGt: typeof isNumberAbove;
116
+ NumGte: typeof isNumberAboveOrEqual;
117
+ NumLt: typeof isNumberBelow;
118
+ NumLte: typeof isNumberBelowOrEqual;
119
+ Number: typeof isNumber;
120
+ NumberBetween: typeof isNumberBetween;
121
+ NumberAbove: typeof isNumberAbove;
122
+ NumberAboveOrEqual: typeof isNumberAboveOrEqual;
123
+ NumberBelow: typeof isNumberBelow;
124
+ NumberBelowOrEqual: typeof isNumberBelowOrEqual;
125
+ Int: typeof isInteger;
126
+ IntBetween: typeof isIntegerBetween;
127
+ IntAbove: typeof isIntegerAbove;
128
+ IntAboveOrEqual: typeof isIntegerAboveOrEqual;
129
+ IntBelow: typeof isIntegerBelow;
130
+ IntBelowOrEqual: typeof isIntegerBelowOrEqual;
131
+ IntGt: typeof isIntegerAbove;
132
+ IntGte: typeof isIntegerAboveOrEqual;
133
+ IntLt: typeof isIntegerBelow;
134
+ IntLte: typeof isIntegerBelowOrEqual;
135
+ Integer: typeof isInteger;
136
+ IntegerBetween: typeof isIntegerBetween;
137
+ IntegerBelow: typeof isIntegerBelow;
138
+ IntegerBelowOrEqual: typeof isIntegerBelowOrEqual;
139
+ IntegerAbove: typeof isIntegerAbove;
140
+ IntegerAboveOrEqual: typeof isIntegerAboveOrEqual;
141
+ RegExp: typeof isRegExp;
142
+ Object: typeof isObject;
143
+ NeObject: typeof isNotEmptyObject;
144
+ NotEmptyObject: typeof isNotEmptyObject;
145
+ String: typeof isString;
146
+ StringBetween: typeof isStringBetween;
147
+ NeString: typeof isNotEmptyString;
148
+ NotEmptyString: typeof isNotEmptyString;
149
+ Equal: typeof equal;
150
+ Eq: typeof equal;
151
+ }>;
152
+ export default Is;
153
+ }
154
+ declare module "hash/fnv1A" {
155
+ export default function fnv1A(data: any, offset?: number): number;
156
+ }
157
+ declare module "array/dedupe" {
158
+ export default function dedupe(val: any[]): any[];
159
+ }
160
+ declare module "number/round" {
161
+ export default function round(val: number, precision?: number): number;
162
+ }
163
+ declare module "array/join" {
164
+ interface joinOptions {
165
+ delim?: string;
166
+ trim?: boolean;
167
+ valtrim?: boolean;
168
+ valround?: number;
169
+ }
170
+ export default function join(val: any[], opts?: joinOptions): string;
171
+ }
172
+ declare module "array/mapFn" {
173
+ interface mapOptions {
174
+ merge?: boolean;
175
+ }
176
+ interface kvMap {
177
+ [key: string]: {
178
+ [key: string]: any;
179
+ };
180
+ }
181
+ export default function mapFn(arr: {
182
+ [key: string]: any;
183
+ }[], fn: (entry: {
184
+ [key: string]: any;
185
+ }) => (string | number | boolean), opts?: mapOptions): kvMap;
186
+ }
187
+ declare module "array/mapKey" {
188
+ interface mapOptions {
189
+ merge?: boolean;
190
+ }
191
+ interface kvMap {
192
+ [key: string]: {
193
+ [key: string]: any;
194
+ };
195
+ }
196
+ export default function mapKey(arr: {
197
+ [key: string]: any;
198
+ }[], key: string, opts?: mapOptions): kvMap;
199
+ }
200
+ declare module "array/mapPrimitive" {
201
+ interface mapOptions {
202
+ valtrim?: boolean;
203
+ valround?: boolean | number;
204
+ keyround?: boolean;
205
+ }
206
+ interface mapReturn {
207
+ [key: string]: string | number;
208
+ }
209
+ export default function mapPrimitive(arr: any[], opts?: mapOptions): mapReturn;
210
+ }
211
+ declare module "array/shuffle" {
212
+ export default function shuffle(arr: any[]): void;
213
+ }
214
+ declare module "array/sort" {
215
+ interface sortOptions {
216
+ filter_fn?: (el: any) => boolean;
217
+ nokey_hide?: boolean;
218
+ nokey_atend?: boolean;
219
+ }
220
+ interface sortObject {
221
+ [key: string]: any;
222
+ }
223
+ type sortByFunction = (el: sortObject) => string;
224
+ export default function sort(arr: sortObject[], by: string | sortByFunction, dir?: 'asc' | 'desc', opts?: sortOptions): sortObject[];
225
+ }
226
+ declare module "caching/memoize" {
227
+ export default function memoize(fn: Function, resolver?: Function): Function;
228
+ }
229
+ declare module "date/addUTC" {
230
+ export default function addUTC(val: Date, amount?: number, key?: 'years' | 'year' | 'months' | 'month' | 'days' | 'day' | 'hours' | 'hour' | 'minutes' | 'minute' | 'seconds' | 'second' | 'milliseconds' | 'millisecond'): Date;
231
+ }
232
+ declare module "date/diff" {
233
+ export default function diff(val_a: Date, val_b: Date, key?: 'week' | 'weeks' | 'day' | 'days' | 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds'): number;
234
+ }
235
+ declare module "date/endOfUTC" {
236
+ export default function endOfUTC(val: Date, key?: 'year' | 'quarter' | 'month' | 'week' | 'week_sun' | 'week_mon' | 'week_tue' | 'week_wed' | 'week_thu' | 'week_fri' | 'week_sat' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'): Date;
237
+ }
238
+ declare module "date/nowUnix" {
239
+ export default function nowUnix(): number;
240
+ }
241
+ declare module "date/nowUnixMs" {
242
+ export default function nowUnixMs(): number;
243
+ }
244
+ declare module "date/startOfUTC" {
245
+ export default function startOfUTC(val: Date, key?: 'year' | 'quarter' | 'month' | 'week' | 'week_sun' | 'week_mon' | 'week_tue' | 'week_wed' | 'week_thu' | 'week_fri' | 'week_sat' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'): Date;
246
+ }
247
+ declare module "date/toUTC" {
248
+ export default function toUTC(val: Date): Date;
249
+ }
250
+ declare module "date/toUnix" {
251
+ export default function toUnix(val: Date): number;
252
+ }
253
+ declare module "deep/freeze" {
254
+ type deepInput = {
255
+ [key: string]: any;
256
+ } | {
257
+ [key: string]: any;
258
+ }[] | any[];
259
+ export default function deepFreeze(obj: deepInput): Readonly<deepInput>;
260
+ }
261
+ declare module "deep/get" {
262
+ export default function deepGet(obj: {
263
+ [key: string]: any;
264
+ } | {
265
+ [key: string]: any;
266
+ }[] | any[], path: string, get_parent?: boolean): any | undefined;
267
+ }
268
+ declare module "deep/seal" {
269
+ type deepInput = {
270
+ [key: string]: any;
271
+ } | {
272
+ [key: string]: any;
273
+ }[] | any[];
274
+ export default function deepSeal(obj: deepInput): deepInput;
275
+ }
276
+ declare module "deep/set" {
277
+ export default function deepSet(obj: {
278
+ [key: string]: any;
279
+ } | {
280
+ [key: string]: any;
281
+ }[] | any[], path: string, value: any, define?: boolean): boolean;
282
+ }
283
+ declare module "function/noop" {
284
+ export default function noop(): void;
285
+ }
286
+ declare module "function/noopresolve" {
287
+ export default function noopresolve(val?: any): Promise<any>;
288
+ }
289
+ declare module "function/noopreturn" {
290
+ export default function noopreturn(val?: any): any;
291
+ }
292
+ declare module "function/sleep" {
293
+ export default function sleep(ms?: number): Promise<void>;
294
+ }
295
+ declare module "hash/guid" {
296
+ export default function guid(): string;
297
+ }
298
+ declare module "number/randomBetween" {
299
+ export default function randomBetween(min?: number, max?: number): number;
300
+ }
301
+ declare module "number/randomIntBetween" {
302
+ export default function randomIntBetween(min?: number, max?: number): number;
303
+ }
304
+ declare module "number/toPercentage" {
305
+ export default function toPercentage(val: number, precision?: number, min?: number, max?: number): number;
306
+ }
307
+ declare module "object/define" {
308
+ export default function define(props: {
309
+ [key: string]: any;
310
+ }, obj?: {
311
+ [key: string]: any;
312
+ }): {
313
+ [key: string]: any;
314
+ };
315
+ }
316
+ declare module "object/merge" {
317
+ function merge(target: {
318
+ [key: string]: any;
319
+ }, source?: {
320
+ [key: string]: any;
321
+ }): {
322
+ [key: string]: any;
323
+ };
324
+ export default merge;
325
+ }
326
+ declare module "object/pick" {
327
+ export default function pick(obj: {
328
+ [key: string]: any;
329
+ }, keys: string[]): {
330
+ [key: string]: any;
331
+ };
332
+ }
333
+ declare module "regexp/sanitize" {
334
+ export default function sanitizeRegExp(val: string): string | false;
335
+ }
336
+ declare module "string/humanizeNumber" {
337
+ interface humanizeNumberOptions {
338
+ delim?: string;
339
+ separator?: string;
340
+ precision?: number;
341
+ units?: string[] | boolean;
342
+ divider?: number;
343
+ real?: boolean;
344
+ }
345
+ export default function humanizeNumber(val: number | string, options?: humanizeNumberOptions): string;
346
+ }
347
+ declare module "string/humanizeBytes" {
348
+ interface humanizeBytesOptions {
349
+ delim?: string;
350
+ separator?: string;
351
+ precision?: number;
352
+ units?: string[];
353
+ }
354
+ export default function humanizeBytes(val: number | string, options?: humanizeBytesOptions): string;
355
+ }
356
+ declare module "string/shorten" {
357
+ export default function shorten(val: string, length: number, postfix?: string): string;
358
+ }
package/number/is.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Check whether or not a provided value is a number
3
+ *
4
+ * @param val - Value to verify
5
+ *
6
+ * @returns Whether or not the value is a number
7
+ */
8
+ export default function isNumber(val: any): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check whether or not the provided value is a number above another value
3
+ *
4
+ * @param val - Value to verify
5
+ * @param ref - Reference the provided value needs to be above
6
+ *
7
+ * @returns Whether or not the value is above the reference
8
+ */
9
+ export default function isNumberAbove(val: any, ref: number): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check whether or not the provided value is a number above or equal to another value
3
+ *
4
+ * @param val - Value to verify
5
+ * @param ref - Reference the provided value needs to be above or equal to
6
+ *
7
+ * @returns Whether or not the value is above or equal to the reference
8
+ */
9
+ export default function isNumberAboveOrEqual(val: any, ref: number): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check whether or not the provided value is a number below another value
3
+ *
4
+ * @param val - Value to verify
5
+ * @param ref - Reference the provided value needs to be below
6
+ *
7
+ * @returns Whether or not the value is below the reference
8
+ */
9
+ export default function isNumberBelow(val: any, ref: number): boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Check whether or not the provided value is a number below or
3
+ * equal to another value
4
+ *
5
+ * @param val - Value to verify
6
+ * @param ref - Reference the provided value needs to be below or equal to
7
+ *
8
+ * @returns Whether or not the value is below or equal to the reference
9
+ */
10
+ export default function isNumberBelowOrEqual(val: any, ref: number): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Check whether or not the provided value is a number between a min and max
3
+ * inclusive of min and max
4
+ * equal to another value
5
+ *
6
+ * @param val - Value to verify
7
+ * @param min - Lower boundary
8
+ * @param max - Upper boundary
9
+ *
10
+ * @returns Whether or not the value is a number between min and max inclusive
11
+ */
12
+ export default function isNumberBetween(val: any, min: number, max: number): boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Check whether or not a provided value is an integer
3
+ *
4
+ * @param val - Value to verify
5
+ *
6
+ * @returns Whether or not the value is an integer
7
+ */
8
+ export default function isInteger(val: any): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check whether or not the provided value is an integer above another value
3
+ *
4
+ * @param val - Value to verify
5
+ * @param ref - Reference the provided value needs to be above
6
+ *
7
+ * @returns Whether or not the value is above the reference
8
+ */
9
+ export default function isIntegerAbove(val: any, ref: number): boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Check whether or not the provided value is an integer above or equal
3
+ * to another value
4
+ *
5
+ * @param val - Value to verify
6
+ * @param ref - Reference the provided value needs to be above or equal to
7
+ *
8
+ * @returns Whether or not the value is above or equal to the reference
9
+ */
10
+ export default function isIntegerAboveOrEqual(val: any, ref: number): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check whether or not the provided value is an integer below another value
3
+ *
4
+ * @param val - Value to verify
5
+ * @param ref - Reference the provided value needs to be below
6
+ *
7
+ * @returns Whether or not the value is below the reference
8
+ */
9
+ export default function isIntegerBelow(val: any, ref: number): boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Check whether or not the provided value is an integer below or
3
+ * equal to another value
4
+ *
5
+ * @param val - Value to verify
6
+ * @param ref - Reference the provided value needs to be below or equal to
7
+ *
8
+ * @returns Whether or not the value is below or equal to the reference
9
+ */
10
+ export default function isIntegerBelowOrEqual(val: any, ref: number): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Check whether or not the provided value is an integer between a min and max
3
+ * inclusive of min and max
4
+ * equal to another value
5
+ *
6
+ * @param val - Value to verify
7
+ * @param min - Lower boundary
8
+ * @param max - Upper boundary
9
+ *
10
+ * @returns Whether or not the value is an integer between min and max inclusive
11
+ */
12
+ export default function isIntegerBetween(val: any, min: number, max: number): boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Check whether or not the provided value is a numerical NaN
3
+ *
4
+ * @param val - Value to verify
5
+ *
6
+ * @returns Whether or not the value is a numerical NaN
7
+ */
8
+ export default function isNumericalNaN(val: any): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generates a random number between the provided lower and upper bound
3
+ *
4
+ * @param min - (default=0) Lower bound
5
+ * @param max - (default=10) Upper bound
6
+ *
7
+ * @returns Random number between min and max
8
+ */
9
+ export default function randomBetween(min?: number, max?: number): number;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generates a random integer between the provided lower and upper bound,
3
+ * not inclusive of the upper bound
4
+ *
5
+ * @param min - (default=0) Lower bound
6
+ * @param max - (default=10) Upper bound
7
+ *
8
+ * @returns Random integer between min and max
9
+ */
10
+ export default function randomIntBetween(min?: number, max?: number): number;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Rounds the provided value to a certain precision
3
+ *
4
+ * @param val - Value to round
5
+ * @param precision - (default=0) Amount of decimals precision to round to
6
+ *
7
+ * @returns Rounded value according to decimal precision provided
8
+ */
9
+ export default function round(val: number, precision?: number): number;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Converts a number into a percentage respective to a provided range
3
+ *
4
+ * @param val - Value to convert into a percentage for the provided range
5
+ * @param precision - (default=0) Amount of decimals precision to use
6
+ * @param min - (default=0) Lower bound of the range the value is to be converted to percentage for
7
+ * @param max - (default=1) Upper bound of the range the value is to be converted to percentage for
8
+ *
9
+ * @returns Percentage value respective to the provided range
10
+ */
11
+ export default function toPercentage(val: number, precision?: number, min?: number, max?: number): number;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Defines each of the provided properties in props on top of the passed object
3
+ *
4
+ * @param props - Object with properties to define
5
+ * @param obj - (default={}) Object to define on top of
6
+ *
7
+ * @returns Object with the defined properties
8
+ */
9
+ export default function define(props: {
10
+ [key: string]: any;
11
+ }, obj?: {
12
+ [key: string]: any;
13
+ }): {
14
+ [key: string]: any;
15
+ };
package/object/is.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Check whether or not a provided value is an object
3
+ *
4
+ * @param val - Value to verify
5
+ *
6
+ * @returns Whether or not the value is an object
7
+ */
8
+ export default function isObject(val: any): boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Check whether or not a provided value is an object with content
3
+ *
4
+ * @param val - Value to verify
5
+ *
6
+ * @returns Whether or not the value is an object with content
7
+ */
8
+ export default function isNotEmptyObject(val: any): boolean;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Deep merge two objects together while ensuring nested objects also get merged,
3
+ * take note: this does not merge onto passed objects by reference but instead
4
+ * returns a new object
5
+ *
6
+ * @param target - Base Object
7
+ * @param source - (default={}) Object to merge onto base object
8
+ *
9
+ * @returns Combined target and source objects
10
+ */
11
+ declare function merge(target: {
12
+ [key: string]: any;
13
+ }, source?: {
14
+ [key: string]: any;
15
+ }): {
16
+ [key: string]: any;
17
+ };
18
+ export default merge;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Returns a new object with the keys picked from the passed object
3
+ *
4
+ * @param obj - Object to pick from
5
+ * @param keys - Array of keys to pick from object
6
+ *
7
+ * @returns Object containing the picked keys from source object
8
+ */
9
+ export default function pick(obj: {
10
+ [key: string]: any;
11
+ }, keys: string[]): {
12
+ [key: string]: any;
13
+ };