@oscarpalmer/atoms 0.176.0 → 0.178.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.
- package/dist/array/exists.mjs +1 -1
- package/dist/array/filter.d.mts +26 -0
- package/dist/array/find.d.mts +1 -1
- package/dist/array/find.mjs +2 -2
- package/dist/array/first.d.mts +71 -0
- package/dist/array/first.mjs +11 -0
- package/dist/array/index.d.mts +3 -1
- package/dist/array/index.mjs +3 -1
- package/dist/array/last.d.mts +71 -0
- package/dist/array/last.mjs +11 -0
- package/dist/array/reverse.d.mts +4 -0
- package/dist/array/reverse.mjs +16 -0
- package/dist/array/select.d.mts +42 -0
- package/dist/array/single.d.mts +34 -0
- package/dist/array/single.mjs +10 -0
- package/dist/index.d.mts +327 -8
- package/dist/index.mjs +214 -22
- package/dist/internal/array/find.d.mts +11 -4
- package/dist/internal/array/find.mjs +19 -11
- package/dist/internal/is.d.mts +62 -1
- package/dist/internal/is.mjs +87 -6
- package/dist/is.d.mts +38 -8
- package/dist/is.mjs +47 -7
- package/dist/string/index.d.mts +3 -1
- package/dist/string/index.mjs +32 -1
- package/package.json +11 -3
- package/plugin/index.js +2 -1
- package/src/array/exists.ts +1 -1
- package/src/array/filter.ts +26 -0
- package/src/array/find.ts +4 -4
- package/src/array/first.ts +113 -0
- package/src/array/index.ts +2 -0
- package/src/array/last.ts +109 -0
- package/src/array/reverse.ts +23 -0
- package/src/array/select.ts +84 -0
- package/src/array/single.ts +64 -0
- package/src/index.ts +2 -0
- package/src/internal/array/find.ts +36 -10
- package/src/internal/is.ts +113 -11
- package/src/is.ts +63 -6
- package/src/string/index.ts +76 -0
package/dist/index.d.mts
CHANGED
|
@@ -178,11 +178,105 @@ declare function filter<Item>(array: Item[], item: Item): Item[];
|
|
|
178
178
|
declare namespace filter {
|
|
179
179
|
var remove: typeof removeFiltered;
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Get a filtered array of items that do not match the filter
|
|
183
|
+
* @param array Array to search in
|
|
184
|
+
* @param callback Callback to get an item's value for matching
|
|
185
|
+
* @param value Value to match against
|
|
186
|
+
* @returns Filtered array of items that do not match the filter
|
|
187
|
+
*/
|
|
181
188
|
declare function removeFiltered<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): unknown[];
|
|
189
|
+
/**
|
|
190
|
+
* Get a filtered array of items that do not match the filter
|
|
191
|
+
* @param array Array to search in
|
|
192
|
+
* @param key Key to get an item's value for matching
|
|
193
|
+
* @param value Value to match against
|
|
194
|
+
* @returns Filtered array of items that do not match the filter
|
|
195
|
+
*/
|
|
182
196
|
declare function removeFiltered<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): unknown[];
|
|
197
|
+
/**
|
|
198
|
+
* Get a filtered array of items that do not match the filter
|
|
199
|
+
* @param array Array to search in
|
|
200
|
+
* @param filter Filter callback to match items
|
|
201
|
+
* @returns Filtered array of items that do not match the filter
|
|
202
|
+
*/
|
|
183
203
|
declare function removeFiltered<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): unknown[];
|
|
204
|
+
/**
|
|
205
|
+
* Get a filtered array of items that do not match the given item
|
|
206
|
+
* @param array Array to search in
|
|
207
|
+
* @param item Item to match against
|
|
208
|
+
* @returns Filtered array of items that do not match the given item
|
|
209
|
+
*/
|
|
184
210
|
declare function removeFiltered<Item>(array: Item[], item: Item): unknown[];
|
|
185
211
|
//#endregion
|
|
212
|
+
//#region src/array/first.d.ts
|
|
213
|
+
/**
|
|
214
|
+
* Get the first item matching the given value
|
|
215
|
+
* @param array Array to search in
|
|
216
|
+
* @param callback Callback to get an item's value for matching
|
|
217
|
+
* @param value Value to match against
|
|
218
|
+
* @returns First item that matches the value, or `undefined` if no match is found
|
|
219
|
+
*/
|
|
220
|
+
declare function first<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Get the first item matching the given value by key
|
|
223
|
+
* @param array Array to search in
|
|
224
|
+
* @param key Key to get an item's value for matching
|
|
225
|
+
* @param value Value to match against
|
|
226
|
+
* @returns First item that matches the value, or `undefined` if no match is found
|
|
227
|
+
*/
|
|
228
|
+
declare function first<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Get the first item matching the filter
|
|
231
|
+
* @param array Array to search in
|
|
232
|
+
* @param filter Filter callback to match items
|
|
233
|
+
* @returns First item that matches the filter, or `undefined` if no match is found
|
|
234
|
+
*/
|
|
235
|
+
declare function first<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* Get the first item from an array
|
|
238
|
+
* @param array Array to get from
|
|
239
|
+
* @return First item from the array, or `undefined` if the array is empty
|
|
240
|
+
*/
|
|
241
|
+
declare function first<Item>(array: Item[]): Item | undefined;
|
|
242
|
+
declare namespace first {
|
|
243
|
+
var _a: typeof firstOrDefault;
|
|
244
|
+
export { _a as default };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get the first item matching the given value
|
|
248
|
+
* @param array Array to search in
|
|
249
|
+
* @param defaultValue Default value to return if no match is found
|
|
250
|
+
* @param callback Callback to get an item's value for matching
|
|
251
|
+
* @param value Value to match against
|
|
252
|
+
* @returns First item that matches the value, or the default value if no match is found
|
|
253
|
+
*/
|
|
254
|
+
declare function firstOrDefault<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], defaultValue: Item, callback: Callback, value: ReturnType<Callback>): Item;
|
|
255
|
+
/**
|
|
256
|
+
* Get the first item matching the given value by key
|
|
257
|
+
* @param array Array to search in
|
|
258
|
+
* @param defaultValue Default value to return if no match is found
|
|
259
|
+
* @param key Key to get an item's value for matching
|
|
260
|
+
* @param value Value to match against
|
|
261
|
+
* @returns First item that matches the value, or the default value if no match is found
|
|
262
|
+
*/
|
|
263
|
+
declare function firstOrDefault<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], defaultValue: Item, key: ItemKey, value: Item[ItemKey]): Item;
|
|
264
|
+
/**
|
|
265
|
+
* Get the first item matching the filter
|
|
266
|
+
* @param array Array to search in
|
|
267
|
+
* @param defaultValue Default value to return if no match is found
|
|
268
|
+
* @param filter Filter callback to match items
|
|
269
|
+
* @returns First item that matches the filter, or the default value if no match is found
|
|
270
|
+
*/
|
|
271
|
+
declare function firstOrDefault<Item>(array: Item[], defaultValue: Item, filter: (item: Item, index: number, array: Item[]) => boolean): Item;
|
|
272
|
+
/**
|
|
273
|
+
* Get the first item from an array
|
|
274
|
+
* @param array Array to get from
|
|
275
|
+
* @param defaultValue Default value to return if the array is empty
|
|
276
|
+
* @return First item from the array, or the default value if the array is empty
|
|
277
|
+
*/
|
|
278
|
+
declare function firstOrDefault<Item>(array: Item[], defaultValue: Item): Item;
|
|
279
|
+
//#endregion
|
|
186
280
|
//#region src/array/group-by.d.ts
|
|
187
281
|
/**
|
|
188
282
|
* Create a record from an array of items using a specific key and value
|
|
@@ -421,7 +515,7 @@ declare function exists<Item>(array: Item[], item: Item): boolean;
|
|
|
421
515
|
//#endregion
|
|
422
516
|
//#region src/array/find.d.ts
|
|
423
517
|
/**
|
|
424
|
-
* Get the first
|
|
518
|
+
* Get the first item matching the given value
|
|
425
519
|
* @param array Array to search in
|
|
426
520
|
* @param callback Callback to get an item's value for matching
|
|
427
521
|
* @param value Value to match against
|
|
@@ -735,6 +829,9 @@ declare function startsWithArray<Item>(haystack: Item[], needle: Item[]): boolea
|
|
|
735
829
|
*/
|
|
736
830
|
declare function push<Item>(array: Item[], pushed: Item[]): number;
|
|
737
831
|
//#endregion
|
|
832
|
+
//#region src/array/reverse.d.ts
|
|
833
|
+
declare function reverse<Item>(array: Item[]): Item[];
|
|
834
|
+
//#endregion
|
|
738
835
|
//#region src/array/select.d.ts
|
|
739
836
|
/**
|
|
740
837
|
* Get a filtered and mapped array of items
|
|
@@ -745,6 +842,15 @@ declare function push<Item>(array: Item[], pushed: Item[]): number;
|
|
|
745
842
|
* @returns Filtered and mapped array of items
|
|
746
843
|
*/
|
|
747
844
|
declare function select<Item, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, mapCallback: MapCallback): Array<ReturnType<MapCallback>>;
|
|
845
|
+
/**
|
|
846
|
+
* Get a filtered and mapped array of items
|
|
847
|
+
* @param array Array to search in
|
|
848
|
+
* @param filterCallback Callback to get an item's value for matching
|
|
849
|
+
* @param filterValue Value to match against
|
|
850
|
+
* @param mapKey Key to get an item's value for mapping
|
|
851
|
+
* @returns Filtered and mapped array of items
|
|
852
|
+
*/
|
|
853
|
+
declare function select<Item extends PlainObject, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, MapKey extends keyof Item>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, mapKey: MapKey): Array<Item[MapKey]>;
|
|
748
854
|
/**
|
|
749
855
|
* Get a filtered and mapped array of items
|
|
750
856
|
* @param array Array to search in
|
|
@@ -754,6 +860,15 @@ declare function select<Item, FilterCallback extends (item: Item, index: number,
|
|
|
754
860
|
* @returns Filtered and mapped array of items
|
|
755
861
|
*/
|
|
756
862
|
declare function select<Item extends PlainObject, ItemKey extends keyof Item, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], mapCallback: MapCallback): Array<ReturnType<MapCallback>>;
|
|
863
|
+
/**
|
|
864
|
+
* Get a filtered and mapped array of items
|
|
865
|
+
* @param array Array to search in
|
|
866
|
+
* @param filterKey Key to get an item's value for matching
|
|
867
|
+
* @param filterValue Value to match against
|
|
868
|
+
* @param mapKey Key to get an item's value for mapping
|
|
869
|
+
* @returns Filtered and mapped array of items
|
|
870
|
+
*/
|
|
871
|
+
declare function select<Item extends PlainObject, ItemKey extends keyof Item, MapKey extends keyof Item>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], mapKey: MapKey): Array<Item[MapKey]>;
|
|
757
872
|
/**
|
|
758
873
|
* Get a filtered and mapped array of items
|
|
759
874
|
* @param array Array to search in
|
|
@@ -762,6 +877,14 @@ declare function select<Item extends PlainObject, ItemKey extends keyof Item, Ma
|
|
|
762
877
|
* @returns Filtered and mapped array of items
|
|
763
878
|
*/
|
|
764
879
|
declare function select<Item, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, mapCallback: MapCallback): Array<ReturnType<MapCallback>>;
|
|
880
|
+
/**
|
|
881
|
+
* Get a filtered and mapped array of items
|
|
882
|
+
* @param array Array to search in
|
|
883
|
+
* @param filterCallback Filter callback to match items
|
|
884
|
+
* @param mapKey Key to get an item's value for mapping
|
|
885
|
+
* @returns Filtered and mapped array of items
|
|
886
|
+
*/
|
|
887
|
+
declare function select<Item extends PlainObject, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, MapKey extends keyof Item>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, mapKey: MapKey): Array<Item[MapKey]>;
|
|
765
888
|
/**
|
|
766
889
|
* Get a filtered and mapped array of items
|
|
767
890
|
* @param array Array to search in
|
|
@@ -770,6 +893,14 @@ declare function select<Item, FilterCallback extends (item: Item, index: number,
|
|
|
770
893
|
* @returns Filtered and mapped array of items
|
|
771
894
|
*/
|
|
772
895
|
declare function select<Item, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: MapCallback): Array<ReturnType<MapCallback>>;
|
|
896
|
+
/**
|
|
897
|
+
* Get a filtered and mapped array of items
|
|
898
|
+
* @param array Array to search in
|
|
899
|
+
* @param filter Filter callback to match items
|
|
900
|
+
* @param map Key to get an item's value for mapping
|
|
901
|
+
* @returns Filtered and mapped array of items
|
|
902
|
+
*/
|
|
903
|
+
declare function select<Item extends PlainObject, MapKey extends keyof Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: MapKey): Array<Item[MapKey]>;
|
|
773
904
|
/**
|
|
774
905
|
* Get a filtered and mapped array of items
|
|
775
906
|
* @param array Array to search in
|
|
@@ -778,6 +909,45 @@ declare function select<Item, MapCallback extends (item: Item, index: number, ar
|
|
|
778
909
|
* @returns Filtered and mapped array of items
|
|
779
910
|
*/
|
|
780
911
|
declare function select<Item, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filter: Item, map: MapCallback): Array<ReturnType<MapCallback>>;
|
|
912
|
+
/**
|
|
913
|
+
* Get a filtered and mapped array of items
|
|
914
|
+
* @param array Array to search in
|
|
915
|
+
* @param item Item to match against
|
|
916
|
+
* @param map Key to get an item's value for mapping
|
|
917
|
+
* @returns Filtered and mapped array of items
|
|
918
|
+
*/
|
|
919
|
+
declare function select<Item extends PlainObject, MapKey extends keyof Item>(array: Item[], filter: Item, map: MapKey): Array<Item[MapKey]>;
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region src/array/single.d.ts
|
|
922
|
+
/**
|
|
923
|
+
* Get the _only_ item matching the given value
|
|
924
|
+
*
|
|
925
|
+
* Throws an error if multiple items match the value
|
|
926
|
+
* @param array Array to search in
|
|
927
|
+
* @param callback Callback to get an item's value for matching
|
|
928
|
+
* @param value Value to match against
|
|
929
|
+
* @returns Only item that matches the value, or `undefined` if no match is found
|
|
930
|
+
*/
|
|
931
|
+
declare function single<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
|
|
932
|
+
/**
|
|
933
|
+
* Get the _only_ item matching the given value by key
|
|
934
|
+
*
|
|
935
|
+
* Throws an error if multiple items match the value
|
|
936
|
+
* @param array Array to search in
|
|
937
|
+
* @param key Key to get an item's value for matching
|
|
938
|
+
* @param value Value to match against
|
|
939
|
+
* @returns Only item that matches the value, or `undefined` if no match is found
|
|
940
|
+
*/
|
|
941
|
+
declare function single<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
|
|
942
|
+
/**
|
|
943
|
+
* Get the _only_ item matching the filter
|
|
944
|
+
*
|
|
945
|
+
* Throws an error if multiple items match the filter
|
|
946
|
+
* @param array Array to search in
|
|
947
|
+
* @param filter Filter callback to match items
|
|
948
|
+
* @returns Only item that matches the filter, or `undefined` if no match is found
|
|
949
|
+
*/
|
|
950
|
+
declare function single<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
|
|
781
951
|
//#endregion
|
|
782
952
|
//#region src/array/slice.d.ts
|
|
783
953
|
/**
|
|
@@ -1015,6 +1185,74 @@ declare function update<Item extends PlainObject, ItemKey extends keyof Item>(de
|
|
|
1015
1185
|
*/
|
|
1016
1186
|
declare function update<Item>(destination: Item[], updated: Item[]): Item[];
|
|
1017
1187
|
//#endregion
|
|
1188
|
+
//#region src/array/last.d.ts
|
|
1189
|
+
/**
|
|
1190
|
+
* Get the last items matching the given value
|
|
1191
|
+
* @param array Array to search in
|
|
1192
|
+
* @param callback Callback to get an item's value for matching
|
|
1193
|
+
* @param value Value to match against
|
|
1194
|
+
* @returns Last item that matches the value, or `undefined` if no match is found
|
|
1195
|
+
*/
|
|
1196
|
+
declare function last<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
|
|
1197
|
+
/**
|
|
1198
|
+
* Get the first item matching the given value by key
|
|
1199
|
+
* @param array Array to search in
|
|
1200
|
+
* @param key Key to get an item's value for matching
|
|
1201
|
+
* @param value Value to match against
|
|
1202
|
+
* @returns Last item that matches the value, or `undefined` if no match is found
|
|
1203
|
+
*/
|
|
1204
|
+
declare function last<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
|
|
1205
|
+
/**
|
|
1206
|
+
* Get the last item matching the filter
|
|
1207
|
+
* @param array Array to search in
|
|
1208
|
+
* @param filter Filter callback to match items
|
|
1209
|
+
* @returns Last item that matches the filter, or `undefined` if no match is found
|
|
1210
|
+
*/
|
|
1211
|
+
declare function last<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
|
|
1212
|
+
/**
|
|
1213
|
+
* Get the last item from an array
|
|
1214
|
+
* @param array Array to get from
|
|
1215
|
+
* @return Last item from the array, or `undefined` if the array is empty
|
|
1216
|
+
*/
|
|
1217
|
+
declare function last<Item>(array: Item[]): Item | undefined;
|
|
1218
|
+
declare namespace last {
|
|
1219
|
+
var _a: typeof lastOrDefault;
|
|
1220
|
+
export { _a as default };
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Get the last item matching the given value
|
|
1224
|
+
* @param array Array to search in
|
|
1225
|
+
* @param defaultValue Default value to return if no match is found
|
|
1226
|
+
* @param callback Callback to get an item's value for matching
|
|
1227
|
+
* @param value Value to match against
|
|
1228
|
+
* @returns Last item that matches the value, or the default value if no match is found
|
|
1229
|
+
*/
|
|
1230
|
+
declare function lastOrDefault<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], defaultValue: Item, callback: Callback, value: ReturnType<Callback>): Item;
|
|
1231
|
+
/**
|
|
1232
|
+
* Get the last item matching the given value by key
|
|
1233
|
+
* @param array Array to search in
|
|
1234
|
+
* @param defaultValue Default value to return if no match is found
|
|
1235
|
+
* @param key Key to get an item's value for matching
|
|
1236
|
+
* @param value Value to match against
|
|
1237
|
+
* @returns Last item that matches the value, or the default value if no match is found
|
|
1238
|
+
*/
|
|
1239
|
+
declare function lastOrDefault<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], defaultValue: Item, key: ItemKey, value: Item[ItemKey]): Item;
|
|
1240
|
+
/**
|
|
1241
|
+
* Get the last item matching the filter
|
|
1242
|
+
* @param array Array to search in
|
|
1243
|
+
* @param defaultValue Default value to return if no match is found
|
|
1244
|
+
* @param filter Filter callback to match items
|
|
1245
|
+
* @returns Last item that matches the filter, or the default value if no match is found
|
|
1246
|
+
*/
|
|
1247
|
+
declare function lastOrDefault<Item>(array: Item[], defaultValue: Item, filter: (item: Item, index: number, array: Item[]) => boolean): Item;
|
|
1248
|
+
/**
|
|
1249
|
+
* Get the last item from an array
|
|
1250
|
+
* @param array Array to get from
|
|
1251
|
+
* @param defaultValue Default value to return if the array is empty
|
|
1252
|
+
* @return Last item from the array, or the default value if the array is empty
|
|
1253
|
+
*/
|
|
1254
|
+
declare function lastOrDefault<Item>(array: Item[], defaultValue: Item): Item;
|
|
1255
|
+
//#endregion
|
|
1018
1256
|
//#region src/array/move.d.ts
|
|
1019
1257
|
/**
|
|
1020
1258
|
* Move an item _(or array of items)_ to the position of another item _(or array of items)_ within an array
|
|
@@ -2432,6 +2670,8 @@ declare function titleCase(value: string): string;
|
|
|
2432
2670
|
declare function upperCase(value: string): string;
|
|
2433
2671
|
//#endregion
|
|
2434
2672
|
//#region src/string/index.d.ts
|
|
2673
|
+
declare function dedent(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
2674
|
+
declare function dedent(value: string): string;
|
|
2435
2675
|
/**
|
|
2436
2676
|
* Get a new UUID-string _(version 4)_
|
|
2437
2677
|
* @returns UUID string
|
|
@@ -3108,6 +3348,55 @@ declare function isInstanceOf<Instance>(constructor: Constructor<Instance>, valu
|
|
|
3108
3348
|
* @returns `true` if the value is a `Key` _(`number` or `string`)_, otherwise `false`
|
|
3109
3349
|
*/
|
|
3110
3350
|
declare function isKey(value: unknown): value is Key;
|
|
3351
|
+
/**
|
|
3352
|
+
* Is the value not an array or a plain object?
|
|
3353
|
+
* @param value Value to check
|
|
3354
|
+
* @returns `true` if the value is not an array or a plain object, otherwise `false`
|
|
3355
|
+
*/
|
|
3356
|
+
declare function isNonArrayOrPlainObject<Value>(value: Value): value is Exclude<Value, ArrayOrPlainObject>;
|
|
3357
|
+
/**
|
|
3358
|
+
* Is the value not a constructor function?
|
|
3359
|
+
* @param value Value to check
|
|
3360
|
+
* @returns `true` if the value is not a constructor function, otherwise `false`
|
|
3361
|
+
*/
|
|
3362
|
+
declare function isNonConstructor<Value>(value: Value): value is Exclude<Value, Constructor>;
|
|
3363
|
+
/**
|
|
3364
|
+
* Is the value not an instance of the constructor?
|
|
3365
|
+
* @param constructor Class constructor
|
|
3366
|
+
* @param value Value to check
|
|
3367
|
+
* @returns `true` if the value is not an instance of the constructor, otherwise `false`
|
|
3368
|
+
*/
|
|
3369
|
+
declare function isNonInstanceOf<Instance, Value>(constructor: Constructor<Instance>, value: Value): value is Exclude<Value, Instance>;
|
|
3370
|
+
/**
|
|
3371
|
+
* Is the value not a key?
|
|
3372
|
+
* @param value Value to check
|
|
3373
|
+
* @returns `true` if the value is not a `Key` _(`number` or `string`)_, otherwise `false`
|
|
3374
|
+
*/
|
|
3375
|
+
declare function isNonKey<Value>(value: Value): value is Exclude<Value, Key>;
|
|
3376
|
+
/**
|
|
3377
|
+
* Is the value not a number?
|
|
3378
|
+
* @param value Value to check
|
|
3379
|
+
* @returns `true` if the value is not a `number`, otherwise `false`
|
|
3380
|
+
*/
|
|
3381
|
+
declare function isNonNumber<Value>(value: Value): value is Exclude<Value, number>;
|
|
3382
|
+
/**
|
|
3383
|
+
* Is the value not a plain object?
|
|
3384
|
+
* @param value Value to check
|
|
3385
|
+
* @returns `true` if the value is not a plain object, otherwise `false`
|
|
3386
|
+
*/
|
|
3387
|
+
declare function isNonPlainObject<Value>(value: Value): value is Exclude<Value, PlainObject>;
|
|
3388
|
+
/**
|
|
3389
|
+
* Is the value not a primitive value?
|
|
3390
|
+
* @param value Value to check
|
|
3391
|
+
* @returns `true` if the value is not a primitive value, otherwise `false`
|
|
3392
|
+
*/
|
|
3393
|
+
declare function isNonPrimitive<Value>(value: Value): value is Exclude<Value, Primitive>;
|
|
3394
|
+
/**
|
|
3395
|
+
* Is the value not a typed array?
|
|
3396
|
+
* @param value Value to check
|
|
3397
|
+
* @returns `true` if the value is not a typed array, otherwise `false`
|
|
3398
|
+
*/
|
|
3399
|
+
declare function isNonTypedArray<Value>(value: Value): value is Exclude<Value, TypedArray>;
|
|
3111
3400
|
/**
|
|
3112
3401
|
* Is the value a number?
|
|
3113
3402
|
* @param value Value to check
|
|
@@ -3140,12 +3429,42 @@ declare function isTypedArray(value: unknown): value is TypedArray;
|
|
|
3140
3429
|
* @returns `true` if the value is considered empty, otherwise `false`
|
|
3141
3430
|
*/
|
|
3142
3431
|
declare function isEmpty(value: unknown): boolean;
|
|
3432
|
+
/**
|
|
3433
|
+
* Is the value not empty, or holding non-empty values?
|
|
3434
|
+
* @param value Value to check
|
|
3435
|
+
* @returns `true` if the value is not considered empty, otherwise `false`
|
|
3436
|
+
*/
|
|
3437
|
+
declare function isNonEmpty(value: unknown): boolean;
|
|
3143
3438
|
/**
|
|
3144
3439
|
* Is the value not `undefined` or `null`?
|
|
3145
3440
|
* @param value Value to check
|
|
3146
3441
|
* @returns `true` if the value is not `undefined` or `null`, otherwise `false`
|
|
3147
3442
|
*/
|
|
3148
|
-
declare function isNonNullable(value:
|
|
3443
|
+
declare function isNonNullable<Value>(value: Value): value is Exclude<Value, undefined | null>;
|
|
3444
|
+
/**
|
|
3445
|
+
* Is the value not `undefined`, `null`, or stringified as an empty _(no whitespace)_ string?
|
|
3446
|
+
* @param value Value to check
|
|
3447
|
+
* @returns `true` if the value is not `undefined`, `null`, or matches an empty string, otherwise `false`
|
|
3448
|
+
*/
|
|
3449
|
+
declare function isNonNullableOrEmpty<Value>(value: Value): value is Exclude<Value, undefined | null | ''>;
|
|
3450
|
+
/**
|
|
3451
|
+
* Is the value not `undefined`, `null`, or stringified as a whitespace-only string?
|
|
3452
|
+
* @param value Value to check
|
|
3453
|
+
* @returns `true` if the value is not `undefined`, `null`, or matches a whitespace-only string, otherwise `false`
|
|
3454
|
+
*/
|
|
3455
|
+
declare function isNonNullableOrWhitespace<Value>(value: Value): value is Exclude<Value, undefined | null | ''>;
|
|
3456
|
+
/**
|
|
3457
|
+
* Is the value not a number or a number-like string?
|
|
3458
|
+
* @param value Value to check
|
|
3459
|
+
* @returns `true` if the value is not a number or a number-like string, otherwise `false`
|
|
3460
|
+
*/
|
|
3461
|
+
declare function isNonNumerical<Value>(value: Value): value is Exclude<Value, number | `${number}`>;
|
|
3462
|
+
/**
|
|
3463
|
+
* Is the value not an object _(or function)_?
|
|
3464
|
+
* @param value Value to check
|
|
3465
|
+
* @returns `true` if the value is not an object, otherwise `false`
|
|
3466
|
+
*/
|
|
3467
|
+
declare function isNonObject<Value>(value: Value): value is Exclude<Value, object>;
|
|
3149
3468
|
/**
|
|
3150
3469
|
* Is the value `undefined` or `null`?
|
|
3151
3470
|
* @param value Value to check
|
|
@@ -3153,21 +3472,21 @@ declare function isNonNullable(value: unknown): value is Exclude<unknown, undefi
|
|
|
3153
3472
|
*/
|
|
3154
3473
|
declare function isNullable(value: unknown): value is undefined | null;
|
|
3155
3474
|
/**
|
|
3156
|
-
* Is the value `undefined`, `null`, or an empty _(no whitespace)_ string?
|
|
3475
|
+
* Is the value `undefined`, `null`, or stringified as an empty _(no whitespace)_ string?
|
|
3157
3476
|
* @param value Value to check
|
|
3158
|
-
* @returns `true` if the value is nullable or an empty string, otherwise `false`
|
|
3477
|
+
* @returns `true` if the value is nullable or matches an empty string, otherwise `false`
|
|
3159
3478
|
*/
|
|
3160
3479
|
declare function isNullableOrEmpty(value: unknown): value is undefined | null | '';
|
|
3161
3480
|
/**
|
|
3162
|
-
* Is the value `undefined`, `null`, or a whitespace-only string?
|
|
3481
|
+
* Is the value `undefined`, `null`, or stringified as a whitespace-only string?
|
|
3163
3482
|
* @param value Value to check
|
|
3164
|
-
* @returns `true` if the value is nullable or a whitespace-only string, otherwise `false`
|
|
3483
|
+
* @returns `true` if the value is nullable or matches a whitespace-only string, otherwise `false`
|
|
3165
3484
|
*/
|
|
3166
3485
|
declare function isNullableOrWhitespace(value: unknown): value is undefined | null | '';
|
|
3167
3486
|
/**
|
|
3168
3487
|
* Is the value a number or a number-like string?
|
|
3169
3488
|
* @param value Value to check
|
|
3170
|
-
* @returns `true` if the value is a number or a
|
|
3489
|
+
* @returns `true` if the value is a number or a number-like string, otherwise `false`
|
|
3171
3490
|
*/
|
|
3172
3491
|
declare function isNumerical(value: unknown): value is number | `${number}`;
|
|
3173
3492
|
/**
|
|
@@ -4507,4 +4826,4 @@ declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
4507
4826
|
get(value: Value, update?: boolean): Value | undefined;
|
|
4508
4827
|
}
|
|
4509
4828
|
//#endregion
|
|
4510
|
-
export { AnyResult, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayPosition, ArrayValueSorter, Asserter, AsyncCancelableCallback, AttemptFlow, AttemptFlowPromise, type Beacon, type BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, Err, EventPosition, ExtendedErr, ExtendedResult, Flow, FlowPromise, FulfilledPromise, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, HasValue, Key, KeyedValue, type Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NumericalKeys, NumericalValues, type Observable, type Observer, Ok, OnceAsyncCallback, OnceCallback, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PlainObject, Primitive, PromiseData, PromiseHandlers, PromiseOptions, PromiseParameters, PromiseStrategy, PromiseTimeoutError, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues, type Queue, QueueError, type QueueOptions, type Queued, type QueuedResult, type RGBAColor, type RGBColor, RejectedPromise, RequiredKeys, Result, ResultMatch, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, Simplify, SizedMap, SizedSet, Smushed, SortDirection, Sorter, type Subscription, TemplateOptions, type Time, ToString, TypedArray, Unsmushed, UnwrapValue, assert, attempt, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, difference, drop, endsWith, endsWithArray, equal, error, exists, filter, find, flatten, floor, flow, fromQuery, toPromise as fromResult, toPromise, getArray, getArrayPosition, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getTimedPromise, getUuid, getValue, groupBy, handleResult, hasValue, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, insert, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonNullable, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, matchResult, max, median, memoize, merge, min, move, noop, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, retry, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, settlePromise, shuffle, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toQuery, toRecord, toResult, toSet, toggle, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|
|
4829
|
+
export { AnyResult, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayPosition, ArrayValueSorter, Asserter, AsyncCancelableCallback, AttemptFlow, AttemptFlowPromise, type Beacon, type BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, Err, EventPosition, ExtendedErr, ExtendedResult, Flow, FlowPromise, FulfilledPromise, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, HasValue, Key, KeyedValue, type Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NumericalKeys, NumericalValues, type Observable, type Observer, Ok, OnceAsyncCallback, OnceCallback, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PlainObject, Primitive, PromiseData, PromiseHandlers, PromiseOptions, PromiseParameters, PromiseStrategy, PromiseTimeoutError, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues, type Queue, QueueError, type QueueOptions, type Queued, type QueuedResult, type RGBAColor, type RGBColor, RejectedPromise, RequiredKeys, Result, ResultMatch, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, Simplify, SizedMap, SizedSet, Smushed, SortDirection, Sorter, type Subscription, TemplateOptions, type Time, ToString, TypedArray, Unsmushed, UnwrapValue, assert, attempt, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, dedent, delay, diff, difference, drop, endsWith, endsWithArray, equal, error, exists, filter, find, first, flatten, floor, flow, fromQuery, toPromise as fromResult, toPromise, getArray, getArrayPosition, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getTimedPromise, getUuid, getValue, groupBy, handleResult, hasValue, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, insert, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, last, logger, lowerCase, matchResult, max, median, memoize, merge, min, move, noop, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, settlePromise, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toQuery, toRecord, toResult, toSet, toggle, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|