Comparing version 0.23.1 to 0.24.0
@@ -31,3 +31,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -41,6 +41,6 @@ } | ||
const stackFrames = callsites_1.default(); | ||
test_1.default(value, label !== null && label !== void 0 ? label : (() => infer_label_1.inferLabel(stackFrames)), labelOrPredicate); | ||
test_1.default(value, label ?? (() => infer_label_1.inferLabel(stackFrames)), labelOrPredicate); | ||
return; | ||
} | ||
test_1.default(value, label !== null && label !== void 0 ? label : (labelOrPredicate), predicate); | ||
test_1.default(value, label ?? (labelOrPredicate), predicate); | ||
} | ||
@@ -47,0 +47,0 @@ } |
@@ -5,2 +5,3 @@ /// <reference types="node" /> | ||
import { NumberPredicate } from './predicates/number'; | ||
import { BigIntPredicate } from './predicates/bigint'; | ||
import { BooleanPredicate } from './predicates/boolean'; | ||
@@ -31,2 +32,6 @@ import { Predicate, PredicateOptions } from './predicates/predicate'; | ||
/** | ||
Test the value to be an bigint. | ||
*/ | ||
readonly bigint: BigIntPredicate; | ||
/** | ||
Test the value to be a boolean. | ||
@@ -166,2 +171,2 @@ */ | ||
export default _default; | ||
export { StringPredicate, NumberPredicate, BooleanPredicate, ArrayPredicate, ObjectPredicate, DatePredicate, ErrorPredicate, MapPredicate, WeakMapPredicate, SetPredicate, WeakSetPredicate, TypedArrayPredicate, ArrayBufferPredicate, DataViewPredicate, AnyPredicate, Shape }; | ||
export { StringPredicate, NumberPredicate, BigIntPredicate, BooleanPredicate, ArrayPredicate, ObjectPredicate, DatePredicate, ErrorPredicate, MapPredicate, WeakMapPredicate, SetPredicate, WeakSetPredicate, TypedArrayPredicate, ArrayBufferPredicate, DataViewPredicate, AnyPredicate, Shape }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AnyPredicate = exports.DataViewPredicate = exports.ArrayBufferPredicate = exports.TypedArrayPredicate = exports.WeakSetPredicate = exports.SetPredicate = exports.WeakMapPredicate = exports.MapPredicate = exports.ErrorPredicate = exports.DatePredicate = exports.ObjectPredicate = exports.ArrayPredicate = exports.BooleanPredicate = exports.NumberPredicate = exports.StringPredicate = void 0; | ||
exports.AnyPredicate = exports.DataViewPredicate = exports.ArrayBufferPredicate = exports.TypedArrayPredicate = exports.WeakSetPredicate = exports.SetPredicate = exports.WeakMapPredicate = exports.MapPredicate = exports.ErrorPredicate = exports.DatePredicate = exports.ObjectPredicate = exports.ArrayPredicate = exports.BooleanPredicate = exports.BigIntPredicate = exports.NumberPredicate = exports.StringPredicate = void 0; | ||
const string_1 = require("./predicates/string"); | ||
@@ -8,2 +8,4 @@ Object.defineProperty(exports, "StringPredicate", { enumerable: true, get: function () { return string_1.StringPredicate; } }); | ||
Object.defineProperty(exports, "NumberPredicate", { enumerable: true, get: function () { return number_1.NumberPredicate; } }); | ||
const bigint_1 = require("./predicates/bigint"); | ||
Object.defineProperty(exports, "BigIntPredicate", { enumerable: true, get: function () { return bigint_1.BigIntPredicate; } }); | ||
const boolean_1 = require("./predicates/boolean"); | ||
@@ -44,2 +46,5 @@ Object.defineProperty(exports, "BooleanPredicate", { enumerable: true, get: function () { return boolean_1.BooleanPredicate; } }); | ||
}, | ||
bigint: { | ||
get: () => new bigint_1.BigIntPredicate(options) | ||
}, | ||
boolean: { | ||
@@ -46,0 +51,0 @@ get: () => new boolean_1.BooleanPredicate(options) |
@@ -43,3 +43,3 @@ "use strict"; | ||
// Add all errors under the same key | ||
errors.set(key, new Set([...alreadyPresent !== null && alreadyPresent !== void 0 ? alreadyPresent : [], ...value])); | ||
errors.set(key, new Set([...alreadyPresent ?? [], ...value])); | ||
} | ||
@@ -46,0 +46,0 @@ } |
@@ -87,4 +87,3 @@ "use strict"; | ||
message: (object, label) => { | ||
var _a; | ||
let { name } = (_a = object === null || object === void 0 ? void 0 : object.constructor) !== null && _a !== void 0 ? _a : {}; | ||
let { name } = object?.constructor ?? {}; | ||
if (!name || name === 'Object') { | ||
@@ -91,0 +90,0 @@ name = JSON.stringify(object); |
@@ -46,3 +46,3 @@ "use strict"; | ||
// We do not include type in this label as we do for other messages, because it would be redundant. | ||
const label_ = label === null || label === void 0 ? void 0 : label.slice(this.type.length + 1); | ||
const label_ = label?.slice(this.type.length + 1); | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
@@ -49,0 +49,0 @@ return `Expected ${label_ || 'argument'} to be of type \`${this.type}\` but received type \`${is_1.default(value)}\``; |
@@ -17,3 +17,2 @@ "use strict"; | ||
const inferLabel = (callsites) => { | ||
var _a; | ||
if (!is_node_1.default) { | ||
@@ -38,3 +37,3 @@ // Exit if we are not running in a Node.js environment | ||
} | ||
catch (_b) { | ||
catch { | ||
return; | ||
@@ -49,3 +48,3 @@ } | ||
const match = labelRegex.exec(line); | ||
if (!((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.label)) { | ||
if (!match?.groups?.label) { | ||
// Exit if we didn't find a label | ||
@@ -52,0 +51,0 @@ return; |
"use strict"; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = Boolean((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node); | ||
exports.default = Boolean(process?.versions?.node); |
{ | ||
"name": "ow", | ||
"version": "0.23.1", | ||
"version": "0.24.0", | ||
"description": "Function argument validation for humans", | ||
@@ -15,3 +15,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12" | ||
}, | ||
@@ -18,0 +18,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135853
74
3302