@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 };
@@ -43,4 +43,5 @@ export * from "./override";
43
43
  export * from "./errorKindNamespace";
44
44
  export * from "./truthy";
45
45
  export * from "./falsy";
46
+ export * from "./hasSomeKinds";
46
47
  export * from "./hasKinds";
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';
@@ -1245,6 +1245,15 @@
1245
1245
  {
1246
1246
  "name": "hasKinds.mjs"
1247
1247
  },
1248
+ {
1249
+ "name": "hasSomeKinds.cjs"
1250
+ },
1251
+ {
1252
+ "name": "hasSomeKinds.d.ts"
1253
+ },
1254
+ {
1255
+ "name": "hasSomeKinds.mjs"
1256
+ },
1248
1257
  {
1249
1258
  "name": "index.d.ts"
1250
1259
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duplojs/utils",
3
- "version": "1.3.28",
3
+ "version": "1.3.29",
4
4
  "author": {
5
5
  "name": "mathcovax",
6
6
  "url": "https://github.com/mathcovax"