typetify 2.2.0 → 4.0.1

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 (73) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +123 -1
  3. package/dist/chunk-2YRFWQ6M.mjs +1 -0
  4. package/dist/chunk-35CB7HNN.js +1 -0
  5. package/dist/chunk-6WGRWYAD.js +1 -0
  6. package/dist/chunk-7UMXGQE4.mjs +1 -0
  7. package/dist/chunk-7XHBEA63.js +1 -0
  8. package/dist/chunk-BLUG7TSP.js +1 -0
  9. package/dist/chunk-C5X2N4X4.js +2 -0
  10. package/dist/chunk-CX7GJR55.js +1 -0
  11. package/dist/chunk-F76ECQKE.js +1 -0
  12. package/dist/chunk-FHCBXSNA.js +1 -0
  13. package/dist/chunk-GQIJLGEZ.mjs +1 -0
  14. package/dist/chunk-H7MLD632.mjs +2 -0
  15. package/dist/chunk-MB77QAOC.mjs +1 -0
  16. package/dist/chunk-MCQFAXUX.mjs +1 -0
  17. package/dist/chunk-RCSO5S56.js +2 -0
  18. package/dist/chunk-U6XM3X5N.mjs +2 -0
  19. package/dist/chunk-U7MK5AR5.mjs +1 -0
  20. package/dist/chunk-WWU7P2L2.mjs +1 -0
  21. package/dist/chunk-X6JSYVIW.mjs +1 -0
  22. package/dist/chunk-XKTDG6LH.js +1 -0
  23. package/dist/collection/index.d.mts +125 -1
  24. package/dist/collection/index.d.ts +125 -1
  25. package/dist/collection/index.js +1 -1
  26. package/dist/collection/index.mjs +1 -1
  27. package/dist/color/index.d.mts +274 -0
  28. package/dist/color/index.d.ts +274 -0
  29. package/dist/color/index.js +1 -0
  30. package/dist/color/index.mjs +1 -0
  31. package/dist/datetime/index.d.mts +320 -0
  32. package/dist/datetime/index.d.ts +320 -0
  33. package/dist/datetime/index.js +1 -0
  34. package/dist/datetime/index.mjs +1 -0
  35. package/dist/dom/index.d.mts +353 -0
  36. package/dist/dom/index.d.ts +353 -0
  37. package/dist/dom/index.js +1 -0
  38. package/dist/dom/index.mjs +1 -0
  39. package/dist/encrypt/index.d.mts +208 -0
  40. package/dist/encrypt/index.d.ts +208 -0
  41. package/dist/encrypt/index.js +1 -0
  42. package/dist/encrypt/index.mjs +1 -0
  43. package/dist/http/index.d.mts +301 -0
  44. package/dist/http/index.d.ts +301 -0
  45. package/dist/http/index.js +1 -0
  46. package/dist/http/index.mjs +1 -0
  47. package/dist/index.d.mts +591 -413
  48. package/dist/index.d.ts +591 -413
  49. package/dist/index.js +2 -2
  50. package/dist/index.mjs +2 -2
  51. package/dist/object/index.d.mts +137 -1
  52. package/dist/object/index.d.ts +137 -1
  53. package/dist/object/index.js +1 -1
  54. package/dist/object/index.mjs +1 -1
  55. package/dist/path/index.d.mts +178 -0
  56. package/dist/path/index.d.ts +178 -0
  57. package/dist/path/index.js +1 -0
  58. package/dist/path/index.mjs +1 -0
  59. package/dist/storage/index.d.mts +197 -0
  60. package/dist/storage/index.d.ts +197 -0
  61. package/dist/storage/index.js +1 -0
  62. package/dist/storage/index.mjs +1 -0
  63. package/dist/string/index.d.mts +201 -1
  64. package/dist/string/index.d.ts +201 -1
  65. package/dist/string/index.js +1 -1
  66. package/dist/string/index.mjs +1 -1
  67. package/package.json +36 -1
  68. package/dist/chunk-4HQERWI6.mjs +0 -1
  69. package/dist/chunk-5LWNMYHB.js +0 -1
  70. package/dist/chunk-7V3EDYJD.mjs +0 -1
  71. package/dist/chunk-FYQNKDT3.mjs +0 -1
  72. package/dist/chunk-MSOFO6QN.js +0 -1
  73. package/dist/chunk-WQPSXQT5.js +0 -1
