@webdeveric/utils 0.56.0 → 0.57.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.
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAnyObjectWith = void 0;
4
- const asArray_js_1 = require("../asArray.js");
5
4
  const isAnyObject_js_1 = require("./isAnyObject.js");
6
5
  const isAnyObjectWith = (input, properties) => {
7
- return (0, isAnyObject_js_1.isAnyObject)(input) && (0, asArray_js_1.asArray)(properties).every((property) => property in input);
6
+ return (0, isAnyObject_js_1.isAnyObject)(input) && properties.every((property) => property in input);
8
7
  };
9
8
  exports.isAnyObjectWith = isAnyObjectWith;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAnyObjectWithOwn = void 0;
4
- const asArray_js_1 = require("../asArray.js");
5
4
  const isAnyObject_js_1 = require("./isAnyObject.js");
6
5
  const isAnyObjectWithOwn = (input, properties) => {
7
- return (0, isAnyObject_js_1.isAnyObject)(input) && (0, asArray_js_1.asArray)(properties).every((property) => Object.hasOwn(input, property));
6
+ return (0, isAnyObject_js_1.isAnyObject)(input) && properties.every((property) => Object.hasOwn(input, property));
8
7
  };
9
8
  exports.isAnyObjectWithOwn = isAnyObjectWithOwn;
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isObjectWith = void 0;
4
- const asArray_js_1 = require("../asArray.js");
5
4
  const isObject_js_1 = require("./isObject.js");
6
- const isObjectWith = (input, properties) => {
7
- return (0, isObject_js_1.isObject)(input) && (0, asArray_js_1.asArray)(properties).every((property) => property in input);
8
- };
5
+ const isObjectWith = (input, properties) => (0, isObject_js_1.isObject)(input) && properties.every((property) => property in input);
9
6
  exports.isObjectWith = isObjectWith;
@@ -1,18 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPrimitive = void 0;
4
- const isBigInt_js_1 = require("./isBigInt.js");
5
- const isBoolean_js_1 = require("./isBoolean.js");
6
- const isNull_js_1 = require("./isNull.js");
7
- const isNumber_js_1 = require("./isNumber.js");
8
- const isString_js_1 = require("./isString.js");
9
- const isSymbol_js_1 = require("./isSymbol.js");
10
- const isUndefined_js_1 = require("./isUndefined.js");
11
- const isPrimitive = (input) => (0, isString_js_1.isString)(input) ||
12
- (0, isNumber_js_1.isNumber)(input) ||
13
- (0, isBigInt_js_1.isBigInt)(input) ||
14
- (0, isBoolean_js_1.isBoolean)(input) ||
15
- (0, isUndefined_js_1.isUndefined)(input) ||
16
- (0, isSymbol_js_1.isSymbol)(input) ||
17
- (0, isNull_js_1.isNull)(input);
4
+ const isPrimitive = (input) => input === null ||
5
+ typeof input === 'string' ||
6
+ typeof input === 'number' ||
7
+ typeof input === 'bigint' ||
8
+ typeof input === 'boolean' ||
9
+ typeof input === 'undefined' ||
10
+ typeof input === 'symbol';
18
11
  exports.isPrimitive = isPrimitive;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPromiseFulfilledResult = void 0;
4
- const isObjectWith_js_1 = require("./isObjectWith.js");
5
- const isPromiseFulfilledResult = (input) => {
6
- return (0, isObjectWith_js_1.isObjectWith)(input, 'status') && input.status === 'fulfilled';
7
- };
8
- exports.isPromiseFulfilledResult = isPromiseFulfilledResult;
4
+ const shape_js_1 = require("./factory/shape.js");
5
+ const isUnknown_js_1 = require("./isUnknown.js");
6
+ exports.isPromiseFulfilledResult = (0, shape_js_1.shape)({
7
+ status: 'fulfilled',
8
+ value: isUnknown_js_1.isUnknown,
9
+ });
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPromiseRejectedResult = void 0;
4
- const isObjectWith_js_1 = require("./isObjectWith.js");
5
- const isPromiseRejectedResult = (input) => {
6
- return (0, isObjectWith_js_1.isObjectWith)(input, ['status', 'reason']) && input.status === 'rejected';
7
- };
8
- exports.isPromiseRejectedResult = isPromiseRejectedResult;
4
+ const shape_js_1 = require("./factory/shape.js");
5
+ const isAny_js_1 = require("./isAny.js");
6
+ exports.isPromiseRejectedResult = (0, shape_js_1.shape)({
7
+ status: 'rejected',
8
+ reason: isAny_js_1.isAny,
9
+ });
@@ -1,5 +1,4 @@
1
- import { asArray } from '../asArray.js';
2
1
  import { isAnyObject } from './isAnyObject.js';
3
2
  export const isAnyObjectWith = (input, properties) => {
4
- return isAnyObject(input) && asArray(properties).every((property) => property in input);
3
+ return isAnyObject(input) && properties.every((property) => property in input);
5
4
  };
@@ -1,5 +1,4 @@
1
- import { asArray } from '../asArray.js';
2
1
  import { isAnyObject } from './isAnyObject.js';
3
2
  export const isAnyObjectWithOwn = (input, properties) => {
4
- return isAnyObject(input) && asArray(properties).every((property) => Object.hasOwn(input, property));
3
+ return isAnyObject(input) && properties.every((property) => Object.hasOwn(input, property));
5
4
  };
@@ -1,5 +1,2 @@
1
- import { asArray } from '../asArray.js';
2
1
  import { isObject } from './isObject.js';
