xenopomp-essentials 0.0.1-beta.0 → 0.0.1-beta.2
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.
|
@@ -339,4 +339,79 @@ type MergeTypes<TypesArray extends any[], Res = EmptyObject> = TypesArray extend
|
|
|
339
339
|
*/
|
|
340
340
|
type WeakOmit<Obj extends AnyObject, Keys extends keyof Obj | undefined = undefined> = Keys extends keyof Obj ? Omit<Obj, Keys> : Obj;
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
/**
|
|
343
|
+
* Makes types don`t merging in unions.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* type Languages = 'TypeScript' | 'JavaScript' | Lenient<string>;
|
|
347
|
+
* // ^? "TypeScript" | "JavaScript" | string
|
|
348
|
+
*/
|
|
349
|
+
type Lenient<T> = T & {};
|
|
350
|
+
/**
|
|
351
|
+
* This type allows any string, but also saves compiler`s autocomplete
|
|
352
|
+
* feature.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* type Languages = 'TypeScript' | 'JavaScript';
|
|
356
|
+
*
|
|
357
|
+
* function handleLanguage(lang: LenientAutocomplete<Languages>) {
|
|
358
|
+
* // ^? string (but autocomplete feature is still here)
|
|
359
|
+
* console.log(lang);
|
|
360
|
+
* }
|
|
361
|
+
*/
|
|
362
|
+
type LenientAutocomplete<T extends string> = T | Lenient<string>;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Creates pipelines of functions that will be executed only
|
|
366
|
+
* when you will call whole pipeline.
|
|
367
|
+
*
|
|
368
|
+
* @param fn
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* const stringToDateAndTime = pipe(Date.parse)
|
|
372
|
+
* .pipe(n => new Date(n))
|
|
373
|
+
* .pipe(d => d.toDateString())
|
|
374
|
+
* .pipe(s => s.split('T'))
|
|
375
|
+
* .pipe(([date, time]) => ({ date, time }));
|
|
376
|
+
*
|
|
377
|
+
* const res = stringToDateAndTime('Jan 1, 2024');
|
|
378
|
+
* // ^? { date: string | undefined; time: string | undefined }
|
|
379
|
+
*
|
|
380
|
+
* @see https://youtu.be/bH61wRMqp-o?si=D-2Az-_dUFBxG9HG&t=429
|
|
381
|
+
*/
|
|
382
|
+
declare function pipe<A, B>(fn: (a: A) => B): {
|
|
383
|
+
(a: A): B;
|
|
384
|
+
pipe<C>(fn2: (b: B) => C): {
|
|
385
|
+
(a: A): C;
|
|
386
|
+
pipe<C_1>(fn2: (b: C) => C_1): {
|
|
387
|
+
(a: A): C_1;
|
|
388
|
+
pipe<C_2>(fn2: (b: C_1) => C_2): {
|
|
389
|
+
(a: A): C_2;
|
|
390
|
+
pipe<C_3>(fn2: (b: C_2) => C_3): {
|
|
391
|
+
(a: A): C_3;
|
|
392
|
+
pipe<C_4>(fn2: (b: C_3) => C_4): {
|
|
393
|
+
(a: A): C_4;
|
|
394
|
+
pipe<C_5>(fn2: (b: C_4) => C_5): {
|
|
395
|
+
(a: A): C_5;
|
|
396
|
+
pipe<C_6>(fn2: (b: C_5) => C_6): {
|
|
397
|
+
(a: A): C_6;
|
|
398
|
+
pipe<C_7>(fn2: (b: C_6) => C_7): {
|
|
399
|
+
(a: A): C_7;
|
|
400
|
+
pipe<C_8>(fn2: (b: C_7) => C_8): {
|
|
401
|
+
(a: A): C_8;
|
|
402
|
+
pipe<C_9>(fn2: (b: C_8) => C_9): {
|
|
403
|
+
(a: A): C_9;
|
|
404
|
+
pipe<C_10>(fn2: (b: C_9) => C_10): /*elided*/ any;
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
export { type AnyObject, type ArrayItemType, type ArrayType, type AsyncFC, type AsyncReturnType, type AsyncVariableFC, type DeepInject, type DeepWriteable, type Defined, type EmptyObject, type FcProps, type Fn, type FunctionalChildren, type Jsonish, type Lenient, type LenientAutocomplete, type MatchType, type MergeTypes, type Modify, type NextErrorParams, type NextParams, type NextSearchParams, type Nullable, type OneOf, type OnlyFirst, type RecordKey, type RecordValue, type ReplaceReturnType, type SelectivePartial, type SetState, type StrictOmit, type Synchronous, type Undefinable, type VariableFC, type WeakOmit, type Writeable, pipe };
|
|
@@ -339,4 +339,79 @@ type MergeTypes<TypesArray extends any[], Res = EmptyObject> = TypesArray extend
|
|
|
339
339
|
*/
|
|
340
340
|
type WeakOmit<Obj extends AnyObject, Keys extends keyof Obj | undefined = undefined> = Keys extends keyof Obj ? Omit<Obj, Keys> : Obj;
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
/**
|
|
343
|
+
* Makes types don`t merging in unions.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* type Languages = 'TypeScript' | 'JavaScript' | Lenient<string>;
|
|
347
|
+
* // ^? "TypeScript" | "JavaScript" | string
|
|
348
|
+
*/
|
|
349
|
+
type Lenient<T> = T & {};
|
|
350
|
+
/**
|
|
351
|
+
* This type allows any string, but also saves compiler`s autocomplete
|
|
352
|
+
* feature.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* type Languages = 'TypeScript' | 'JavaScript';
|
|
356
|
+
*
|
|
357
|
+
* function handleLanguage(lang: LenientAutocomplete<Languages>) {
|
|
358
|
+
* // ^? string (but autocomplete feature is still here)
|
|
359
|
+
* console.log(lang);
|
|
360
|
+
* }
|
|
361
|
+
*/
|
|
362
|
+
type LenientAutocomplete<T extends string> = T | Lenient<string>;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Creates pipelines of functions that will be executed only
|
|
366
|
+
* when you will call whole pipeline.
|
|
367
|
+
*
|
|
368
|
+
* @param fn
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* const stringToDateAndTime = pipe(Date.parse)
|
|
372
|
+
* .pipe(n => new Date(n))
|
|
373
|
+
* .pipe(d => d.toDateString())
|
|
374
|
+
* .pipe(s => s.split('T'))
|
|
375
|
+
* .pipe(([date, time]) => ({ date, time }));
|
|
376
|
+
*
|
|
377
|
+
* const res = stringToDateAndTime('Jan 1, 2024');
|
|
378
|
+
* // ^? { date: string | undefined; time: string | undefined }
|
|
379
|
+
*
|
|
380
|
+
* @see https://youtu.be/bH61wRMqp-o?si=D-2Az-_dUFBxG9HG&t=429
|
|
381
|
+
*/
|
|
382
|
+
declare function pipe<A, B>(fn: (a: A) => B): {
|
|
383
|
+
(a: A): B;
|
|
384
|
+
pipe<C>(fn2: (b: B) => C): {
|
|
385
|
+
(a: A): C;
|
|
386
|
+
pipe<C_1>(fn2: (b: C) => C_1): {
|
|
387
|
+
(a: A): C_1;
|
|
388
|
+
pipe<C_2>(fn2: (b: C_1) => C_2): {
|
|
389
|
+
(a: A): C_2;
|
|
390
|
+
pipe<C_3>(fn2: (b: C_2) => C_3): {
|
|
391
|
+
(a: A): C_3;
|
|
392
|
+
pipe<C_4>(fn2: (b: C_3) => C_4): {
|
|
393
|
+
(a: A): C_4;
|
|
394
|
+
pipe<C_5>(fn2: (b: C_4) => C_5): {
|
|
395
|
+
(a: A): C_5;
|
|
396
|
+
pipe<C_6>(fn2: (b: C_5) => C_6): {
|
|
397
|
+
(a: A): C_6;
|
|
398
|
+
pipe<C_7>(fn2: (b: C_6) => C_7): {
|
|
399
|
+
(a: A): C_7;
|
|
400
|
+
pipe<C_8>(fn2: (b: C_7) => C_8): {
|
|
401
|
+
(a: A): C_8;
|
|
402
|
+
pipe<C_9>(fn2: (b: C_8) => C_9): {
|
|
403
|
+
(a: A): C_9;
|
|
404
|
+
pipe<C_10>(fn2: (b: C_9) => C_10): /*elided*/ any;
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
export { type AnyObject, type ArrayItemType, type ArrayType, type AsyncFC, type AsyncReturnType, type AsyncVariableFC, type DeepInject, type DeepWriteable, type Defined, type EmptyObject, type FcProps, type Fn, type FunctionalChildren, type Jsonish, type Lenient, type LenientAutocomplete, type MatchType, type MergeTypes, type Modify, type NextErrorParams, type NextParams, type NextSearchParams, type Nullable, type OneOf, type OnlyFirst, type RecordKey, type RecordValue, type ReplaceReturnType, type SelectivePartial, type SetState, type StrictOmit, type Synchronous, type Undefinable, type VariableFC, type WeakOmit, type Writeable, pipe };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(n){function p(e){return n(e)}return p.pipe=e=>t(i=>e(n(i))),p}export{t as pipe};
|
package/package.json
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xenopomp-essentials",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
4
|
-
"main": "index.js",
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
5
4
|
"author": "XenoPOMP <101574433+XenoPOMP@users.noreply.github.com>",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"private": false,
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "20 || >=22"
|
|
9
|
+
},
|
|
8
10
|
"scripts": {
|
|
9
11
|
"build": "unbuild --config .config/build.config.ts",
|
|
10
12
|
"lint": "run-s lint:*",
|
|
11
13
|
"lint:code": "eslint -c ./.config/eslint.config.mjs .",
|
|
14
|
+
"coverage": "vitest run --coverage -c ./.config/vitest.config.ts",
|
|
12
15
|
"prepare": "husky"
|
|
13
16
|
},
|
|
14
17
|
"exports": {
|
|
15
|
-
"
|
|
16
|
-
"import": "./dist/
|
|
17
|
-
"types": "./dist/
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
18
21
|
}
|
|
19
22
|
},
|
|
20
|
-
"
|
|
23
|
+
"main": "./dist/index.mjs",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
21
28
|
"peerDependencies": {
|
|
22
29
|
"@types/react": ">=19",
|
|
23
30
|
"react": ">=19",
|
|
@@ -32,14 +39,19 @@
|
|
|
32
39
|
},
|
|
33
40
|
"devDependencies": {
|
|
34
41
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
42
|
+
"@vitest/coverage-istanbul": "^3.0.4",
|
|
35
43
|
"eslint": "^9.19.0",
|
|
36
44
|
"eslint-config-xeno": "^2.0.3-rc.3",
|
|
37
45
|
"husky": "^9.1.7",
|
|
38
46
|
"hygen": "^6.2.11",
|
|
47
|
+
"jsdom": "^26.0.0",
|
|
39
48
|
"lint-staged": "^15.4.2",
|
|
40
49
|
"npm-run-all": "^4.1.5",
|
|
41
50
|
"pinst": "^3.0.0",
|
|
42
51
|
"prettier": "^3.4.2",
|
|
43
|
-
"
|
|
52
|
+
"tsd": "^0.31.2",
|
|
53
|
+
"unbuild": "^3.3.1",
|
|
54
|
+
"vite": "^6.0.11",
|
|
55
|
+
"vitest": "^3.0.4"
|
|
44
56
|
}
|
|
45
57
|
}
|
package/dist/types/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|