@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.
- package/dist/cjs/predicate/isAnyObjectWith.js +1 -2
- package/dist/cjs/predicate/isAnyObjectWithOwn.js +1 -2
- package/dist/cjs/predicate/isObjectWith.js +1 -4
- package/dist/cjs/predicate/isPrimitive.js +7 -14
- package/dist/cjs/predicate/isPromiseFulfilledResult.js +6 -5
- package/dist/cjs/predicate/isPromiseRejectedResult.js +6 -5
- package/dist/mjs/predicate/isAnyObjectWith.js +1 -2
- package/dist/mjs/predicate/isAnyObjectWithOwn.js +1 -2
- package/dist/mjs/predicate/isObjectWith.js +1 -4
- package/dist/mjs/predicate/isPrimitive.js +7 -14
- package/dist/mjs/predicate/isPromiseFulfilledResult.js +6 -4
- package/dist/mjs/predicate/isPromiseRejectedResult.js +6 -4
- package/dist/types/assertion/assertIsObject.d.ts +2 -1
- package/dist/types/predicate/isAnyObjectWith.d.ts +1 -1
- package/dist/types/predicate/isAnyObjectWithOwn.d.ts +1 -1
- package/dist/types/predicate/isObject.d.ts +2 -1
- package/dist/types/predicate/isObjectWith.d.ts +1 -1
- package/dist/types/predicate/isOptionalObject.d.ts +1 -1
- package/dist/types/predicate/isPromiseFulfilledResult.d.ts +4 -1
- package/dist/types/predicate/isPromiseRejectedResult.d.ts +4 -1
- package/package.json +3 -3
|
@@ -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) &&
|
|
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) &&
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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) &&
|
|
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) &&
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
1
|
+
export declare const isAnyObjectWithOwn: <T, P extends PropertyKey>(input: T, properties: P[]) => input is T & Record<P, unknown>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
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
|
|
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<
|
|
1
|
+
export declare const isOptionalObject: import("../index.js").TypePredicateFn<import("../index.js").UnknownRecord | undefined>;
|
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.
|
|
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.
|
|
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.
|
|
109
|
+
"validate-package-exports": "^0.9.0",
|
|
110
110
|
"vitest": "^3.0.9"
|
|
111
111
|
},
|
|
112
112
|
"pnpm": {
|