modern-ts 0.8.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/LICENSE +201 -0
- package/README.md +223 -0
- package/README.zh-CN.md +223 -0
- package/dist/chunks/Errors-BWEYu-AB.cjs +2 -0
- package/dist/chunks/Errors-BWEYu-AB.cjs.map +1 -0
- package/dist/chunks/Errors-DwUAvFIF.mjs +63 -0
- package/dist/chunks/Errors-DwUAvFIF.mjs.map +1 -0
- package/dist/chunks/Math-CGEH1ClN.mjs +68 -0
- package/dist/chunks/Math-CGEH1ClN.mjs.map +1 -0
- package/dist/chunks/Math-CWZVxSF-.cjs +2 -0
- package/dist/chunks/Math-CWZVxSF-.cjs.map +1 -0
- package/dist/chunks/base-B9k8Lqvf.mjs +56 -0
- package/dist/chunks/base-B9k8Lqvf.mjs.map +1 -0
- package/dist/chunks/base-BTXL1y_I.cjs +2 -0
- package/dist/chunks/base-BTXL1y_I.cjs.map +1 -0
- package/dist/chunks/base-BpECeKwU.mjs +19 -0
- package/dist/chunks/base-BpECeKwU.mjs.map +1 -0
- package/dist/chunks/base-BvHqpP_s.cjs +2 -0
- package/dist/chunks/base-BvHqpP_s.cjs.map +1 -0
- package/dist/chunks/base-K-RHLZ-S.mjs +46 -0
- package/dist/chunks/base-K-RHLZ-S.mjs.map +1 -0
- package/dist/chunks/base-r6kn0B0D.cjs +2 -0
- package/dist/chunks/base-r6kn0B0D.cjs.map +1 -0
- package/dist/chunks/combine-async-DcG-3p8i.cjs +2 -0
- package/dist/chunks/combine-async-DcG-3p8i.cjs.map +1 -0
- package/dist/chunks/combine-async-Dcg4ya1R.mjs +236 -0
- package/dist/chunks/combine-async-Dcg4ya1R.mjs.map +1 -0
- package/dist/chunks/delay-CG3cD7bk.cjs +2 -0
- package/dist/chunks/delay-CG3cD7bk.cjs.map +1 -0
- package/dist/chunks/delay-CKIXpP71.mjs +32 -0
- package/dist/chunks/delay-CKIXpP71.mjs.map +1 -0
- package/dist/chunks/helper-BVabbpmX.mjs +165 -0
- package/dist/chunks/helper-BVabbpmX.mjs.map +1 -0
- package/dist/chunks/helper-tsqZMRHW.cjs +3 -0
- package/dist/chunks/helper-tsqZMRHW.cjs.map +1 -0
- package/dist/chunks/local-8JVtLN0O.mjs +10 -0
- package/dist/chunks/local-8JVtLN0O.mjs.map +1 -0
- package/dist/chunks/local-Da4yU-nE.cjs +2 -0
- package/dist/chunks/local-Da4yU-nE.cjs.map +1 -0
- package/dist/chunks/types-B7X_LBjM.cjs +2 -0
- package/dist/chunks/types-B7X_LBjM.cjs.map +1 -0
- package/dist/chunks/types-DE2SnSbz.mjs +5 -0
- package/dist/chunks/types-DE2SnSbz.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +759 -0
- package/dist/index.mjs.map +1 -0
- package/dist/subpath/Arr.cjs +2 -0
- package/dist/subpath/Arr.cjs.map +1 -0
- package/dist/subpath/Arr.mjs +539 -0
- package/dist/subpath/Arr.mjs.map +1 -0
- package/dist/subpath/Concurrent.cjs +15 -0
- package/dist/subpath/Concurrent.cjs.map +1 -0
- package/dist/subpath/Concurrent.mjs +4044 -0
- package/dist/subpath/Concurrent.mjs.map +1 -0
- package/dist/subpath/FetchQ.cjs +2 -0
- package/dist/subpath/FetchQ.cjs.map +1 -0
- package/dist/subpath/FetchQ.mjs +519 -0
- package/dist/subpath/FetchQ.mjs.map +1 -0
- package/dist/subpath/Fit.cjs +2 -0
- package/dist/subpath/Fit.cjs.map +1 -0
- package/dist/subpath/Fit.mjs +914 -0
- package/dist/subpath/Fit.mjs.map +1 -0
- package/dist/subpath/Lazy.cjs +2 -0
- package/dist/subpath/Lazy.cjs.map +1 -0
- package/dist/subpath/Lazy.mjs +72 -0
- package/dist/subpath/Lazy.mjs.map +1 -0
- package/dist/subpath/Maps.cjs +2 -0
- package/dist/subpath/Maps.cjs.map +1 -0
- package/dist/subpath/Maps.mjs +123 -0
- package/dist/subpath/Maps.mjs.map +1 -0
- package/dist/subpath/Maybe.cjs +2 -0
- package/dist/subpath/Maybe.cjs.map +1 -0
- package/dist/subpath/Maybe.mjs +329 -0
- package/dist/subpath/Maybe.mjs.map +1 -0
- package/dist/subpath/Reactive.cjs +2 -0
- package/dist/subpath/Reactive.cjs.map +1 -0
- package/dist/subpath/Reactive.mjs +1204 -0
- package/dist/subpath/Reactive.mjs.map +1 -0
- package/dist/subpath/Reader.cjs +2 -0
- package/dist/subpath/Reader.cjs.map +1 -0
- package/dist/subpath/Reader.mjs +75 -0
- package/dist/subpath/Reader.mjs.map +1 -0
- package/dist/subpath/ReaderT.cjs +2 -0
- package/dist/subpath/ReaderT.cjs.map +1 -0
- package/dist/subpath/ReaderT.mjs +148 -0
- package/dist/subpath/ReaderT.mjs.map +1 -0
- package/dist/subpath/Resource.cjs +2 -0
- package/dist/subpath/Resource.cjs.map +1 -0
- package/dist/subpath/Resource.mjs +150 -0
- package/dist/subpath/Resource.mjs.map +1 -0
- package/dist/subpath/Result.cjs +2 -0
- package/dist/subpath/Result.cjs.map +1 -0
- package/dist/subpath/Result.mjs +337 -0
- package/dist/subpath/Result.mjs.map +1 -0
- package/dist/subpath/Sets.cjs +2 -0
- package/dist/subpath/Sets.cjs.map +1 -0
- package/dist/subpath/Sets.mjs +92 -0
- package/dist/subpath/Sets.mjs.map +1 -0
- package/dist/subpath/Str.cjs +2 -0
- package/dist/subpath/Str.cjs.map +1 -0
- package/dist/subpath/Str.mjs +114 -0
- package/dist/subpath/Str.mjs.map +1 -0
- package/dist/subpath/TxScope.cjs +2 -0
- package/dist/subpath/TxScope.cjs.map +1 -0
- package/dist/subpath/TxScope.mjs +138 -0
- package/dist/subpath/TxScope.mjs.map +1 -0
- package/dist/subpath/TypeTool.cjs +2 -0
- package/dist/subpath/TypeTool.cjs.map +1 -0
- package/dist/subpath/TypeTool.mjs +9 -0
- package/dist/subpath/TypeTool.mjs.map +1 -0
- package/dist/subpath/Utils.cjs +2 -0
- package/dist/subpath/Utils.cjs.map +1 -0
- package/dist/subpath/Utils.mjs +835 -0
- package/dist/subpath/Utils.mjs.map +1 -0
- package/dist/subpath/VirtualTime.cjs +2 -0
- package/dist/subpath/VirtualTime.cjs.map +1 -0
- package/dist/subpath/VirtualTime.mjs +1186 -0
- package/dist/subpath/VirtualTime.mjs.map +1 -0
- package/dist/types/Arr.d.ts +2 -0
- package/dist/types/Concurrent/Lock/condition_variable.d.ts +138 -0
- package/dist/types/Concurrent/Lock/mutex.d.ts +185 -0
- package/dist/types/Concurrent/Lock/rwlock.d.ts +253 -0
- package/dist/types/Concurrent/Lock/semaphore.d.ts +208 -0
- package/dist/types/Concurrent/Valve/__export__.d.ts +5 -0
- package/dist/types/Concurrent/Valve/circuit-breaker.d.ts +146 -0
- package/dist/types/Concurrent/Valve/leaky-bucket.d.ts +115 -0
- package/dist/types/Concurrent/Valve/sliding-window.d.ts +91 -0
- package/dist/types/Concurrent/Valve/token-bucket.d.ts +68 -0
- package/dist/types/Concurrent/__export__.d.ts +15 -0
- package/dist/types/Concurrent/barrier.d.ts +255 -0
- package/dist/types/Concurrent/channel.d.ts +239 -0
- package/dist/types/Concurrent/delay.d.ts +42 -0
- package/dist/types/Concurrent/ext/map.d.ts +82 -0
- package/dist/types/Concurrent/ext/other.d.ts +113 -0
- package/dist/types/Concurrent/ext/race.d.ts +31 -0
- package/dist/types/Concurrent/ext/some.d.ts +64 -0
- package/dist/types/Concurrent/limiter.d.ts +131 -0
- package/dist/types/Concurrent/scheduler.d.ts +171 -0
- package/dist/types/Concurrent/task-scope.d.ts +282 -0
- package/dist/types/Concurrent.d.ts +2 -0
- package/dist/types/Errors.d.ts +66 -0
- package/dist/types/FetchQ.d.ts +2 -0
- package/dist/types/Fit/__export__.d.ts +5 -0
- package/dist/types/Fit/base.d.ts +325 -0
- package/dist/types/Fit/parser.d.ts +110 -0
- package/dist/types/Fit/standard-schema.d.ts +127 -0
- package/dist/types/Fit/sugar.d.ts +274 -0
- package/dist/types/Fit/tool.d.ts +585 -0
- package/dist/types/Fit.d.ts +2 -0
- package/dist/types/Lazy.d.ts +2 -0
- package/dist/types/Maps.d.ts +2 -0
- package/dist/types/Maybe/__export__.d.ts +6 -0
- package/dist/types/Maybe/base.d.ts +62 -0
- package/dist/types/Maybe/consumers-async.d.ts +58 -0
- package/dist/types/Maybe/consumers.d.ts +63 -0
- package/dist/types/Maybe/operators-async.d.ts +145 -0
- package/dist/types/Maybe/operators.d.ts +177 -0
- package/dist/types/Maybe/types.d.ts +12 -0
- package/dist/types/Maybe.d.ts +2 -0
- package/dist/types/MockClock/Timeline.d.ts +392 -0
- package/dist/types/MockClock/TimerHandle.d.ts +159 -0
- package/dist/types/MockClock/TimerHeap.d.ts +21 -0
- package/dist/types/MockClock/VirtualTimeManager.d.ts +23 -0
- package/dist/types/MockClock/__export__.d.ts +104 -0
- package/dist/types/MockClock/hooks/__export__.d.ts +9 -0
- package/dist/types/MockClock/hooks/hookAbortSignal.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookDate.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookIntl.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookMessageChannel.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookMicrotasks.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookOs.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookPerformance.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookProcess.d.ts +3 -0
- package/dist/types/MockClock/hooks/hookTimers.d.ts +3 -0
- package/dist/types/MockClock/types.d.ts +103 -0
- package/dist/types/Other/FetchQ.d.ts +320 -0
- package/dist/types/Other/deque.d.ts +59 -0
- package/dist/types/Other/disjointSet.d.ts +53 -0
- package/dist/types/Other/heap.d.ts +41 -0
- package/dist/types/Other/lazy.d.ts +127 -0
- package/dist/types/Other/queue.d.ts +42 -0
- package/dist/types/Other/secret.d.ts +111 -0
- package/dist/types/Other/stack.d.ts +40 -0
- package/dist/types/Reactive/__export__.d.ts +4 -0
- package/dist/types/Reactive/event_emitter.d.ts +195 -0
- package/dist/types/Reactive/flow-combination.d.ts +74 -0
- package/dist/types/Reactive/flow.d.ts +180 -0
- package/dist/types/Reactive/pace.d.ts +80 -0
- package/dist/types/Reactive.d.ts +2 -0
- package/dist/types/Reader/__export-readerT__.d.ts +4 -0
- package/dist/types/Reader/__export-reader__.d.ts +4 -0
- package/dist/types/Reader/local.d.ts +39 -0
- package/dist/types/Reader/reader-async.d.ts +84 -0
- package/dist/types/Reader/reader.d.ts +96 -0
- package/dist/types/Reader/readerT-async.d.ts +186 -0
- package/dist/types/Reader/readerT.d.ts +178 -0
- package/dist/types/Reader/types.d.ts +37 -0
- package/dist/types/Reader.d.ts +2 -0
- package/dist/types/ReaderT.d.ts +2 -0
- package/dist/types/Resource/TxScope-async.d.ts +86 -0
- package/dist/types/Resource/TxScope.d.ts +85 -0
- package/dist/types/Resource/__export-TxScope__.d.ts +2 -0
- package/dist/types/Resource/__export-resource__.d.ts +2 -0
- package/dist/types/Resource/resource-async.d.ts +79 -0
- package/dist/types/Resource/resource.d.ts +78 -0
- package/dist/types/Resource/types.d.ts +79 -0
- package/dist/types/Resource.d.ts +2 -0
- package/dist/types/Result/Consumers/branch-async.d.ts +77 -0
- package/dist/types/Result/Consumers/branch.d.ts +70 -0
- package/dist/types/Result/Consumers/inspect.d.ts +66 -0
- package/dist/types/Result/Operators/Async/combine-async.d.ts +69 -0
- package/dist/types/Result/Operators/Async/partition-async.d.ts +29 -0
- package/dist/types/Result/Operators/Async/reduce-async.d.ts +15 -0
- package/dist/types/Result/Operators/Async/transform-async.d.ts +90 -0
- package/dist/types/Result/Operators/combine.d.ts +60 -0
- package/dist/types/Result/Operators/flatten.d.ts +26 -0
- package/dist/types/Result/Operators/partition.d.ts +25 -0
- package/dist/types/Result/Operators/reduce.d.ts +12 -0
- package/dist/types/Result/Operators/transform.d.ts +70 -0
- package/dist/types/Result/__export__.d.ts +14 -0
- package/dist/types/Result/base.d.ts +115 -0
- package/dist/types/Result/types.d.ts +34 -0
- package/dist/types/Result.d.ts +2 -0
- package/dist/types/Sets.d.ts +2 -0
- package/dist/types/Str.d.ts +2 -0
- package/dist/types/TxScope.d.ts +2 -0
- package/dist/types/TypeTool.d.ts +2 -0
- package/dist/types/Utils/Array/__export__.d.ts +10 -0
- package/dist/types/Utils/Array/filtering.d.ts +89 -0
- package/dist/types/Utils/Array/flatten.d.ts +45 -0
- package/dist/types/Utils/Array/grouping.d.ts +44 -0
- package/dist/types/Utils/Array/iteration.d.ts +86 -0
- package/dist/types/Utils/Array/operators.d.ts +62 -0
- package/dist/types/Utils/Array/randomization.d.ts +76 -0
- package/dist/types/Utils/Array/set.d.ts +108 -0
- package/dist/types/Utils/Array/slice.d.ts +189 -0
- package/dist/types/Utils/Array/sorting.d.ts +55 -0
- package/dist/types/Utils/Array/zip.d.ts +93 -0
- package/dist/types/Utils/Functions/__export__.d.ts +5 -0
- package/dist/types/Utils/Functions/base.d.ts +157 -0
- package/dist/types/Utils/Functions/curry.d.ts +73 -0
- package/dist/types/Utils/Functions/debounce.d.ts +240 -0
- package/dist/types/Utils/Functions/defer.d.ts +43 -0
- package/dist/types/Utils/Functions/pipe.d.ts +205 -0
- package/dist/types/Utils/Map.d.ts +284 -0
- package/dist/types/Utils/Math.d.ts +225 -0
- package/dist/types/Utils/Object/__export__.d.ts +2 -0
- package/dist/types/Utils/Object/base.d.ts +131 -0
- package/dist/types/Utils/Object/clone.d.ts +81 -0
- package/dist/types/Utils/Predicates.d.ts +361 -0
- package/dist/types/Utils/Set.d.ts +105 -0
- package/dist/types/Utils/String.d.ts +217 -0
- package/dist/types/Utils/__export__.d.ts +9 -0
- package/dist/types/Utils/type-tool.d.ts +168 -0
- package/dist/types/Utils.d.ts +2 -0
- package/dist/types/VirtualTime.d.ts +2 -0
- package/dist/types/helper.d.ts +71 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/unknown-error.d.ts +98 -0
- package/package.json +179 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the internal [[Class]] property of a value using Object.prototype.toString
|
|
3
|
+
* @param value - Value to check
|
|
4
|
+
* @returns String representation of value's type
|
|
5
|
+
* @remarks Handles null and undefined explicitly to avoid [[Class]] inconsistencies
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTag: (value: unknown) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if value is a string primitive or String object
|
|
10
|
+
* @param value - Value to check
|
|
11
|
+
* @returns Type guard for string
|
|
12
|
+
* @remarks Returns true for both primitive strings and String objects
|
|
13
|
+
*/
|
|
14
|
+
export declare const isString: (value: unknown) => value is string;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if value is a number primitive or Number object
|
|
17
|
+
* @param value - Value to check
|
|
18
|
+
* @returns Type guard for number
|
|
19
|
+
* @remarks Returns true for both primitive numbers and Number objects
|
|
20
|
+
*/
|
|
21
|
+
export declare const isNumber: (value: unknown) => value is number;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if value is a finite number
|
|
24
|
+
* @param value - Value to check
|
|
25
|
+
* @returns Type guard for finite number
|
|
26
|
+
* @remarks Returns false for Infinity, -Infinity, and NaN
|
|
27
|
+
*/
|
|
28
|
+
export declare const isFinite: (value: unknown) => value is number;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if value is a boolean primitive or Boolean object
|
|
31
|
+
* @param value - Value to check
|
|
32
|
+
* @returns Type guard for boolean
|
|
33
|
+
* @remarks Returns true for both primitive booleans and Boolean objects
|
|
34
|
+
*/
|
|
35
|
+
export declare const isBoolean: (value: unknown) => value is boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if value is a symbol primitive or Symbol object
|
|
38
|
+
* @param value - Value to check
|
|
39
|
+
* @returns Type guard for symbol
|
|
40
|
+
* @remarks Returns true for both primitive symbols and Symbol objects
|
|
41
|
+
*/
|
|
42
|
+
export declare const isSymbol: (value: unknown) => value is symbol;
|
|
43
|
+
/**
|
|
44
|
+
* Checks if value is strictly null
|
|
45
|
+
* @param value - Value to check
|
|
46
|
+
* @returns Type guard for null
|
|
47
|
+
* @remarks Uses strict equality (value === null)
|
|
48
|
+
*/
|
|
49
|
+
export declare const isNull: (value: unknown) => value is null;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if value is strictly undefined
|
|
52
|
+
* @param value - Value to check
|
|
53
|
+
* @returns Type guard for undefined
|
|
54
|
+
* @remarks Uses strict equality (value === undefined)
|
|
55
|
+
*/
|
|
56
|
+
export declare const isUndefined: (value: unknown) => value is undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if value is null or undefined (loose equality)
|
|
59
|
+
* @param value - Value to check
|
|
60
|
+
* @returns Type guard for null | undefined
|
|
61
|
+
* @remarks Uses loose equality (value == null)
|
|
62
|
+
*/
|
|
63
|
+
export declare const isNil: (value: unknown) => value is null | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if value is NOT null or undefined
|
|
66
|
+
* @param value - Value to check
|
|
67
|
+
* @returns Type guard for NonNullable<unknown>
|
|
68
|
+
* @remarks Opposite of isNil
|
|
69
|
+
*/
|
|
70
|
+
export declare const isNotNil: (value: unknown) => value is NonNullable<unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Checks if value is NOT null or undefined with proper type narrowing
|
|
73
|
+
* @template T - Type of value when not nullish
|
|
74
|
+
* @param value - Value to check
|
|
75
|
+
* @returns Type guard for T
|
|
76
|
+
* @remarks Properly narrows generic types while filtering null/undefined
|
|
77
|
+
*/
|
|
78
|
+
export declare const isNotNullish: <T>(value: T | null | undefined) => value is T;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if value is a JavaScript primitive type
|
|
81
|
+
* @param value - Value to check
|
|
82
|
+
* @returns Type guard for primitive types
|
|
83
|
+
* @remarks Returns true for string, number, boolean, symbol, bigint, null, undefined
|
|
84
|
+
*/
|
|
85
|
+
export declare const isPrimitive: (value: unknown) => value is string | number | boolean | symbol | bigint | null | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Checks if value is an object (including functions)
|
|
88
|
+
* @param value - Value to check
|
|
89
|
+
* @returns Type guard for object
|
|
90
|
+
* @remarks Returns true for objects and functions, false for null
|
|
91
|
+
*/
|
|
92
|
+
export declare const isObject: (value: unknown) => value is object;
|
|
93
|
+
/**
|
|
94
|
+
* Checks if value is a function
|
|
95
|
+
* @param value - Value to check
|
|
96
|
+
* @returns Type guard for function
|
|
97
|
+
* @remarks Returns true for any function type
|
|
98
|
+
*/
|
|
99
|
+
export declare const isFunction: (value: unknown) => value is (...arg: unknown[]) => unknown;
|
|
100
|
+
/**
|
|
101
|
+
* Checks if value is an array
|
|
102
|
+
* @param value - Value to check
|
|
103
|
+
* @returns Type guard for array
|
|
104
|
+
* @remarks Uses native Array.isArray for reliability
|
|
105
|
+
*/
|
|
106
|
+
export declare const isArray: (value: unknown) => value is unknown[];
|
|
107
|
+
/**
|
|
108
|
+
* Checks if value is a plain object (object created by {} or new Object)
|
|
109
|
+
* @param value - Value to check
|
|
110
|
+
* @returns Type guard for plain object
|
|
111
|
+
* @remarks Returns false for arrays, dates, regexp, and custom class instances
|
|
112
|
+
*/
|
|
113
|
+
export declare const isPlainObject: (value: unknown) => value is Record<PropertyKey, unknown>;
|
|
114
|
+
/**
|
|
115
|
+
* Checks if value is an integer
|
|
116
|
+
* @param value - Value to check
|
|
117
|
+
* @returns Type guard for integer number
|
|
118
|
+
* @remarks Returns true for integer numbers, false for non-integer numbers
|
|
119
|
+
*/
|
|
120
|
+
export declare const isInteger: (value: unknown) => value is number;
|
|
121
|
+
/**
|
|
122
|
+
* Checks if value is a safe integer
|
|
123
|
+
* @param value - Value to check
|
|
124
|
+
* @returns Type guard for safe integer
|
|
125
|
+
* @remarks Safe integers are integers between -(2^53-1) and 2^53-1
|
|
126
|
+
*/
|
|
127
|
+
export declare const isSafeInteger: (value: unknown) => value is number;
|
|
128
|
+
/**
|
|
129
|
+
* Checks if value is a valid array-like length
|
|
130
|
+
* @param value - Value to check
|
|
131
|
+
* @returns Type guard for valid length number
|
|
132
|
+
* @remarks Valid lengths are non-negative integers β€ Number.MAX_SAFE_INTEGER
|
|
133
|
+
*/
|
|
134
|
+
export declare const isLength: (value: unknown) => value is number;
|
|
135
|
+
/**
|
|
136
|
+
* Checks if value is a Date object
|
|
137
|
+
* @param value - Value to check
|
|
138
|
+
* @returns Type guard for Date
|
|
139
|
+
* @remarks Returns true for Date instances only
|
|
140
|
+
*/
|
|
141
|
+
export declare const isDate: (value: unknown) => value is Date;
|
|
142
|
+
/**
|
|
143
|
+
* Checks if value is a RegExp object
|
|
144
|
+
* @param value - Value to check
|
|
145
|
+
* @returns Type guard for RegExp
|
|
146
|
+
* @remarks Returns true for RegExp instances only
|
|
147
|
+
*/
|
|
148
|
+
export declare const isRegExp: (value: unknown) => value is RegExp;
|
|
149
|
+
/**
|
|
150
|
+
* Checks if value is an Error object
|
|
151
|
+
* @param value - Value to check
|
|
152
|
+
* @returns Type guard for Error
|
|
153
|
+
* @remarks Returns true for Error and DOMException instances
|
|
154
|
+
*/
|
|
155
|
+
export declare const isError: (value: unknown) => value is Error;
|
|
156
|
+
/**
|
|
157
|
+
* Checks if value is a Map object
|
|
158
|
+
* @param value - Value to check
|
|
159
|
+
* @returns Type guard for Map<unknown, unknown>
|
|
160
|
+
* @remarks Returns true for Map instances only
|
|
161
|
+
*/
|
|
162
|
+
export declare const isMap: (value: unknown) => value is Map<unknown, unknown>;
|
|
163
|
+
/**
|
|
164
|
+
* Checks if value is a Set object
|
|
165
|
+
* @param value - Value to check
|
|
166
|
+
* @returns Type guard for Set<unknown>
|
|
167
|
+
* @remarks Returns true for Set instances only
|
|
168
|
+
*/
|
|
169
|
+
export declare const isSet: (value: unknown) => value is Set<unknown>;
|
|
170
|
+
/**
|
|
171
|
+
* Checks if value is a WeakMap object
|
|
172
|
+
* @param value - Value to check
|
|
173
|
+
* @returns Type guard for WeakMap<object, unknown>
|
|
174
|
+
* @remarks Returns true for WeakMap instances only
|
|
175
|
+
*/
|
|
176
|
+
export declare const isWeakMap: (value: unknown) => value is WeakMap<object, unknown>;
|
|
177
|
+
/**
|
|
178
|
+
* Checks if value is a WeakSet object
|
|
179
|
+
* @param value - Value to check
|
|
180
|
+
* @returns Type guard for WeakSet<object>
|
|
181
|
+
* @remarks Returns true for WeakSet instances only
|
|
182
|
+
*/
|
|
183
|
+
export declare const isWeakSet: (value: unknown) => value is WeakSet<object>;
|
|
184
|
+
/**
|
|
185
|
+
* Checks if value is an ArrayBuffer object
|
|
186
|
+
* @param value - Value to check
|
|
187
|
+
* @returns Type guard for ArrayBuffer
|
|
188
|
+
* @remarks Returns true for ArrayBuffer instances only
|
|
189
|
+
*/
|
|
190
|
+
export declare const isArrayBuffer: (value: unknown) => value is ArrayBuffer;
|
|
191
|
+
/**
|
|
192
|
+
* Checks if value is a typed array
|
|
193
|
+
* @param value - Value to check
|
|
194
|
+
* @returns Type guard for ArrayBufferView
|
|
195
|
+
* @remarks Supports all standard typed array types
|
|
196
|
+
*/
|
|
197
|
+
export declare const isTypedArray: (value: unknown) => value is ArrayBufferView;
|
|
198
|
+
/**
|
|
199
|
+
* Checks if code is running in a browser environment
|
|
200
|
+
* @returns True if running in browser with DOM access
|
|
201
|
+
* @remarks Verifies both window and document exist and are properly connected
|
|
202
|
+
*/
|
|
203
|
+
export declare const isBrowser: () => boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Checks if code is running in a client environment
|
|
206
|
+
* @returns True if running in any client-side context
|
|
207
|
+
* @remarks Less strict than isBrowser, checks for window or self
|
|
208
|
+
*/
|
|
209
|
+
export declare const isClient: () => boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Checks if code is running in a Node.js environment
|
|
212
|
+
* @returns True if running in Node.js
|
|
213
|
+
* @remarks Checks for process.versions.node existence
|
|
214
|
+
*/
|
|
215
|
+
export declare const isNode: () => boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Checks if value is a Buffer (Node.js)
|
|
218
|
+
* @param value - Value to check
|
|
219
|
+
* @returns True if value is a Buffer
|
|
220
|
+
* @remarks Uses Buffer.isBuffer if available, fails gracefully in browser
|
|
221
|
+
*/
|
|
222
|
+
export declare const isBuffer: (value: unknown) => boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Checks if value is a Blob object
|
|
225
|
+
* @param value - Value to check
|
|
226
|
+
* @returns Type guard for Blob
|
|
227
|
+
* @remarks Returns true for Blob instances only
|
|
228
|
+
*/
|
|
229
|
+
export declare const isBlob: (value: unknown) => value is Blob;
|
|
230
|
+
/**
|
|
231
|
+
* Checks if value is a File object
|
|
232
|
+
* @param value - Value to check
|
|
233
|
+
* @returns Type guard for File
|
|
234
|
+
* @remarks Returns true for File instances only
|
|
235
|
+
*/
|
|
236
|
+
export declare const isFile: (value: unknown) => value is File;
|
|
237
|
+
/**
|
|
238
|
+
* Checks if value is iterable (has Symbol.iterator)
|
|
239
|
+
* @param value - Value to check
|
|
240
|
+
* @returns Type guard for Iterable<unknown>
|
|
241
|
+
* @remarks Returns true for arrays, strings, maps, sets, and custom iterables
|
|
242
|
+
*/
|
|
243
|
+
export declare const isIterable: (value: unknown) => value is Iterable<unknown>;
|
|
244
|
+
/**
|
|
245
|
+
* Checks if value is async iterable (has Symbol.asyncIterator)
|
|
246
|
+
* @param value - Value to check
|
|
247
|
+
* @returns Type guard for AsyncIterable<unknown>
|
|
248
|
+
* @remarks Returns true for async generators and custom async iterables
|
|
249
|
+
*/
|
|
250
|
+
export declare const isAsyncIterable: (value: unknown) => value is AsyncIterable<unknown>;
|
|
251
|
+
export { isPromiseLike } from '../helper';
|
|
252
|
+
/**
|
|
253
|
+
* Checks if value is a Promise
|
|
254
|
+
* @param value - Value to check
|
|
255
|
+
* @returns Type guard for Promise<unknown>
|
|
256
|
+
* @remarks Returns true for native promises and promise-like objects
|
|
257
|
+
*/
|
|
258
|
+
export declare const isPromise: (value: unknown) => value is Promise<unknown>;
|
|
259
|
+
/**
|
|
260
|
+
* Checks if value is an instance of specified constructor
|
|
261
|
+
* @template T - Expected instance type
|
|
262
|
+
* @param value - Value to check
|
|
263
|
+
* @param constructor - Constructor function
|
|
264
|
+
* @returns Type guard for T
|
|
265
|
+
* @remarks Uses instanceof operator with type safety
|
|
266
|
+
*/
|
|
267
|
+
export declare const isInstanceOf: <T>(value: unknown, constructor: abstract new (...args: any[]) => T) => value is T;
|
|
268
|
+
/**
|
|
269
|
+
* Checks if value is a valid property key (string, number, or symbol)
|
|
270
|
+
* @param value - Value to check
|
|
271
|
+
* @returns Type guard for PropertyKey
|
|
272
|
+
* @remarks Returns true for values usable as object keys
|
|
273
|
+
*/
|
|
274
|
+
export declare const isPropertyKey: (value: unknown) => value is PropertyKey;
|
|
275
|
+
/**
|
|
276
|
+
* Checks if value is empty (null, undefined, or has no elements/properties)
|
|
277
|
+
* @param value - Value to check
|
|
278
|
+
* @returns True if value is considered empty
|
|
279
|
+
* @remarks Handles arrays, strings, maps, sets, and plain objects
|
|
280
|
+
*/
|
|
281
|
+
export declare const isEmpty: (value: unknown) => boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Checks if value is an empty plain object
|
|
284
|
+
* @param value - Value to check
|
|
285
|
+
* @returns Type guard for empty plain object
|
|
286
|
+
* @remarks Returns true only for plain objects with no own enumerable properties
|
|
287
|
+
*/
|
|
288
|
+
export declare const isEmptyObject: (value: unknown) => value is Record<PropertyKey, unknown>;
|
|
289
|
+
/**
|
|
290
|
+
* Checks if value is JSON serializable
|
|
291
|
+
* @param value - Value to check
|
|
292
|
+
* @returns True if value can be serialized to JSON
|
|
293
|
+
* @remarks Recursively checks arrays and objects, excludes functions and symbols
|
|
294
|
+
*/
|
|
295
|
+
export declare const isSerializable: (value: unknown) => boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Checks if value is a valid JSON value
|
|
298
|
+
* @param value - Value to check
|
|
299
|
+
* @returns True if value is JSON-compatible
|
|
300
|
+
* @remarks Less strict than isSerializable, allows undefined in some contexts
|
|
301
|
+
*/
|
|
302
|
+
export declare const isJSONValue: (value: unknown) => boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Checks if value is a JSON-serializable object
|
|
305
|
+
* @param value - Value to check
|
|
306
|
+
* @returns Type guard for JSON object
|
|
307
|
+
* @remarks Returns true for plain objects with JSON-compatible values
|
|
308
|
+
*/
|
|
309
|
+
export declare const isJSONObject: (value: unknown) => value is Record<string, unknown>;
|
|
310
|
+
/**
|
|
311
|
+
* Checks if value is a JSON-serializable array
|
|
312
|
+
* @param value - Value to check
|
|
313
|
+
* @returns Type guard for JSON array
|
|
314
|
+
* @remarks Returns true for arrays with JSON-compatible values
|
|
315
|
+
*/
|
|
316
|
+
export declare const isJSONArray: (value: unknown) => value is unknown[];
|
|
317
|
+
/**
|
|
318
|
+
* Checks if value is a valid JSON string
|
|
319
|
+
* @param value - Value to check
|
|
320
|
+
* @returns Type guard for JSON string
|
|
321
|
+
* @remarks Returns true for strings that parse to valid JSON
|
|
322
|
+
*/
|
|
323
|
+
export declare const isJSON: (value: unknown) => value is string;
|
|
324
|
+
/**
|
|
325
|
+
* Checks if value is a valid email format string
|
|
326
|
+
* @param value - Value to check
|
|
327
|
+
* @returns Type guard for email string
|
|
328
|
+
* @remarks Uses basic email regex validation
|
|
329
|
+
*/
|
|
330
|
+
export declare const isEmail: (value: unknown) => value is string;
|
|
331
|
+
/**
|
|
332
|
+
* Checks if value is a valid URL string
|
|
333
|
+
* @param value - Value to check
|
|
334
|
+
* @returns Type guard for URL string
|
|
335
|
+
* @remarks Uses URL constructor for validation
|
|
336
|
+
*/
|
|
337
|
+
export declare const isUrl: (value: unknown) => value is string;
|
|
338
|
+
/**
|
|
339
|
+
* Checks if value is a valid UUID string
|
|
340
|
+
* @param value - Value to check
|
|
341
|
+
* @returns Type guard for UUID string
|
|
342
|
+
* @remarks Supports both uppercase and lowercase UUIDs
|
|
343
|
+
*/
|
|
344
|
+
export declare const isUUID: (value: unknown) => value is string;
|
|
345
|
+
/**
|
|
346
|
+
* Deep equality check with custom comparator
|
|
347
|
+
* @param value - First value to compare
|
|
348
|
+
* @param other - Second value to compare
|
|
349
|
+
* @param customizer - Optional custom comparison function
|
|
350
|
+
* @returns True if values are deeply equal
|
|
351
|
+
* @remarks Handles circular references, NaN equality, and various object types
|
|
352
|
+
*/
|
|
353
|
+
export declare const isEqualWith: (value: unknown, other: unknown, customizer?: (val1: unknown, val2: unknown) => boolean | void) => boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Deep equality check without custom comparator
|
|
356
|
+
* @param value - First value to compare
|
|
357
|
+
* @param other - Second value to compare
|
|
358
|
+
* @returns True if values are deeply equal
|
|
359
|
+
* @remarks Convenience wrapper for isEqualWith without customizer
|
|
360
|
+
*/
|
|
361
|
+
export declare const isEqual: (value: unknown, other: unknown) => boolean;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new set containing only values that satisfy the predicate
|
|
3
|
+
* @remarks Type-safe overload supports type narrowing via type guards
|
|
4
|
+
* @param set - The source set to filter
|
|
5
|
+
* @param predicate - Function returning true for values to include
|
|
6
|
+
* @returns New set containing filtered values
|
|
7
|
+
* @throws {TypeError} If predicate is not a function
|
|
8
|
+
*/
|
|
9
|
+
export declare function filter<T, S extends T>(set: Set<T>, predicate: (value: T) => value is S): Set<S>;
|
|
10
|
+
export declare function filter<T>(set: Set<T>, predicate: (value: T) => boolean): Set<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new set by transforming each value
|
|
13
|
+
* @remarks Duplicate transformed values are deduplicated in the result set
|
|
14
|
+
* @param set - Source set to map
|
|
15
|
+
* @param iteratee - Transformation function
|
|
16
|
+
* @returns New set with transformed values
|
|
17
|
+
* @throws {TypeError} If iteratee is not a function
|
|
18
|
+
*/
|
|
19
|
+
export declare const map: <T, U>(set: Set<T>, iteratee: (value: T) => U) => Set<U>;
|
|
20
|
+
/**
|
|
21
|
+
* Accumulates values into a single result
|
|
22
|
+
* @remarks Iteration order follows set iteration order
|
|
23
|
+
* @param set - Source set to reduce
|
|
24
|
+
* @param iteratee - Accumulator function
|
|
25
|
+
* @param initial_value - Starting value for accumulation
|
|
26
|
+
* @returns Final accumulated value
|
|
27
|
+
*/
|
|
28
|
+
export declare const reduce: <T, U>(set: Set<T>, iteratee: (accumulator: U, value: T) => U, initial_value: U) => U;
|
|
29
|
+
/**
|
|
30
|
+
* Counts occurrences of values grouped by key
|
|
31
|
+
* @remarks Keys are coerced to strings for object property access
|
|
32
|
+
* @param set - Source set to count
|
|
33
|
+
* @param iteratee - Function returning grouping key
|
|
34
|
+
* @returns Object mapping keys to counts
|
|
35
|
+
*/
|
|
36
|
+
export declare const countBy: <T>(set: Set<T>, iteratee: (value: T) => string | number) => Record<string | number, number>;
|
|
37
|
+
/**
|
|
38
|
+
* Groups values into a map by key
|
|
39
|
+
* @remarks Original values are preserved in arrays
|
|
40
|
+
* @param set - Source set to group
|
|
41
|
+
* @param iteratee - Function returning grouping key
|
|
42
|
+
* @returns Map from keys to arrays of values
|
|
43
|
+
*/
|
|
44
|
+
export declare const groupBy: <T, G>(set: Set<T>, iteratee: (value: T) => G) => Map<G, T[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Removes values that don't satisfy predicate from the original set
|
|
47
|
+
* @remarks Mutates the input set and returns it for chaining
|
|
48
|
+
* @param set - Set to filter in place
|
|
49
|
+
* @param predicate - Function returning true to keep value
|
|
50
|
+
* @returns The same set instance after mutation
|
|
51
|
+
* @throws {TypeError} If predicate is not a function
|
|
52
|
+
*/
|
|
53
|
+
export declare const filterInPlace: <T>(set: Set<T>, predicate: (value: T) => boolean) => Set<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Adds all values from an iterable to the target set
|
|
56
|
+
* @remarks Mutates target set, duplicate values are ignored
|
|
57
|
+
* @param target - Set to modify
|
|
58
|
+
* @param other - Iterable containing values to add
|
|
59
|
+
* @returns The mutated target set
|
|
60
|
+
*/
|
|
61
|
+
export declare const unionInPlace: <T>(target: Set<T>, other: Iterable<T>) => Set<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Removes values from target that aren't present in the other iterable
|
|
64
|
+
* @remarks Mutates target set. For non-Set iterables, creates temporary Set.
|
|
65
|
+
* @param target - Set to modify
|
|
66
|
+
* @param other - Iterable containing allowed values
|
|
67
|
+
* @returns The mutated target set
|
|
68
|
+
*/
|
|
69
|
+
export declare const intersectInPlace: <T>(target: Set<T>, other: Iterable<T>) => Set<T>;
|
|
70
|
+
/**
|
|
71
|
+
* Removes values present in the other iterable from the target set
|
|
72
|
+
* @remarks Mutates target set. Values not in target are ignored.
|
|
73
|
+
* @param target - Set to modify
|
|
74
|
+
* @param other - Iterable containing values to remove
|
|
75
|
+
* @returns The mutated target set
|
|
76
|
+
*/
|
|
77
|
+
export declare const differenceInPlace: <T>(target: Set<T>, other: Iterable<T>) => Set<T>;
|
|
78
|
+
export declare const subtractInPlace: <T>(target: Set<T>, other: Iterable<T>) => Set<T>;
|
|
79
|
+
/**
|
|
80
|
+
* Tests if at least one value satisfies the predicate
|
|
81
|
+
* @remarks Short-circuits on first match. Empty sets return false.
|
|
82
|
+
* @param set - Set to test
|
|
83
|
+
* @param predicate - Test function
|
|
84
|
+
* @returns True if predicate returns true for any value
|
|
85
|
+
* @throws {TypeError} If predicate is not a function
|
|
86
|
+
*/
|
|
87
|
+
export declare const some: <T>(set: Set<T>, predicate: (value: T) => boolean) => boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Tests if all values satisfy the predicate
|
|
90
|
+
* @remarks Short-circuits on first failure. Empty sets return true.
|
|
91
|
+
* @param set - Set to test
|
|
92
|
+
* @param predicate - Test function
|
|
93
|
+
* @returns True if predicate returns true for all values
|
|
94
|
+
* @throws {TypeError} If predicate is not a function
|
|
95
|
+
*/
|
|
96
|
+
export declare const every: <T>(set: Set<T>, predicate: (value: T) => boolean) => boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Finds the first value that satisfies the predicate
|
|
99
|
+
* @remarks Iteration order follows set iteration order
|
|
100
|
+
* @param set - Set to search
|
|
101
|
+
* @param predicate - Test function
|
|
102
|
+
* @returns The first matching value, or undefined if none found
|
|
103
|
+
* @throws {TypeError} If predicate is not a function
|
|
104
|
+
*/
|
|
105
|
+
export declare const find: <T>(set: Set<T>, predicate: (value: T) => boolean) => T | undefined;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes whitespace or specified characters from both ends of a string
|
|
3
|
+
* @param str - String to trim
|
|
4
|
+
* @param chars - Characters to trim (defaults to whitespace). If provided, removes all characters in this string from both ends.
|
|
5
|
+
* @returns Trimmed string. Returns empty string if input is empty.
|
|
6
|
+
* @example
|
|
7
|
+
* trim(' hello ') // 'hello'
|
|
8
|
+
* trim('--hello--', '-') // 'hello'
|
|
9
|
+
* trim('', '-') // ''
|
|
10
|
+
*/
|
|
11
|
+
export declare const trim: (str: string, chars?: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Removes whitespace or specified characters from the start of a string
|
|
14
|
+
* @param str - String to trim
|
|
15
|
+
* @param chars - Characters to trim (defaults to whitespace). If provided, removes all characters in this string from the start.
|
|
16
|
+
* @returns Trimmed string. Returns empty string if input is empty.
|
|
17
|
+
* @example
|
|
18
|
+
* trimStart(' hello ') // 'hello '
|
|
19
|
+
* trimStart('--hello', '-') // 'hello'
|
|
20
|
+
*/
|
|
21
|
+
export declare const trimStart: (str: string, chars?: string) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Removes whitespace or specified characters from the end of a string
|
|
24
|
+
* @param str - String to trim
|
|
25
|
+
* @param chars - Characters to trim (defaults to whitespace). If provided, removes all characters in this string from the end.
|
|
26
|
+
* @returns Trimmed string. Returns empty string if input is empty.
|
|
27
|
+
* @example
|
|
28
|
+
* trimEnd(' hello ') // ' hello'
|
|
29
|
+
* trimEnd('hello--', '-') // 'hello'
|
|
30
|
+
*/
|
|
31
|
+
export declare const trimEnd: (str: string, chars?: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Pads a string on both sides with specified characters to reach given length
|
|
34
|
+
* @param str - String to pad
|
|
35
|
+
* @param length - Target length after padding. If str length >= length, returns original string.
|
|
36
|
+
* @param chars - Padding characters (defaults to space). If empty string, returns original string.
|
|
37
|
+
* @returns Padded string. Returns original string if padding not needed or chars empty.
|
|
38
|
+
* @throws If length is negative
|
|
39
|
+
* @example
|
|
40
|
+
* pad('hi', 5) // ' hi '
|
|
41
|
+
* pad('hi', 5, '-') // '--hi-'
|
|
42
|
+
* pad('hello', 3) // 'hello'
|
|
43
|
+
* pad('hi', 6, 'abc') // 'abhiab'
|
|
44
|
+
*/
|
|
45
|
+
export declare const pad: (str: string, length: number, chars?: string) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Removes diacritical marks (accents) from characters using Unicode normalization
|
|
48
|
+
* @param str - String to process
|
|
49
|
+
* @returns String with diacritical marks removed. Returns empty string if input is empty.
|
|
50
|
+
* @example
|
|
51
|
+
* deburr('dΓ©jΓ vu') // 'deja vu'
|
|
52
|
+
* deburr('') // ''
|
|
53
|
+
*/
|
|
54
|
+
export declare const deburr: (str: string) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Escapes special regex characters in a string
|
|
57
|
+
* @param str - String containing regex special characters
|
|
58
|
+
* @returns Escaped string safe for use in regex construction. Returns empty string if input is empty.
|
|
59
|
+
* @example
|
|
60
|
+
* escapeRegExp('[test].*') // '\\[test\\]\\.\\*'
|
|
61
|
+
*/
|
|
62
|
+
export declare const escapeRegExp: (str: string) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Escapes HTML special characters (&, <, >, ", ')
|
|
65
|
+
* @param str - String containing HTML
|
|
66
|
+
* @returns Escaped string with HTML entities. Returns empty string if input is empty.
|
|
67
|
+
* @example
|
|
68
|
+
* escape('<div>"test"</div>') // '<div>"test"</div>'
|
|
69
|
+
*/
|
|
70
|
+
export declare const escape: (str: string) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Unescapes HTML entities (&, <, >, ", ')
|
|
73
|
+
* @param str - String with HTML entities
|
|
74
|
+
* @returns Unescaped string. Returns empty string if input is empty.
|
|
75
|
+
* @example
|
|
76
|
+
* unescape('<div>') // '<div>'
|
|
77
|
+
*/
|
|
78
|
+
export declare const unescape: (str: string) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Reverses a string while preserving Unicode characters and emojis
|
|
81
|
+
* @param str - String to reverse
|
|
82
|
+
* @returns Reversed string. Returns empty string if input is empty.
|
|
83
|
+
* @example
|
|
84
|
+
* reverseString('hello') // 'olleh'
|
|
85
|
+
* reverseString('ππ') // 'ππ'
|
|
86
|
+
*/
|
|
87
|
+
export declare const reverseString: (str: string) => string;
|
|
88
|
+
/**
|
|
89
|
+
* Converts string to Start Case (capitalizes first letter of each word)
|
|
90
|
+
* @param str - String to convert
|
|
91
|
+
* @returns Start case string. Returns empty string if input contains no words.
|
|
92
|
+
* @remarks Handles alphanumeric boundaries (e.g., "test123" becomes "Test 123")
|
|
93
|
+
* @example
|
|
94
|
+
* startCase('hello world') // 'Hello World'
|
|
95
|
+
* startCase('hello-world') // 'Hello World'
|
|
96
|
+
* startCase('test123abc') // 'Test 123 Abc'
|
|
97
|
+
*/
|
|
98
|
+
export declare const startCase: (str: string) => string;
|
|
99
|
+
/**
|
|
100
|
+
* Converts string to camelCase
|
|
101
|
+
* @param str - String to convert
|
|
102
|
+
* @returns camelCase string. Returns empty string if input contains no words.
|
|
103
|
+
* @example
|
|
104
|
+
* camelCase('Hello World') // 'helloWorld'
|
|
105
|
+
* camelCase('hello-world') // 'helloWorld'
|
|
106
|
+
* camelCase('') // ''
|
|
107
|
+
*/
|
|
108
|
+
export declare const camelCase: (str: string) => string;
|
|
109
|
+
/**
|
|
110
|
+
* Capitalizes first character and lowercases the rest
|
|
111
|
+
* @param str - String to capitalize
|
|
112
|
+
* @returns Capitalized string. Returns empty string if input is empty.
|
|
113
|
+
* @example
|
|
114
|
+
* capitalize('hello') // 'Hello'
|
|
115
|
+
* capitalize('HELLO') // 'Hello'
|
|
116
|
+
*/
|
|
117
|
+
export declare const capitalize: (str: string) => string;
|
|
118
|
+
/**
|
|
119
|
+
* Converts string to CONSTANT_CASE (UPPERCASE_WITH_UNDERSCORES)
|
|
120
|
+
* @param str - String to convert
|
|
121
|
+
* @returns CONSTANT_CASE string. Returns empty string if input contains no words.
|
|
122
|
+
* @example
|
|
123
|
+
* constantCase('hello world') // 'HELLO_WORLD'
|
|
124
|
+
*/
|
|
125
|
+
export declare const constantCase: (str: string) => string;
|
|
126
|
+
/**
|
|
127
|
+
* Converts string to kebab-case (lowercase-with-hyphens)
|
|
128
|
+
* @param str - String to convert
|
|
129
|
+
* @returns kebab-case string. Returns empty string if input contains no words.
|
|
130
|
+
* @example
|
|
131
|
+
* kebabCase('Hello World') // 'hello-world'
|
|
132
|
+
*/
|
|
133
|
+
export declare const kebabCase: (str: string) => string;
|
|
134
|
+
/**
|
|
135
|
+
* Converts string to lowercase with spaces
|
|
136
|
+
* @param str - String to convert
|
|
137
|
+
* @returns Lowercase string with words separated by spaces. Returns empty string if input contains no words.
|
|
138
|
+
* @example
|
|
139
|
+
* lowerCase('HelloWorld') // 'hello world'
|
|
140
|
+
*/
|
|
141
|
+
export declare const lowerCase: (str: string) => string;
|
|
142
|
+
/**
|
|
143
|
+
* Converts first character to lowercase
|
|
144
|
+
* @param str - String to convert
|
|
145
|
+
* @returns String with first character lowercased. Returns empty string if input is empty.
|
|
146
|
+
* @example
|
|
147
|
+
* lowerFirst('Hello') // 'hello'
|
|
148
|
+
* lowerFirst('HELLO') // 'hELLO'
|
|
149
|
+
*/
|
|
150
|
+
export declare const lowerFirst: (str: string) => string;
|
|
151
|
+
/**
|
|
152
|
+
* Converts string to PascalCase (capitalizes first letter of each word)
|
|
153
|
+
* @param str - String to convert
|
|
154
|
+
* @returns PascalCase string. Returns empty string if input contains no words.
|
|
155
|
+
* @example
|
|
156
|
+
* pascalCase('hello world') // 'HelloWorld'
|
|
157
|
+
*/
|
|
158
|
+
export declare const pascalCase: (str: string) => string;
|
|
159
|
+
/**
|
|
160
|
+
* Converts string to snake_case (lowercase_with_underscores)
|
|
161
|
+
* @param str - String to convert
|
|
162
|
+
* @returns snake_case string. Returns empty string if input contains no words.
|
|
163
|
+
* @example
|
|
164
|
+
* snakeCase('Hello World') // 'hello_world'
|
|
165
|
+
*/
|
|
166
|
+
export declare const snakeCase: (str: string) => string;
|
|
167
|
+
/**
|
|
168
|
+
* Converts string to UPPERCASE WITH SPACES
|
|
169
|
+
* @param str - String to convert
|
|
170
|
+
* @returns Uppercase string with words separated by spaces. Returns empty string if input contains no words.
|
|
171
|
+
* @example
|
|
172
|
+
* upperCase('hello-world') // 'HELLO WORLD'
|
|
173
|
+
*/
|
|
174
|
+
export declare const upperCase: (str: string) => string;
|
|
175
|
+
/**
|
|
176
|
+
* Converts first character to uppercase
|
|
177
|
+
* @param str - String to convert
|
|
178
|
+
* @returns String with first character uppercased. Returns empty string if input is empty.
|
|
179
|
+
* @example
|
|
180
|
+
* upperFirst('hello') // 'Hello'
|
|
181
|
+
* upperFirst('hELLO') // 'HELLO'
|
|
182
|
+
*/
|
|
183
|
+
export declare const upperFirst: (str: string) => string;
|
|
184
|
+
/**
|
|
185
|
+
* Extracts words from string using Unicode-aware regex (supports all languages)
|
|
186
|
+
* @param str - String to extract words from
|
|
187
|
+
* @returns Array of words (Unicode letters and numbers). Returns empty array if no words found.
|
|
188
|
+
* @example
|
|
189
|
+
* words('Hello world!') // ['Hello', 'world']
|
|
190
|
+
* words('δ½ ε₯½οΌδΈηοΌ') // ['δ½ ε₯½', 'δΈη']
|
|
191
|
+
* words('123 abc') // ['123', 'abc']
|
|
192
|
+
*/
|
|
193
|
+
export declare const words: (str: string) => string[];
|
|
194
|
+
/**
|
|
195
|
+
* Generates a random string from the specified character set
|
|
196
|
+
* @param length - Length of the string to generate. Must be a non-negative integer.
|
|
197
|
+
* @param charset - Character set to use for generation. Defaults to alphanumeric (a-z, A-Z, 0-9).
|
|
198
|
+
* @returns Randomly generated string
|
|
199
|
+
* @throws ParameterError if length is negative or not an integer
|
|
200
|
+
* @example
|
|
201
|
+
* randomString(8) // 'aB3xK9pL'
|
|
202
|
+
* randomString(6, '0123456789') // '384729'
|
|
203
|
+
* randomString(10, 'abc') // 'abccabacba'
|
|
204
|
+
*/
|
|
205
|
+
export declare const randomString: (length: number, charset?: string) => string;
|
|
206
|
+
/**
|
|
207
|
+
* Replaces placeholders in template string with values from data object
|
|
208
|
+
* @template T - Type of data object
|
|
209
|
+
* @param str - Template string with {{placeholder}} syntax
|
|
210
|
+
* @param data - Object containing values to replace placeholders. Supports nested paths like {{user.name}}
|
|
211
|
+
* @returns String with placeholders replaced by corresponding values. Undefined values are replaced with empty string.
|
|
212
|
+
* @example
|
|
213
|
+
* template('Hello {{name}}!', {name: 'Alice'}) // 'Hello Alice!'
|
|
214
|
+
* template('Hello {{user.name}}!', {user: {name: 'Bob'}}) // 'Hello Bob!'
|
|
215
|
+
* template('Welcome to {{company}}!', {company: 'Tech Corp'}) // 'Welcome to Tech Corp!'
|
|
216
|
+
*/
|
|
217
|
+
export declare const template: <T extends Record<string, unknown>>(str: string, data: T) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as Arr from './Array/__export__';
|
|
2
|
+
export * from './Functions/__export__';
|
|
3
|
+
export * from './Object/__export__';
|
|
4
|
+
export * as Str from './String';
|
|
5
|
+
export * as Sets from './Set';
|
|
6
|
+
export * as Maps from './Map';
|
|
7
|
+
export * from './Math';
|
|
8
|
+
export * from './Predicates';
|
|
9
|
+
export type * from './type-tool';
|