@duplojs/utils 1.3.28 → 1.3.29
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function hasSomeKinds(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [kinds] = args;
|
|
6
|
+
return (input) => hasSomeKinds(input, kinds);
|
|
7
|
+
}
|
|
8
|
+
const [input, kinds] = args;
|
|
9
|
+
for (const kind of kinds) {
|
|
10
|
+
if (kind.has(input)) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.hasSomeKinds = hasSomeKinds;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Kind, type KindHandler } from "./kind";
|
|
2
|
+
import { type AnyTuple } from "./types";
|
|
3
|
+
export declare function hasSomeKinds<GenericInput extends unknown, const GenericKindHandlers extends AnyTuple<KindHandler>, GenericKindHandler extends GenericKindHandlers[number]>(kinds: GenericKindHandlers): (input: GenericInput) => input is Extract<GenericInput, GenericKindHandler extends any ? Kind<GenericKindHandler["definition"]> : never>;
|
|
4
|
+
export declare function hasSomeKinds<GenericInput extends unknown, const GenericKindHandlers extends AnyTuple<KindHandler>, GenericKindHandler extends GenericKindHandlers[number]>(input: GenericInput, kinds: GenericKindHandlers): input is Extract<GenericInput, GenericKindHandler extends any ? Kind<GenericKindHandler["definition"]> : never>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function hasSomeKinds(...args) {
|
|
2
|
+
if (args.length === 1) {
|
|
3
|
+
const [kinds] = args;
|
|
4
|
+
return (input) => hasSomeKinds(input, kinds);
|
|
5
|
+
}
|
|
6
|
+
const [input, kinds] = args;
|
|
7
|
+
for (const kind of kinds) {
|
|
8
|
+
if (kind.has(input)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { hasSomeKinds };
|
package/dist/common/index.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ var override = require('./common/override.cjs');
|
|
|
56
56
|
var errorKindNamespace = require('./common/errorKindNamespace.cjs');
|
|
57
57
|
var truthy = require('./common/truthy.cjs');
|
|
58
58
|
var falsy = require('./common/falsy.cjs');
|
|
59
|
+
var hasSomeKinds = require('./common/hasSomeKinds.cjs');
|
|
59
60
|
var hasKinds = require('./common/hasKinds.cjs');
|
|
60
61
|
|
|
61
62
|
|
|
@@ -140,4 +141,5 @@ exports.createOverride = override.createOverride;
|
|
|
140
141
|
exports.createErrorKind = errorKindNamespace.createErrorKind;
|
|
141
142
|
exports.truthy = truthy.truthy;
|
|
142
143
|
exports.falsy = falsy.falsy;
|
|
144
|
+
exports.hasSomeKinds = hasSomeKinds.hasSomeKinds;
|
|
143
145
|
exports.hasKinds = hasKinds.hasKinds;
|
package/dist/index.mjs
CHANGED
|
@@ -78,4 +78,5 @@ export { createOverride } from './common/override.mjs';
|
|
|
78
78
|
export { createErrorKind } from './common/errorKindNamespace.mjs';
|
|
79
79
|
export { truthy } from './common/truthy.mjs';
|
|
80
80
|
export { falsy } from './common/falsy.mjs';
|
|
81
|
+
export { hasSomeKinds } from './common/hasSomeKinds.mjs';
|
|
81
82
|
export { hasKinds } from './common/hasKinds.mjs';
|
package/dist/metadata.json
CHANGED