defuss-runtime 1.0.4 → 1.1.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/index.cjs +20 -0
- package/dist/index.d.cts +23 -1
- package/dist/index.d.mts +23 -1
- package/dist/index.mjs +17 -1
- package/package.json +12 -10
package/dist/index.cjs
CHANGED
|
@@ -387,6 +387,22 @@ const asInteger = (value) => {
|
|
|
387
387
|
return asNumber(Number.parseInt(asString(number), 10).toFixed(0));
|
|
388
388
|
};
|
|
389
389
|
|
|
390
|
+
const isTrue = (value) => {
|
|
391
|
+
return value === true;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
const isFalse = (value) => {
|
|
395
|
+
return value === false;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const isTruthy = (value) => {
|
|
399
|
+
return !!value;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const isFalsy = (value) => {
|
|
403
|
+
return !value;
|
|
404
|
+
};
|
|
405
|
+
|
|
390
406
|
const isAfter = (value, minDate, inclusive = false) => {
|
|
391
407
|
return value instanceof Date && (inclusive ? value.getTime() >= minDate.getTime() : value.getTime() > minDate.getTime());
|
|
392
408
|
};
|
|
@@ -532,6 +548,8 @@ exports.isDefined = isDefined;
|
|
|
532
548
|
exports.isEmail = isEmail;
|
|
533
549
|
exports.isEmpty = isEmpty;
|
|
534
550
|
exports.isEqual = isEqual;
|
|
551
|
+
exports.isFalse = isFalse;
|
|
552
|
+
exports.isFalsy = isFalsy;
|
|
535
553
|
exports.isGreaterThan = isGreaterThan;
|
|
536
554
|
exports.isInteger = isInteger;
|
|
537
555
|
exports.isLessThan = isLessThan;
|
|
@@ -546,6 +564,8 @@ exports.isSafeNumeric = isSafeNumeric;
|
|
|
546
564
|
exports.isShorterThan = isShorterThan;
|
|
547
565
|
exports.isSlug = isSlug;
|
|
548
566
|
exports.isString = isString;
|
|
567
|
+
exports.isTrue = isTrue;
|
|
568
|
+
exports.isTruthy = isTruthy;
|
|
549
569
|
exports.isUrl = isUrl;
|
|
550
570
|
exports.isUrlPath = isUrlPath;
|
|
551
571
|
exports.omit = omit;
|
package/dist/index.d.cts
CHANGED
|
@@ -149,6 +149,28 @@ declare const asDate: (value: any) => Date;
|
|
|
149
149
|
|
|
150
150
|
declare const asInteger: (value: any) => number;
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Transformer that checks if a value is strictly true.
|
|
154
|
+
*/
|
|
155
|
+
declare const isTrue: (value: any) => boolean;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Transformer that checks if a value is strictly false.
|
|
159
|
+
*/
|
|
160
|
+
declare const isFalse: (value: any) => boolean;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Transformer that checks if a value is truthy.
|
|
164
|
+
* Returns true for all truthy values (non-zero numbers, non-empty strings, objects, etc.)
|
|
165
|
+
*/
|
|
166
|
+
declare const isTruthy: (value: any) => boolean;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Transformer that checks if a value is falsy.
|
|
170
|
+
* Returns true for all falsy values (false, 0, "", null, undefined, NaN)
|
|
171
|
+
*/
|
|
172
|
+
declare const isFalsy: (value: any) => boolean;
|
|
173
|
+
|
|
152
174
|
declare const isAfter: (value: Date | undefined, minDate: Date, inclusive?: boolean) => value is Date;
|
|
153
175
|
|
|
154
176
|
type ValidationMessage = string | number | boolean | null | undefined;
|
|
@@ -238,4 +260,4 @@ declare const isEqual: (value: any, valueB: any) => boolean;
|
|
|
238
260
|
type PreloadAs = "image" | "script" | "style" | "fetch" | "track" | "font";
|
|
239
261
|
declare function preload(url: string | string[], as?: PreloadAs): void;
|
|
240
262
|
|
|
241
|
-
export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type PreloadAs, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
|
|
263
|
+
export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type PreloadAs, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isFalse, isFalsy, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isTrue, isTruthy, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
|
package/dist/index.d.mts
CHANGED
|
@@ -149,6 +149,28 @@ declare const asDate: (value: any) => Date;
|
|
|
149
149
|
|
|
150
150
|
declare const asInteger: (value: any) => number;
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Transformer that checks if a value is strictly true.
|
|
154
|
+
*/
|
|
155
|
+
declare const isTrue: (value: any) => boolean;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Transformer that checks if a value is strictly false.
|
|
159
|
+
*/
|
|
160
|
+
declare const isFalse: (value: any) => boolean;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Transformer that checks if a value is truthy.
|
|
164
|
+
* Returns true for all truthy values (non-zero numbers, non-empty strings, objects, etc.)
|
|
165
|
+
*/
|
|
166
|
+
declare const isTruthy: (value: any) => boolean;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Transformer that checks if a value is falsy.
|
|
170
|
+
* Returns true for all falsy values (false, 0, "", null, undefined, NaN)
|
|
171
|
+
*/
|
|
172
|
+
declare const isFalsy: (value: any) => boolean;
|
|
173
|
+
|
|
152
174
|
declare const isAfter: (value: Date | undefined, minDate: Date, inclusive?: boolean) => value is Date;
|
|
153
175
|
|
|
154
176
|
type ValidationMessage = string | number | boolean | null | undefined;
|
|
@@ -238,4 +260,4 @@ declare const isEqual: (value: any, valueB: any) => boolean;
|
|
|
238
260
|
type PreloadAs = "image" | "script" | "style" | "fetch" | "track" | "font";
|
|
239
261
|
declare function preload(url: string | string[], as?: PreloadAs): void;
|
|
240
262
|
|
|
241
|
-
export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type PreloadAs, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
|
|
263
|
+
export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type PreloadAs, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isFalse, isFalsy, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isTrue, isTruthy, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
|
package/dist/index.mjs
CHANGED
|
@@ -385,6 +385,22 @@ const asInteger = (value) => {
|
|
|
385
385
|
return asNumber(Number.parseInt(asString(number), 10).toFixed(0));
|
|
386
386
|
};
|
|
387
387
|
|
|
388
|
+
const isTrue = (value) => {
|
|
389
|
+
return value === true;
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const isFalse = (value) => {
|
|
393
|
+
return value === false;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const isTruthy = (value) => {
|
|
397
|
+
return !!value;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
const isFalsy = (value) => {
|
|
401
|
+
return !value;
|
|
402
|
+
};
|
|
403
|
+
|
|
388
404
|
const isAfter = (value, minDate, inclusive = false) => {
|
|
389
405
|
return value instanceof Date && (inclusive ? value.getTime() >= minDate.getTime() : value.getTime() > minDate.getTime());
|
|
390
406
|
};
|
|
@@ -496,4 +512,4 @@ function preload(url, as = "image") {
|
|
|
496
512
|
});
|
|
497
513
|
}
|
|
498
514
|
|
|
499
|
-
export { PATH_ACCESSOR_SYMBOL, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
|
|
515
|
+
export { PATH_ACCESSOR_SYMBOL, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isFalse, isFalsy, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isTrue, isTruthy, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "defuss-runtime",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,13 +20,6 @@
|
|
|
20
20
|
"url": "git+https://github.com/kyr0/defuss.git",
|
|
21
21
|
"type": "git"
|
|
22
22
|
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"clean": "rm -rf ./node_modules/.pnpm",
|
|
25
|
-
"pretest": "pnpm run build",
|
|
26
|
-
"prebuild": "pnpm run clean",
|
|
27
|
-
"build": "pkgroll",
|
|
28
|
-
"test": "vitest --run --coverage"
|
|
29
|
-
},
|
|
30
23
|
"author": "Aron Homberg <info@aron-homberg.de>",
|
|
31
24
|
"sideEffects": false,
|
|
32
25
|
"exports": {
|
|
@@ -44,7 +37,9 @@
|
|
|
44
37
|
"main": "./dist/index.cjs",
|
|
45
38
|
"module": "./dist/index.mjs",
|
|
46
39
|
"types": "./dist/index.d.cts",
|
|
47
|
-
"files": [
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
48
43
|
"engines": {
|
|
49
44
|
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"
|
|
50
45
|
},
|
|
@@ -54,5 +49,12 @@
|
|
|
54
49
|
"typescript": "^5.6.3",
|
|
55
50
|
"vitest": "^3.1.3",
|
|
56
51
|
"@vitest/coverage-v8": "^3.1.3"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"clean": "rm -rf ./node_modules/.pnpm",
|
|
55
|
+
"pretest": "pnpm run build",
|
|
56
|
+
"prebuild": "pnpm run clean",
|
|
57
|
+
"build": "pkgroll",
|
|
58
|
+
"test": "vitest --run --coverage"
|
|
57
59
|
}
|
|
58
|
-
}
|
|
60
|
+
}
|