@@ -324,4 +324,140 @@ declare function deepPath<T extends object>(): <P extends string & Paths<T>>(pat
324
324
  */
325
325
  declare function deepPluck<T extends object, P extends string & Paths<T>>(array: readonly T[], path: P): PathValue<T, P>[];
326
326
 
327
- export { type PathValue, type Paths, clone, cloneDeep, deepGet, deepGetOr, deepHas, deepMerge, deepPath, deepPluck, deepSet, entriesTyped, filterObject, fromEntriesTyped, get, has, invert, isEqual, keysTyped, mapObject, mergeShallow, omit, paths, pick, set, transform, unset, valuesTyped };
327
+ /**
328
+ * Finds the first key in an object where the predicate returns true.
329
+ *
330
+ * @example
331
+ * // Find key by value
332
+ * const users = { john: 32, jane: 28, bob: 45 }
333
+ * findKey(users, age => age > 30)
334
+ * // => 'john'
335
+ *
336
+ * @example
337
+ * // Find user ID by property
338
+ * const usersById = {
339
+ * u1: { name: 'Alice', role: 'admin' },
340
+ * u2: { name: 'Bob', role: 'user' },
341
+ * u3: { name: 'Charlie', role: 'admin' }
342
+ * }
343
+ * findKey(usersById, user => user.role === 'admin')
344
+ * // => 'u1'
345
+ *
346
+ * @example
347
+ * // Find first matching config key
348
+ * const config = {
349
+ * dev: { port: 3000, debug: true },
350
+ * staging: { port: 8080, debug: true },
351
+ * prod: { port: 80, debug: false }
352
+ * }
353
+ * findKey(config, env => env.debug === false)
354
+ * // => 'prod'
355
+ *
356
+ * @example
357
+ * // Returns undefined if not found
358
+ * findKey({ a: 1, b: 2 }, v => v > 10)
359
+ * // => undefined
360
+ */
361
+ declare function findKey<T extends Record<string, unknown>>(obj: T, predicate: (value: T[keyof T], key: keyof T, obj: T) => boolean): keyof T | undefined;
362
+ /**
363
+ * Finds the last key in an object where the predicate returns true.
364
+ *
365
+ * @example
366
+ * // Find last matching key
367
+ * const scores = { alice: 85, bob: 92, charlie: 88, diana: 95 }
368
+ * findLastKey(scores, score => score > 90)
369
+ * // => 'diana'
370
+ *
371
+ * @example
372
+ * // Find last admin user
373
+ * const usersById = {
374
+ * u1: { name: 'Alice', role: 'admin' },
375
+ * u2: { name: 'Bob', role: 'user' },
376
+ * u3: { name: 'Charlie', role: 'admin' }
377
+ * }
378
+ * findLastKey(usersById, user => user.role === 'admin')
379
+ * // => 'u3'
380
+ */
381
+ declare function findLastKey<T extends Record<string, unknown>>(obj: T, predicate: (value: T[keyof T], key: keyof T, obj: T) => boolean): keyof T | undefined;
382
+
383
+ /**
384
+ * Gets values at multiple paths from an object.
385
+ * Returns an array of values in the same order as the paths.
386
+ *
387
+ * @example
388
+ * // Get multiple properties
389
+ * const user = { name: 'John', age: 30, email: 'john@example.com' }
390
+ * at(user, ['name', 'email'])
391
+ * // => ['John', 'john@example.com']
392
+ *
393
+ * @example
394
+ * // Get nested properties
395
+ * const data = {
396
+ * user: { name: 'Alice', profile: { avatar: 'alice.png' } },
397
+ * settings: { theme: 'dark' }
398
+ * }
399
+ * at(data, ['user.name', 'user.profile.avatar', 'settings.theme'])
400
+ * // => ['Alice', 'alice.png', 'dark']
401
+ *
402
+ * @example
403
+ * // Missing paths return undefined
404
+ * const obj = { a: 1, b: 2 }
405
+ * at(obj, ['a', 'c', 'b'])
406
+ * // => [1, undefined, 2]
407
+ *
408
+ * @example
409
+ * // Extract specific fields for display
410
+ * const product = {
411
+ * id: 'p123',
412
+ * name: 'Widget',
413
+ * price: 29.99,
414
+ * stock: 150,
415
+ * category: { name: 'Electronics' }
416
+ * }
417
+ * at(product, ['name', 'price', 'category.name'])
418
+ * // => ['Widget', 29.99, 'Electronics']
419
+ *
420
+ * @example
421
+ * // Use with array destructuring
422
+ * const config = { host: 'localhost', port: 3000, ssl: true }
423
+ * const [host, port] = at(config, ['host', 'port'])
424
+ * // host = 'localhost', port = 3000
425
+ */
426
+ declare function at<T extends Record<string, unknown>>(obj: T, paths: readonly string[]): unknown[];
427
+
428
+ /**
429
+ * Inverts the keys and values of an object, grouping keys by their values.
430
+ * Unlike invert(), this handles duplicate values by creating arrays.
431
+ *
432
+ * @example
433
+ * // Group by value
434
+ * const roles = { alice: 'admin', bob: 'user', charlie: 'admin' }
435
+ * invertBy(roles)
436
+ * // => { admin: ['alice', 'charlie'], user: ['bob'] }
437
+ *
438
+ * @example
439
+ * // Group users by age
440
+ * const ages = { john: 30, jane: 25, bob: 30, alice: 25 }
441
+ * invertBy(ages)
442
+ * // => { '25': ['jane', 'alice'], '30': ['john', 'bob'] }
443
+ *
444
+ * @example
445
+ * // With custom iteratee
446
+ * const scores = { alice: 85, bob: 92, charlie: 78, diana: 95 }
447
+ * invertBy(scores, score => score >= 90 ? 'A' : score >= 80 ? 'B' : 'C')
448
+ * // => { B: ['alice'], A: ['bob', 'diana'], C: ['charlie'] }
449
+ *
450
+ * @example
451
+ * // Group products by category
452
+ * const products = {
453
+ * widget: 'electronics',
454
+ * gadget: 'electronics',
455
+ * chair: 'furniture',
456
+ * desk: 'furniture'
457
+ * }
458
+ * invertBy(products)
459
+ * // => { electronics: ['widget', 'gadget'], furniture: ['chair', 'desk'] }
460
+ */
461
+ declare function invertBy<T extends Record<string, unknown>>(obj: T, iteratee?: (value: T[keyof T]) => PropertyKey): Record<PropertyKey, string[]>;
462
+
463
+ export { type PathValue, type Paths, at, clone, cloneDeep, deepGet, deepGetOr, deepHas, deepMerge, deepPath, deepPluck, deepSet, entriesTyped, filterObject, findKey, findLastKey, fromEntriesTyped, get, has, invert, invertBy, isEqual, keysTyped, mapObject, mergeShallow, omit, paths, pick, set, transform, unset, valuesTyped };
@@ -1 +1 @@
1
- 'use strict';var chunkMSOFO6QN_js=require('../chunk-MSOFO6QN.js');require('../chunk-WOT6VMZA.js');Object.defineProperty(exports,"clone",{enumerable:true,get:function(){return chunkMSOFO6QN_js.j}});Object.defineProperty(exports,"cloneDeep",{enumerable:true,get:function(){return chunkMSOFO6QN_js.k}});Object.defineProperty(exports,"deepGet",{enumerable:true,get:function(){return chunkMSOFO6QN_js.u}});Object.defineProperty(exports,"deepGetOr",{enumerable:true,get:function(){return chunkMSOFO6QN_js.v}});Object.defineProperty(exports,"deepHas",{enumerable:true,get:function(){return chunkMSOFO6QN_js.x}});Object.defineProperty(exports,"deepMerge",{enumerable:true,get:function(){return chunkMSOFO6QN_js.o}});Object.defineProperty(exports,"deepPath",{enumerable:true,get:function(){return chunkMSOFO6QN_js.y}});Object.defineProperty(exports,"deepPluck",{enumerable:true,get:function(){return chunkMSOFO6QN_js.z}});Object.defineProperty(exports,"deepSet",{enumerable:true,get:function(){return chunkMSOFO6QN_js.w}});Object.defineProperty(exports,"entriesTyped",{enumerable:true,get:function(){return chunkMSOFO6QN_js.e}});Object.defineProperty(exports,"filterObject",{enumerable:true,get:function(){return chunkMSOFO6QN_js.h}});Object.defineProperty(exports,"fromEntriesTyped",{enumerable:true,get:function(){return chunkMSOFO6QN_js.f}});Object.defineProperty(exports,"get",{enumerable:true,get:function(){return chunkMSOFO6QN_js.l}});Object.defineProperty(exports,"has",{enumerable:true,get:function(){return chunkMSOFO6QN_js.q}});Object.defineProperty(exports,"invert",{enumerable:true,get:function(){return chunkMSOFO6QN_js.n}});Object.defineProperty(exports,"isEqual",{enumerable:true,get:function(){return chunkMSOFO6QN_js.p}});Object.defineProperty(exports,"keysTyped",{enumerable:true,get:function(){return chunkMSOFO6QN_js.c}});Object.defineProperty(exports,"mapObject",{enumerable:true,get:function(){return chunkMSOFO6QN_js.g}});Object.defineProperty(exports,"mergeShallow",{enumerable:true,get:function(){return chunkMSOFO6QN_js.i}});Object.defineProperty(exports,"omit",{enumerable:true,get:function(){return chunkMSOFO6QN_js.b}});Object.defineProperty(exports,"paths",{enumerable:true,get:function(){return chunkMSOFO6QN_js.s}});Object.defineProperty(exports,"pick",{enumerable:true,get:function(){return chunkMSOFO6QN_js.a}});Object.defineProperty(exports,"set",{enumerable:true,get:function(){return chunkMSOFO6QN_js.m}});Object.defineProperty(exports,"transform",{enumerable:true,get:function(){return chunkMSOFO6QN_js.t}});Object.defineProperty(exports,"unset",{enumerable:true,get:function(){return chunkMSOFO6QN_js.r}});Object.defineProperty(exports,"valuesTyped",{enumerable:true,get:function(){return chunkMSOFO6QN_js.d}});
1
+ 'use strict';var chunkFHCBXSNA_js=require('../chunk-FHCBXSNA.js');require('../chunk-WOT6VMZA.js');Object.defineProperty(exports,"at",{enumerable:true,get:function(){return chunkFHCBXSNA_js.C}});Object.defineProperty(exports,"clone",{enumerable:true,get:function(){return chunkFHCBXSNA_js.j}});Object.defineProperty(exports,"cloneDeep",{enumerable:true,get:function(){return chunkFHCBXSNA_js.k}});Object.defineProperty(exports,"deepGet",{enumerable:true,get:function(){return chunkFHCBXSNA_js.u}});Object.defineProperty(exports,"deepGetOr",{enumerable:true,get:function(){return chunkFHCBXSNA_js.v}});Object.defineProperty(exports,"deepHas",{enumerable:true,get:function(){return chunkFHCBXSNA_js.x}});Object.defineProperty(exports,"deepMerge",{enumerable:true,get:function(){return chunkFHCBXSNA_js.o}});Object.defineProperty(exports,"deepPath",{enumerable:true,get:function(){return chunkFHCBXSNA_js.y}});Object.defineProperty(exports,"deepPluck",{enumerable:true,get:function(){return chunkFHCBXSNA_js.z}});Object.defineProperty(exports,"deepSet",{enumerable:true,get:function(){return chunkFHCBXSNA_js.w}});Object.defineProperty(exports,"entriesTyped",{enumerable:true,get:function(){return chunkFHCBXSNA_js.e}});Object.defineProperty(exports,"filterObject",{enumerable:true,get:function(){return chunkFHCBXSNA_js.h}});Object.defineProperty(exports,"findKey",{enumerable:true,get:function(){return chunkFHCBXSNA_js.A}});Object.defineProperty(exports,"findLastKey",{enumerable:true,get:function(){return chunkFHCBXSNA_js.B}});Object.defineProperty(exports,"fromEntriesTyped",{enumerable:true,get:function(){return chunkFHCBXSNA_js.f}});Object.defineProperty(exports,"get",{enumerable:true,get:function(){return chunkFHCBXSNA_js.l}});Object.defineProperty(exports,"has",{enumerable:true,get:function(){return chunkFHCBXSNA_js.q}});Object.defineProperty(exports,"invert",{enumerable:true,get:function(){return chunkFHCBXSNA_js.n}});Object.defineProperty(exports,"invertBy",{enumerable:true,get:function(){return chunkFHCBXSNA_js.D}});Object.defineProperty(exports,"isEqual",{enumerable:true,get:function(){return chunkFHCBXSNA_js.p}});Object.defineProperty(exports,"keysTyped",{enumerable:true,get:function(){return chunkFHCBXSNA_js.c}});Object.defineProperty(exports,"mapObject",{enumerable:true,get:function(){return chunkFHCBXSNA_js.g}});Object.defineProperty(exports,"mergeShallow",{enumerable:true,get:function(){return chunkFHCBXSNA_js.i}});Object.defineProperty(exports,"omit",{enumerable:true,get:function(){return chunkFHCBXSNA_js.b}});Object.defineProperty(exports,"paths",{enumerable:true,get:function(){return chunkFHCBXSNA_js.s}});Object.defineProperty(exports,"pick",{enumerable:true,get:function(){return chunkFHCBXSNA_js.a}});Object.defineProperty(exports,"set",{enumerable:true,get:function(){return chunkFHCBXSNA_js.m}});Object.defineProperty(exports,"transform",{enumerable:true,get:function(){return chunkFHCBXSNA_js.t}});Object.defineProperty(exports,"unset",{enumerable:true,get:function(){return chunkFHCBXSNA_js.r}});Object.defineProperty(exports,"valuesTyped",{enumerable:true,get:function(){return chunkFHCBXSNA_js.d}});
@@ -1 +1 @@
1
- export{j as clone,k as cloneDeep,u as deepGet,v as deepGetOr,x as deepHas,o as deepMerge,y as deepPath,z as deepPluck,w as deepSet,e as entriesTyped,h as filterObject,f as fromEntriesTyped,l as get,q as has,n as invert,p as isEqual,c as keysTyped,g as mapObject,i as mergeShallow,b as omit,s as paths,a as pick,m as set,t as transform,r as unset,d as valuesTyped}from'../chunk-7V3EDYJD.mjs';import'../chunk-JZXLCA2E.mjs';
1
+ export{C as at,j as clone,k as cloneDeep,u as deepGet,v as deepGetOr,x as deepHas,o as deepMerge,y as deepPath,z as deepPluck,w as deepSet,e as entriesTyped,h as filterObject,A as findKey,B as findLastKey,f as fromEntriesTyped,l as get,q as has,n as invert,D as invertBy,p as isEqual,c as keysTyped,g as mapObject,i as mergeShallow,b as omit,s as paths,a as pick,m as set,t as transform,r as unset,d as valuesTyped}from'../chunk-U7MK5AR5.mjs';import'../chunk-JZXLCA2E.mjs';
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Parsed path components.
3
+ */
4
+ interface ParsedPath {
5
+ root: string;
6
+ dir: string;
7
+ base: string;
8
+ ext: string;
9
+ name: string;
10
+ }
11
+ /**
12
+ * Parses a path into its components.
13
+ *
14
+ * @example
15
+ * parsePath('/home/user/file.txt');
16
+ * // => { root: '/', dir: '/home/user', base: 'file.txt', ext: '.txt', name: 'file' }
17
+ *
18
+ * @example
19
+ * parsePath('C:\\Users\\file.txt');
20
+ * // => { root: 'C:\\', dir: 'C:\\Users', base: 'file.txt', ext: '.txt', name: 'file' }
21
+ */
22
+ declare function parsePath(path: string): ParsedPath;
23
+ /**
24
+ * Gets the directory name of a path.
25
+ *
26
+ * @example
27
+ * dirname('/home/user/file.txt');
28
+ * // => '/home/user'
29
+ *
30
+ * @example
31
+ * dirname('file.txt');
32
+ * // => '.'
33
+ */
34
+ declare function dirname(path: string): string;
35
+ /**
36
+ * Gets the base name of a path.
37
+ *
38
+ * @example
39
+ * basename('/home/user/file.txt');
40
+ * // => 'file.txt'
41
+ *
42
+ * @example
43
+ * basename('/home/user/file.txt', '.txt');
44
+ * // => 'file'
45
+ */
46
+ declare function basename(path: string, ext?: string): string;
47
+ /**
48
+ * Gets the extension of a path.
49
+ *
50
+ * @example
51
+ * extname('/home/user/file.txt');
52
+ * // => '.txt'
53
+ *
54
+ * @example
55
+ * extname('file');
56
+ * // => ''
57
+ */
58
+ declare function extname(path: string): string;
59
+
60
+ /**
61
+ * Joins path segments together.
62
+ *
63
+ * @example
64
+ * joinPath('/home', 'user', 'file.txt');
65
+ * // => '/home/user/file.txt'
66
+ *
67
+ * @example
68
+ * joinPath('api', 'v1', 'users');
69
+ * // => 'api/v1/users'
70
+ *
71
+ * @example
72
+ * joinPath('/home/', '/user/', '/file.txt');
73
+ * // => '/home/user/file.txt'
74
+ */
75
+ declare function joinPath(...segments: string[]): string;
76
+ /**
77
+ * Resolves a sequence of paths to an absolute path.
78
+ *
79
+ * @example
80
+ * resolvePath('/home/user', '../admin', 'file.txt');
81
+ * // => '/home/admin/file.txt'
82
+ *
83
+ * @example
84
+ * resolvePath('src', '..', 'dist', 'index.js');
85
+ * // => '/current/working/dir/dist/index.js' (relative to cwd)
86
+ */
87
+ declare function resolvePath(...segments: string[]): string;
88
+ /**
89
+ * Gets the relative path from one path to another.
90
+ *
91
+ * @example
92
+ * relativePath('/home/user/docs', '/home/user/images');
93
+ * // => '../images'
94
+ *
95
+ * @example
96
+ * relativePath('/home/user', '/home/user/docs/file.txt');
97
+ * // => 'docs/file.txt'
98
+ */
99
+ declare function relativePath(from: string, to: string): string;
100
+
101
+ /**
102
+ * Normalizes a path, resolving '..' and '.' segments.
103
+ *
104
+ * @example
105
+ * normalizePath('/home/user/../admin/./file.txt');
106
+ * // => '/home/admin/file.txt'
107
+ *
108
+ * @example
109
+ * normalizePath('src/../dist/./index.js');
110
+ * // => 'dist/index.js'
111
+ */
112
+ declare function normalizePath(path: string): string;
113
+ /**
114
+ * Checks if a path is absolute.
115
+ *
116
+ * @example
117
+ * isAbsolute('/home/user');
118
+ * // => true
119
+ *
120
+ * @example
121
+ * isAbsolute('C:\\Users');
122
+ * // => true
123
+ *
124
+ * @example
125
+ * isAbsolute('src/file.txt');
126
+ * // => false
127
+ */
128
+ declare function isAbsolute(path: string): boolean;
129
+ /**
130
+ * Converts a path to POSIX format (forward slashes).
131
+ *
132
+ * @example
133
+ * toPosix('C:\\Users\\file.txt');
134
+ * // => 'C:/Users/file.txt'
135
+ */
136
+ declare function toPosix(path: string): string;
137
+ /**
138
+ * Converts a path to Windows format (backslashes).
139
+ *
140
+ * @example
141
+ * toWindows('/home/user/file.txt');
142
+ * // => '\\home\\user\\file.txt'
143
+ */
144
+ declare function toWindows(path: string): string;
145
+ /**
146
+ * Removes trailing slashes from a path.
147
+ *
148
+ * @example
149
+ * removeTrailingSlash('/home/user/');
150
+ * // => '/home/user'
151
+ *
152
+ * @example
153
+ * removeTrailingSlash('/');
154
+ * // => '/'
155
+ */
156
+ declare function removeTrailingSlash(path: string): string;
157
+ /**
158
+ * Ensures a path has a trailing slash.
159
+ *
160
+ * @example
161
+ * ensureTrailingSlash('/home/user');
162
+ * // => '/home/user/'
163
+ */
164
+ declare function ensureTrailingSlash(path: string): string;
165
+ /**
166
+ * Gets the common base path of multiple paths.
167
+ *
168
+ * @example
169
+ * commonPath(['/home/user/docs', '/home/user/images', '/home/user/videos']);
170
+ * // => '/home/user'
171
+ *
172
+ * @example
173
+ * commonPath(['src/utils/a.ts', 'src/utils/b.ts', 'src/helpers/c.ts']);
174
+ * // => 'src'
175
+ */
176
+ declare function commonPath(paths: string[]): string;
177
+
178
+ export { type ParsedPath, basename, commonPath, dirname, ensureTrailingSlash, extname, isAbsolute, joinPath, normalizePath, parsePath, relativePath, removeTrailingSlash, resolvePath, toPosix, toWindows };
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Parsed path components.
3
+ */
4
+ interface ParsedPath {
5
+ root: string;
6
+ dir: string;
7
+ base: string;
8
+ ext: string;
9
+ name: string;
10
+ }
11
+ /**
12
+ * Parses a path into its components.
13
+ *
14
+ * @example
15
+ * parsePath('/home/user/file.txt');
16
+ * // => { root: '/', dir: '/home/user', base: 'file.txt', ext: '.txt', name: 'file' }
17
+ *
18
+ * @example
19
+ * parsePath('C:\\Users\\file.txt');
20
+ * // => { root: 'C:\\', dir: 'C:\\Users', base: 'file.txt', ext: '.txt', name: 'file' }
21
+ */
22
+ declare function parsePath(path: string): ParsedPath;
23
+ /**
24
+ * Gets the directory name of a path.
25
+ *
26
+ * @example
27
+ * dirname('/home/user/file.txt');
28
+ * // => '/home/user'
29
+ *
30
+ * @example
31
+ * dirname('file.txt');
32
+ * // => '.'
33
+ */
34
+ declare function dirname(path: string): string;
35
+ /**
36
+ * Gets the base name of a path.
37
+ *
38
+ * @example
39
+ * basename('/home/user/file.txt');
40
+ * // => 'file.txt'
41
+ *
42
+ * @example
43
+ * basename('/home/user/file.txt', '.txt');
44
+ * // => 'file'
45
+ */
46
+ declare function basename(path: string, ext?: string): string;
47
+ /**
48
+ * Gets the extension of a path.
49
+ *
50
+ * @example
51
+ * extname('/home/user/file.txt');
52
+ * // => '.txt'
53
+ *
54
+ * @example
55
+ * extname('file');
56
+ * // => ''
57
+ */
58
+ declare function extname(path: string): string;
59
+
60
+ /**
61
+ * Joins path segments together.
62
+ *
63
+ * @example
64
+ * joinPath('/home', 'user', 'file.txt');
65
+ * // => '/home/user/file.txt'
66
+ *
67
+ * @example
68
+ * joinPath('api', 'v1', 'users');
69
+ * // => 'api/v1/users'
70
+ *
71
+ * @example
72
+ * joinPath('/home/', '/user/', '/file.txt');
73
+ * // => '/home/user/file.txt'
74
+ */
75
+ declare function joinPath(...segments: string[]): string;
76
+ /**
77
+ * Resolves a sequence of paths to an absolute path.
78
+ *
79
+ * @example
80
+ * resolvePath('/home/user', '../admin', 'file.txt');
81
+ * // => '/home/admin/file.txt'
82
+ *
83
+ * @example
84
+ * resolvePath('src', '..', 'dist', 'index.js');
85
+ * // => '/current/working/dir/dist/index.js' (relative to cwd)
86
+ */
87
+ declare function resolvePath(...segments: string[]): string;
88
+ /**
89
+ * Gets the relative path from one path to another.
90
+ *
91
+ * @example
92
+ * relativePath('/home/user/docs', '/home/user/images');
93
+ * // => '../images'
94
+ *
95
+ * @example
96
+ * relativePath('/home/user', '/home/user/docs/file.txt');
97
+ * // => 'docs/file.txt'
98
+ */
99
+ declare function relativePath(from: string, to: string): string;
100
+
101
+ /**
102
+ * Normalizes a path, resolving '..' and '.' segments.
103
+ *
104
+ * @example
105
+ * normalizePath('/home/user/../admin/./file.txt');
106
+ * // => '/home/admin/file.txt'
107
+ *
108
+ * @example
109
+ * normalizePath('src/../dist/./index.js');
110
+ * // => 'dist/index.js'
111
+ */
112
+ declare function normalizePath(path: string): string;
113
+ /**
114
+ * Checks if a path is absolute.
115
+ *
116
+ * @example
117
+ * isAbsolute('/home/user');
118
+ * // => true
119
+ *
120
+ * @example
121
+ * isAbsolute('C:\\Users');
122
+ * // => true
123
+ *
124
+ * @example
125
+ * isAbsolute('src/file.txt');
126
+ * // => false
127
+ */
128
+ declare function isAbsolute(path: string): boolean;
129
+ /**
130
+ * Converts a path to POSIX format (forward slashes).
131
+ *
132
+ * @example
133
+ * toPosix('C:\\Users\\file.txt');
134
+ * // => 'C:/Users/file.txt'
135
+ */
136
+ declare function toPosix(path: string): string;
137
+ /**
138
+ * Converts a path to Windows format (backslashes).
139
+ *
140
+ * @example
141
+ * toWindows('/home/user/file.txt');
142
+ * // => '\\home\\user\\file.txt'
143
+ */
144
+ declare function toWindows(path: string): string;
145
+ /**
146
+ * Removes trailing slashes from a path.
147
+ *
148
+ * @example
149
+ * removeTrailingSlash('/home/user/');
150
+ * // => '/home/user'
151
+ *
152
+ * @example
153
+ * removeTrailingSlash('/');
154
+ * // => '/'
155
+ */
156
+ declare function removeTrailingSlash(path: string): string;
157
+ /**
158
+ * Ensures a path has a trailing slash.
159
+ *
160
+ * @example
161
+ * ensureTrailingSlash('/home/user');
162
+ * // => '/home/user/'
163
+ */
164
+ declare function ensureTrailingSlash(path: string): string;
165
+ /**
166
+ * Gets the common base path of multiple paths.
167
+ *
168
+ * @example
169
+ * commonPath(['/home/user/docs', '/home/user/images', '/home/user/videos']);
170
+ * // => '/home/user'
171
+ *
172
+ * @example
173
+ * commonPath(['src/utils/a.ts', 'src/utils/b.ts', 'src/helpers/c.ts']);
174
+ * // => 'src'
175
+ */
176
+ declare function commonPath(paths: string[]): string;
177
+
178
+ export { type ParsedPath, basename, commonPath, dirname, ensureTrailingSlash, extname, isAbsolute, joinPath, normalizePath, parsePath, relativePath, removeTrailingSlash, resolvePath, toPosix, toWindows };
@@ -0,0 +1 @@
1
+ 'use strict';var chunkC5X2N4X4_js=require('../chunk-C5X2N4X4.js');require('../chunk-WOT6VMZA.js');Object.defineProperty(exports,"basename",{enumerable:true,get:function(){return chunkC5X2N4X4_js.c}});Object.defineProperty(exports,"commonPath",{enumerable:true,get:function(){return chunkC5X2N4X4_js.n}});Object.defineProperty(exports,"dirname",{enumerable:true,get:function(){return chunkC5X2N4X4_js.b}});Object.defineProperty(exports,"ensureTrailingSlash",{enumerable:true,get:function(){return chunkC5X2N4X4_js.m}});Object.defineProperty(exports,"extname",{enumerable:true,get:function(){return chunkC5X2N4X4_js.d}});Object.defineProperty(exports,"isAbsolute",{enumerable:true,get:function(){return chunkC5X2N4X4_js.i}});Object.defineProperty(exports,"joinPath",{enumerable:true,get:function(){return chunkC5X2N4X4_js.e}});Object.defineProperty(exports,"normalizePath",{enumerable:true,get:function(){return chunkC5X2N4X4_js.h}});Object.defineProperty(exports,"parsePath",{enumerable:true,get:function(){return chunkC5X2N4X4_js.a}});Object.defineProperty(exports,"relativePath",{enumerable:true,get:function(){return chunkC5X2N4X4_js.g}});Object.defineProperty(exports,"removeTrailingSlash",{enumerable:true,get:function(){return chunkC5X2N4X4_js.l}});Object.defineProperty(exports,"resolvePath",{enumerable:true,get:function(){return chunkC5X2N4X4_js.f}});Object.defineProperty(exports,"toPosix",{enumerable:true,get:function(){return chunkC5X2N4X4_js.j}});Object.defineProperty(exports,"toWindows",{enumerable:true,get:function(){return chunkC5X2N4X4_js.k}});
@@ -0,0 +1 @@
1
+ export{c as basename,n as commonPath,b as dirname,m as ensureTrailingSlash,d as extname,i as isAbsolute,e as joinPath,h as normalizePath,a as parsePath,g as relativePath,l as removeTrailingSlash,f as resolvePath,j as toPosix,k as toWindows}from'../chunk-H7MLD632.mjs';import'../chunk-JZXLCA2E.mjs';