3
- export const isObjectWith = (input, properties) => {
4
- return isObject(input) && asArray(properties).every((property) => property in input);
5
- };
2
+ export const isObjectWith = (input, properties) => isObject(input) && properties.every((property) => property in input);
@@ -1,14 +1,7 @@
1
- import { isBigInt } from './isBigInt.js';
2
- import { isBoolean } from './isBoolean.js';
3
- import { isNull } from './isNull.js';
4
- import { isNumber } from './isNumber.js';
5
- import { isString } from './isString.js';
6
- import { isSymbol } from './isSymbol.js';
7
- import { isUndefined } from './isUndefined.js';
8
- export const isPrimitive = (input) => isString(input) ||
9
- isNumber(input) ||
10
- isBigInt(input) ||
11
- isBoolean(input) ||
12
- isUndefined(input) ||
13
- isSymbol(input) ||
14
- isNull(input);
1
+ export const isPrimitive = (input) => input === null ||
2
+ typeof input === 'string' ||
3
+ typeof input === 'number' ||
4
+ typeof input === 'bigint' ||
5
+ typeof input === 'boolean' ||
6
+ typeof input === 'undefined' ||
7
+ typeof input === 'symbol';
@@ -1,4 +1,6 @@
1
- import { isObjectWith } from './isObjectWith.js';
2
- export const isPromiseFulfilledResult = (input) => {
3
- return isObjectWith(input, 'status') && input.status === 'fulfilled';
4
- };
1
+ import { shape } from './factory/shape.js';
2
+ import { isUnknown } from './isUnknown.js';
3
+ export const isPromiseFulfilledResult = shape({
4
+ status: 'fulfilled',
5
+ value: isUnknown,
6
+ });
@@ -1,4 +1,6 @@
1
- import { isObjectWith } from './isObjectWith.js';
2
- export const isPromiseRejectedResult = (input) => {
3
- return isObjectWith(input, ['status', 'reason']) && input.status === 'rejected';
4
- };
1
+ import { shape } from './factory/shape.js';
2
+ import { isAny } from './isAny.js';
3
+ export const isPromiseRejectedResult = shape({
4
+ status: 'rejected',
5
+ reason: isAny,
6
+ });
@@ -1 +1,2 @@
1
- export declare function assertIsObject(input: unknown, error?: string | Error): asserts input is object;
1
+ import type { UnknownRecord } from '../types/records.js';
2
+ export declare function assertIsObject(input: unknown, error?: string | Error): asserts input is UnknownRecord;
@@ -1 +1 @@
1
- export declare const isAnyObjectWith: <T, P extends PropertyKey>(input: T, properties: P | P[]) => input is T & Record<P, unknown>;
1
+ export declare const isAnyObjectWith: <T, P extends PropertyKey>(input: T, properties: P[]) => input is T & Record<P, unknown>;
@@ -1 +1 @@
1
- export declare const isAnyObjectWithOwn: <T, P extends PropertyKey>(input: T, properties: P | P[]) => input is T & Record<P, unknown>;
1
+ export declare const isAnyObjectWithOwn: <T, P extends PropertyKey>(input: T, properties: P[]) => input is T & Record<P, unknown>;
@@ -1 +1,2 @@
1
- export declare const isObject: (input: unknown) => input is object;
1
+ import type { UnknownRecord } from '../types/records.js';
2
+ export declare const isObject: (input: unknown) => input is UnknownRecord;
@@ -1 +1 @@
1
- export declare const isObjectWith: <T, P extends PropertyKey>(input: T, properties: P | P[]) => input is T & Record<P, unknown>;
1
+ export declare const isObjectWith: <T, P extends PropertyKey>(input: T, properties: P[]) => input is T & Record<P, unknown>;
@@ -1 +1 @@
1
- export declare const isOptionalObject: import("../index.js").TypePredicateFn<object | undefined>;
1
+ export declare const isOptionalObject: import("../index.js").TypePredicateFn<import("../index.js").UnknownRecord | undefined>;
@@ -1 +1,4 @@
1
- export declare const isPromiseFulfilledResult: <T>(input: unknown) => input is PromiseFulfilledResult<T>;
1
+ export declare const isPromiseFulfilledResult: import("../index.js").TypePredicateFn<{
2
+ status: string;
3
+ value: unknown;
4
+ }>;
@@ -1 +1,4 @@
1
- export declare const isPromiseRejectedResult: (input: unknown) => input is PromiseRejectedResult;
1
+ export declare const isPromiseRejectedResult: import("../index.js").TypePredicateFn<{
2
+ status: string;
3
+ reason: any;
4
+ }>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webdeveric/utils",
3
3
  "description": "Just another collection of utilities.",
4
- "version": "0.56.0",
4
+ "version": "0.57.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -87,7 +87,7 @@
87
87
  "devDependencies": {
88
88
  "@commitlint/config-conventional": "^19.8.0",
89
89
  "@commitlint/types": "^19.8.0",
90
- "@types/node": "^22.13.11",
90
+ "@types/node": "^22.13.13",
91
91
  "@vitest/coverage-v8": "^3.0.9",
92
92
  "@webdeveric/eslint-config-ts": "^0.11.0",
93
93
  "@webdeveric/prettier-config": "^0.3.0",
@@ -106,7 +106,7 @@
106
106
  "rimraf": "^6.0.1",
107
107
  "semantic-release": "^24.2.3",
108
108
  "typescript": "^5.8.2",
109
- "validate-package-exports": "^0.8.0",
109
+ "validate-package-exports": "^0.9.0",
110
110
  "vitest": "^3.0.9"
111
111
  },
112
112
  "pnpm": {