Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sapphire/shapeshift

Package Overview
Dependencies
Maintainers
3
Versions
460
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sapphire/shapeshift - npm Package Compare versions

Comparing version 2.0.1-next.6087677.0 to 2.0.1-next.48c30c6.0

120

dist/index.global.js

@@ -6,3 +6,2 @@ var SapphireShapeshift = (() => {

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });

@@ -20,15 +19,11 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {

};
var __reExport = (target, module, copyDefault, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return target;
return to;
};
var __toCommonJS = /* @__PURE__ */ ((cache) => {
return (module, temp) => {
return cache && cache.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache && cache.set(module, temp), temp);
};
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

@@ -79,3 +74,2 @@ // src/index.ts

};
__name(Result, "Result");

@@ -135,3 +129,2 @@ // src/validators/BaseValidator.ts

};
__name(BaseValidator, "BaseValidator");

@@ -150,3 +143,2 @@ // src/lib/errors/ExpectedConstraintError.ts

};
__name(BaseError, "BaseError");

@@ -161,3 +153,2 @@ // src/lib/errors/BaseConstraintError.ts

};
__name(BaseConstraintError, "BaseConstraintError");

@@ -199,3 +190,2 @@ // src/lib/errors/ExpectedConstraintError.ts

};
__name(ExpectedConstraintError, "ExpectedConstraintError");

@@ -206,23 +196,17 @@ // src/constraints/util/operators.ts

}
__name(lt, "lt");
function le(a, b) {
return a <= b;
}
__name(le, "le");
function gt(a, b) {
return a > b;
}
__name(gt, "gt");
function ge(a, b) {
return a >= b;
}
__name(ge, "ge");
function eq(a, b) {
return a === b;
}
__name(eq, "eq");
function ne(a, b) {
return a !== b;
}
__name(ne, "ne");

@@ -237,3 +221,2 @@ // src/constraints/ArrayLengthConstraints.ts

}
__name(arrayLengthComparator, "arrayLengthComparator");
function arrayLengthLt(value) {

@@ -243,3 +226,2 @@ const expected = `expected.length < ${value}`;

}
__name(arrayLengthLt, "arrayLengthLt");
function arrayLengthLe(value) {

@@ -249,3 +231,2 @@ const expected = `expected.length <= ${value}`;

}
__name(arrayLengthLe, "arrayLengthLe");
function arrayLengthGt(value) {

@@ -255,3 +236,2 @@ const expected = `expected.length > ${value}`;

}
__name(arrayLengthGt, "arrayLengthGt");
function arrayLengthGe(value) {

@@ -261,3 +241,2 @@ const expected = `expected.length >= ${value}`;

}
__name(arrayLengthGe, "arrayLengthGe");
function arrayLengthEq(value) {

@@ -267,3 +246,2 @@ const expected = `expected.length === ${value}`;

}
__name(arrayLengthEq, "arrayLengthEq");
function arrayLengthNe(value) {

@@ -273,3 +251,2 @@ const expected = `expected.length !== ${value}`;

}
__name(arrayLengthNe, "arrayLengthNe");
function arrayLengthRange(start, endBefore) {

@@ -283,3 +260,2 @@ const expected = `expected.length >= ${start} && expected.length < ${endBefore}`;

}
__name(arrayLengthRange, "arrayLengthRange");
function arrayLengthRangeInclusive(start, end) {

@@ -293,3 +269,2 @@ const expected = `expected.length >= ${start} && expected.length <= ${end}`;

}
__name(arrayLengthRangeInclusive, "arrayLengthRangeInclusive");
function arrayLengthRangeExclusive(startAfter, endBefore) {

@@ -303,3 +278,2 @@ const expected = `expected.length > ${startAfter} && expected.length < ${endBefore}`;

}
__name(arrayLengthRangeExclusive, "arrayLengthRangeExclusive");

@@ -339,3 +313,2 @@ // src/lib/errors/CombinedPropertyError.ts

};
__name(CombinedPropertyError, "CombinedPropertyError");

@@ -375,3 +348,2 @@ // src/lib/errors/ValidationError.ts

};
__name(ValidationError, "ValidationError");

@@ -430,3 +402,2 @@ // src/validators/ArrayValidator.ts

};
__name(ArrayValidator, "ArrayValidator");

@@ -441,3 +412,2 @@ // src/constraints/BigIntConstraints.ts

}
__name(bigintComparator, "bigintComparator");
function bigintLt(value) {

@@ -447,3 +417,2 @@ const expected = `expected < ${value}n`;

}
__name(bigintLt, "bigintLt");
function bigintLe(value) {

@@ -453,3 +422,2 @@ const expected = `expected <= ${value}n`;

}
__name(bigintLe, "bigintLe");
function bigintGt(value) {

@@ -459,3 +427,2 @@ const expected = `expected > ${value}n`;

}
__name(bigintGt, "bigintGt");
function bigintGe(value) {

@@ -465,3 +432,2 @@ const expected = `expected >= ${value}n`;

}
__name(bigintGe, "bigintGe");
function bigintEq(value) {

@@ -471,3 +437,2 @@ const expected = `expected === ${value}n`;

}
__name(bigintEq, "bigintEq");
function bigintNe(value) {

@@ -477,3 +442,2 @@ const expected = `expected !== ${value}n`;

}
__name(bigintNe, "bigintNe");
function bigintDivisibleBy(divider) {

@@ -487,3 +451,2 @@ const expected = `expected % ${divider}n === 0n`;

}
__name(bigintDivisibleBy, "bigintDivisibleBy");

@@ -532,3 +495,2 @@ // src/validators/BigIntValidator.ts

};
__name(BigIntValidator, "BigIntValidator");

@@ -565,3 +527,2 @@ // src/constraints/BooleanConstraints.ts

};
__name(BooleanValidator, "BooleanValidator");

@@ -576,3 +537,2 @@ // src/constraints/DateConstraints.ts

}
__name(dateComparator, "dateComparator");
function dateLt(value) {

@@ -582,3 +542,2 @@ const expected = `expected < ${value.toISOString()}`;

}
__name(dateLt, "dateLt");
function dateLe(value) {

@@ -588,3 +547,2 @@ const expected = `expected <= ${value.toISOString()}`;

}
__name(dateLe, "dateLe");
function dateGt(value) {

@@ -594,3 +552,2 @@ const expected = `expected > ${value.toISOString()}`;

}
__name(dateGt, "dateGt");
function dateGe(value) {

@@ -600,3 +557,2 @@ const expected = `expected >= ${value.toISOString()}`;

}
__name(dateGe, "dateGe");
function dateEq(value) {

@@ -606,3 +562,2 @@ const expected = `expected === ${value.toISOString()}`;

}
__name(dateEq, "dateEq");
function dateNe(value) {

@@ -612,3 +567,2 @@ const expected = `expected !== ${value.toISOString()}`;

}
__name(dateNe, "dateNe");
var dateInvalid = {

@@ -657,3 +611,2 @@ run(input) {

};
__name(DateValidator, "DateValidator");

@@ -697,3 +650,2 @@ // src/lib/errors/ExpectedValidationError.ts

};
__name(ExpectedValidationError, "ExpectedValidationError");

@@ -713,3 +665,2 @@ // src/validators/InstanceValidator.ts

};
__name(InstanceValidator, "InstanceValidator");

@@ -729,3 +680,2 @@ // src/validators/LiteralValidator.ts

};
__name(LiteralValidator, "LiteralValidator");

@@ -738,3 +688,2 @@ // src/validators/NeverValidator.ts

};
__name(NeverValidator, "NeverValidator");

@@ -747,3 +696,2 @@ // src/validators/NullishValidator.ts

};
__name(NullishValidator, "NullishValidator");

@@ -758,3 +706,2 @@ // src/constraints/NumberConstraints.ts

}
__name(numberComparator, "numberComparator");
function numberLt(value) {

@@ -764,3 +711,2 @@ const expected = `expected < ${value}`;

}
__name(numberLt, "numberLt");
function numberLe(value) {

@@ -770,3 +716,2 @@ const expected = `expected <= ${value}`;

}
__name(numberLe, "numberLe");
function numberGt(value) {

@@ -776,3 +721,2 @@ const expected = `expected > ${value}`;

}
__name(numberGt, "numberGt");
function numberGe(value) {

@@ -782,3 +726,2 @@ const expected = `expected >= ${value}`;

}
__name(numberGe, "numberGe");
function numberEq(value) {

@@ -788,3 +731,2 @@ const expected = `expected === ${value}`;

}
__name(numberEq, "numberEq");
function numberNe(value) {

@@ -794,3 +736,2 @@ const expected = `expected !== ${value}`;

}
__name(numberNe, "numberNe");
var numberInt = {

@@ -829,3 +770,2 @@ run(input) {

}
__name(numberDivisibleBy, "numberDivisibleBy");

@@ -895,3 +835,2 @@ // src/validators/NumberValidator.ts

};
__name(NumberValidator, "NumberValidator");

@@ -921,3 +860,2 @@ // src/lib/errors/MissingPropertyError.ts

};
__name(MissingPropertyError, "MissingPropertyError");

@@ -957,3 +895,2 @@ // src/lib/errors/UnknownPropertyError.ts

};
__name(UnknownPropertyError, "UnknownPropertyError");

@@ -1067,3 +1004,2 @@ // src/validators/ObjectValidator.ts

};
__name(ObjectValidator, "ObjectValidator");
var ObjectValidatorStrategy = /* @__PURE__ */ ((ObjectValidatorStrategy2) => {

@@ -1082,3 +1018,2 @@ ObjectValidatorStrategy2[ObjectValidatorStrategy2["Ignore"] = 0] = "Ignore";

};
__name(PassthroughValidator, "PassthroughValidator");

@@ -1113,3 +1048,2 @@ // src/validators/RecordValidator.ts

};
__name(RecordValidator, "RecordValidator");

@@ -1142,3 +1076,2 @@ // src/lib/errors/CombinedError.ts

};
__name(CombinedError, "CombinedError");

@@ -1170,3 +1103,2 @@ // src/validators/SetValidator.ts

};
__name(SetValidator, "SetValidator");

@@ -1204,3 +1136,2 @@ // src/constraints/StringConstraints.ts

}
__name(validateEmail, "validateEmail");
function validateEmailDomain(domain) {

@@ -1213,3 +1144,2 @@ try {

}
__name(validateEmailDomain, "validateEmailDomain");

@@ -1255,3 +1185,2 @@ // src/lib/errors/MultiplePossibilitiesConstraintError.ts

};
__name(MultiplePossibilitiesConstraintError, "MultiplePossibilitiesConstraintError");

@@ -1281,3 +1210,2 @@ // src/constraints/util/common/combinedResultFn.ts

}
__name(combinedErrorFn, "combinedErrorFn");

@@ -1293,11 +1221,8 @@ // src/constraints/util/urlValidators.ts

}
__name(createUrlValidators, "createUrlValidators");
function allowedProtocolsFn(allowedProtocols) {
return (input, url) => allowedProtocols.includes(url.protocol) ? null : new MultiplePossibilitiesConstraintError("s.string.url", "Invalid URL protocol", input, allowedProtocols);
}
__name(allowedProtocolsFn, "allowedProtocolsFn");
function allowedDomainsFn(allowedDomains) {
return (input, url) => allowedDomains.includes(url.hostname) ? null : new MultiplePossibilitiesConstraintError("s.string.url", "Invalid URL domain", input, allowedDomains);
}
__name(allowedDomainsFn, "allowedDomainsFn");

@@ -1312,3 +1237,2 @@ // src/constraints/StringConstraints.ts

}
__name(stringLengthComparator, "stringLengthComparator");
function stringLengthLt(length) {

@@ -1318,3 +1242,2 @@ const expected = `expected.length < ${length}`;

}
__name(stringLengthLt, "stringLengthLt");
function stringLengthLe(length) {

@@ -1324,3 +1247,2 @@ const expected = `expected.length <= ${length}`;

}
__name(stringLengthLe, "stringLengthLe");
function stringLengthGt(length) {

@@ -1330,3 +1252,2 @@ const expected = `expected.length > ${length}`;

}
__name(stringLengthGt, "stringLengthGt");
function stringLengthGe(length) {

@@ -1336,3 +1257,2 @@ const expected = `expected.length >= ${length}`;

}
__name(stringLengthGe, "stringLengthGe");
function stringLengthEq(length) {

@@ -1342,3 +1262,2 @@ const expected = `expected.length === ${length}`;

}
__name(stringLengthEq, "stringLengthEq");
function stringLengthNe(length) {

@@ -1348,3 +1267,2 @@ const expected = `expected.length !== ${length}`;

}
__name(stringLengthNe, "stringLengthNe");
function stringEmail() {

@@ -1357,3 +1275,2 @@ return {

}
__name(stringEmail, "stringEmail");
function stringRegexValidator(type, expected, regex) {

@@ -1366,3 +1283,2 @@ return {

}
__name(stringRegexValidator, "stringRegexValidator");
function stringUrl(options) {

@@ -1385,3 +1301,2 @@ const validatorFn = createUrlValidators(options);

}
__name(stringUrl, "stringUrl");
function stringIp(version) {

@@ -1399,7 +1314,5 @@ const ipVersion = version ? `v${version}` : "";

}
__name(stringIp, "stringIp");
function stringRegex(regex) {
return stringRegexValidator("s.string.regex", `expected ${regex}.test(expected) to be true`, regex);
}
__name(stringRegex, "stringRegex");
function stringUuid({ version = 4, nullable = false } = {}) {

@@ -1411,3 +1324,2 @@ version ??= "1-5";

}
__name(stringUuid, "stringUuid");

@@ -1459,3 +1371,2 @@ // src/validators/StringValidator.ts

};
__name(StringValidator, "StringValidator");

@@ -1491,3 +1402,2 @@ // src/validators/TupleValidator.ts

};
__name(TupleValidator, "TupleValidator");

@@ -1560,3 +1470,2 @@ // src/validators/UnionValidator.ts

};
__name(UnionValidator, "UnionValidator");

@@ -1593,3 +1502,2 @@ // src/validators/MapValidator.ts

};
__name(MapValidator, "MapValidator");

@@ -1600,3 +1508,2 @@ // src/validators/util/getValue.ts

}
__name(getValue, "getValue");

@@ -1622,3 +1529,2 @@ // src/validators/DefaultValidator.ts

};
__name(DefaultValidator, "DefaultValidator");

@@ -1660,3 +1566,2 @@ // src/lib/errors/UnknownEnumValueError.ts

};
__name(UnknownEnumValueError, "UnknownEnumValueError");

@@ -1685,6 +1590,7 @@ // src/validators/NativeEnumValidator.ts

const typeOfValue = typeof value;
if (typeOfValue === "number" && !this.hasNumericElements) {
return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string", value));
}
if (typeOfValue !== "string" && typeOfValue !== "number") {
if (typeOfValue === "number") {
if (!this.hasNumericElements) {
return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string", value));
}
} else if (typeOfValue !== "string") {
return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string or number", value));

@@ -1700,3 +1606,2 @@ }

};
__name(NativeEnumValidator, "NativeEnumValidator");

@@ -1774,3 +1679,2 @@ // src/lib/Shapes.ts

};
__name(Shapes, "Shapes");

@@ -1777,0 +1681,0 @@ // src/index.ts

@@ -6,3 +6,2 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });

@@ -13,15 +12,11 @@ var __export = (target, all) => {

};
var __reExport = (target, module2, copyDefault, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return target;
return to;
};
var __toCommonJS = /* @__PURE__ */ ((cache) => {
return (module2, temp) => {
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
};
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

@@ -43,2 +38,3 @@ // src/index.ts

});
module.exports = __toCommonJS(src_exports);

@@ -73,3 +69,2 @@ // src/lib/Result.ts

};
__name(Result, "Result");

@@ -129,3 +124,2 @@ // src/validators/BaseValidator.ts

};
__name(BaseValidator, "BaseValidator");

@@ -144,3 +138,2 @@ // src/lib/errors/ExpectedConstraintError.ts

};
__name(BaseError, "BaseError");

@@ -155,3 +148,2 @@ // src/lib/errors/BaseConstraintError.ts

};
__name(BaseConstraintError, "BaseConstraintError");

@@ -193,3 +185,2 @@ // src/lib/errors/ExpectedConstraintError.ts

};
__name(ExpectedConstraintError, "ExpectedConstraintError");

@@ -200,23 +191,17 @@ // src/constraints/util/operators.ts

}
__name(lt, "lt");
function le(a, b) {
return a <= b;
}
__name(le, "le");
function gt(a, b) {
return a > b;
}
__name(gt, "gt");
function ge(a, b) {
return a >= b;
}
__name(ge, "ge");
function eq(a, b) {
return a === b;
}
__name(eq, "eq");
function ne(a, b) {
return a !== b;
}
__name(ne, "ne");

@@ -231,3 +216,2 @@ // src/constraints/ArrayLengthConstraints.ts

}
__name(arrayLengthComparator, "arrayLengthComparator");
function arrayLengthLt(value) {

@@ -237,3 +221,2 @@ const expected = `expected.length < ${value}`;

}
__name(arrayLengthLt, "arrayLengthLt");
function arrayLengthLe(value) {

@@ -243,3 +226,2 @@ const expected = `expected.length <= ${value}`;

}
__name(arrayLengthLe, "arrayLengthLe");
function arrayLengthGt(value) {

@@ -249,3 +231,2 @@ const expected = `expected.length > ${value}`;

}
__name(arrayLengthGt, "arrayLengthGt");
function arrayLengthGe(value) {

@@ -255,3 +236,2 @@ const expected = `expected.length >= ${value}`;

}
__name(arrayLengthGe, "arrayLengthGe");
function arrayLengthEq(value) {

@@ -261,3 +241,2 @@ const expected = `expected.length === ${value}`;

}
__name(arrayLengthEq, "arrayLengthEq");
function arrayLengthNe(value) {

@@ -267,3 +246,2 @@ const expected = `expected.length !== ${value}`;

}
__name(arrayLengthNe, "arrayLengthNe");
function arrayLengthRange(start, endBefore) {

@@ -277,3 +255,2 @@ const expected = `expected.length >= ${start} && expected.length < ${endBefore}`;

}
__name(arrayLengthRange, "arrayLengthRange");
function arrayLengthRangeInclusive(start, end) {

@@ -287,3 +264,2 @@ const expected = `expected.length >= ${start} && expected.length <= ${end}`;

}
__name(arrayLengthRangeInclusive, "arrayLengthRangeInclusive");
function arrayLengthRangeExclusive(startAfter, endBefore) {

@@ -297,3 +273,2 @@ const expected = `expected.length > ${startAfter} && expected.length < ${endBefore}`;

}
__name(arrayLengthRangeExclusive, "arrayLengthRangeExclusive");

@@ -333,3 +308,2 @@ // src/lib/errors/CombinedPropertyError.ts

};
__name(CombinedPropertyError, "CombinedPropertyError");

@@ -369,3 +343,2 @@ // src/lib/errors/ValidationError.ts

};
__name(ValidationError, "ValidationError");

@@ -424,3 +397,2 @@ // src/validators/ArrayValidator.ts

};
__name(ArrayValidator, "ArrayValidator");

@@ -435,3 +407,2 @@ // src/constraints/BigIntConstraints.ts

}
__name(bigintComparator, "bigintComparator");
function bigintLt(value) {

@@ -441,3 +412,2 @@ const expected = `expected < ${value}n`;

}
__name(bigintLt, "bigintLt");
function bigintLe(value) {

@@ -447,3 +417,2 @@ const expected = `expected <= ${value}n`;

}
__name(bigintLe, "bigintLe");
function bigintGt(value) {

@@ -453,3 +422,2 @@ const expected = `expected > ${value}n`;

}
__name(bigintGt, "bigintGt");
function bigintGe(value) {

@@ -459,3 +427,2 @@ const expected = `expected >= ${value}n`;

}
__name(bigintGe, "bigintGe");
function bigintEq(value) {

@@ -465,3 +432,2 @@ const expected = `expected === ${value}n`;

}
__name(bigintEq, "bigintEq");
function bigintNe(value) {

@@ -471,3 +437,2 @@ const expected = `expected !== ${value}n`;

}
__name(bigintNe, "bigintNe");
function bigintDivisibleBy(divider) {

@@ -481,3 +446,2 @@ const expected = `expected % ${divider}n === 0n`;

}
__name(bigintDivisibleBy, "bigintDivisibleBy");

@@ -526,3 +490,2 @@ // src/validators/BigIntValidator.ts

};
__name(BigIntValidator, "BigIntValidator");

@@ -559,3 +522,2 @@ // src/constraints/BooleanConstraints.ts

};
__name(BooleanValidator, "BooleanValidator");

@@ -570,3 +532,2 @@ // src/constraints/DateConstraints.ts

}
__name(dateComparator, "dateComparator");
function dateLt(value) {

@@ -576,3 +537,2 @@ const expected = `expected < ${value.toISOString()}`;

}
__name(dateLt, "dateLt");
function dateLe(value) {

@@ -582,3 +542,2 @@ const expected = `expected <= ${value.toISOString()}`;

}
__name(dateLe, "dateLe");
function dateGt(value) {

@@ -588,3 +547,2 @@ const expected = `expected > ${value.toISOString()}`;

}
__name(dateGt, "dateGt");
function dateGe(value) {

@@ -594,3 +552,2 @@ const expected = `expected >= ${value.toISOString()}`;

}
__name(dateGe, "dateGe");
function dateEq(value) {

@@ -600,3 +557,2 @@ const expected = `expected === ${value.toISOString()}`;

}
__name(dateEq, "dateEq");
function dateNe(value) {

@@ -606,3 +562,2 @@ const expected = `expected !== ${value.toISOString()}`;

}
__name(dateNe, "dateNe");
var dateInvalid = {

@@ -651,3 +606,2 @@ run(input) {

};
__name(DateValidator, "DateValidator");

@@ -691,3 +645,2 @@ // src/lib/errors/ExpectedValidationError.ts

};
__name(ExpectedValidationError, "ExpectedValidationError");

@@ -707,3 +660,2 @@ // src/validators/InstanceValidator.ts

};
__name(InstanceValidator, "InstanceValidator");

@@ -723,3 +675,2 @@ // src/validators/LiteralValidator.ts

};
__name(LiteralValidator, "LiteralValidator");

@@ -732,3 +683,2 @@ // src/validators/NeverValidator.ts

};
__name(NeverValidator, "NeverValidator");

@@ -741,3 +691,2 @@ // src/validators/NullishValidator.ts

};
__name(NullishValidator, "NullishValidator");

@@ -752,3 +701,2 @@ // src/constraints/NumberConstraints.ts

}
__name(numberComparator, "numberComparator");
function numberLt(value) {

@@ -758,3 +706,2 @@ const expected = `expected < ${value}`;

}
__name(numberLt, "numberLt");
function numberLe(value) {

@@ -764,3 +711,2 @@ const expected = `expected <= ${value}`;

}
__name(numberLe, "numberLe");
function numberGt(value) {

@@ -770,3 +716,2 @@ const expected = `expected > ${value}`;

}
__name(numberGt, "numberGt");
function numberGe(value) {

@@ -776,3 +721,2 @@ const expected = `expected >= ${value}`;

}
__name(numberGe, "numberGe");
function numberEq(value) {

@@ -782,3 +726,2 @@ const expected = `expected === ${value}`;

}
__name(numberEq, "numberEq");
function numberNe(value) {

@@ -788,3 +731,2 @@ const expected = `expected !== ${value}`;

}
__name(numberNe, "numberNe");
var numberInt = {

@@ -823,3 +765,2 @@ run(input) {

}
__name(numberDivisibleBy, "numberDivisibleBy");

@@ -889,3 +830,2 @@ // src/validators/NumberValidator.ts

};
__name(NumberValidator, "NumberValidator");

@@ -915,3 +855,2 @@ // src/lib/errors/MissingPropertyError.ts

};
__name(MissingPropertyError, "MissingPropertyError");

@@ -951,3 +890,2 @@ // src/lib/errors/UnknownPropertyError.ts

};
__name(UnknownPropertyError, "UnknownPropertyError");

@@ -1061,3 +999,2 @@ // src/validators/ObjectValidator.ts

};
__name(ObjectValidator, "ObjectValidator");
var ObjectValidatorStrategy = /* @__PURE__ */ ((ObjectValidatorStrategy2) => {

@@ -1076,3 +1013,2 @@ ObjectValidatorStrategy2[ObjectValidatorStrategy2["Ignore"] = 0] = "Ignore";

};
__name(PassthroughValidator, "PassthroughValidator");

@@ -1107,3 +1043,2 @@ // src/validators/RecordValidator.ts

};
__name(RecordValidator, "RecordValidator");

@@ -1136,3 +1071,2 @@ // src/lib/errors/CombinedError.ts

};
__name(CombinedError, "CombinedError");

@@ -1164,3 +1098,2 @@ // src/validators/SetValidator.ts

};
__name(SetValidator, "SetValidator");

@@ -1198,3 +1131,2 @@ // src/constraints/StringConstraints.ts

}
__name(validateEmail, "validateEmail");
function validateEmailDomain(domain) {

@@ -1207,3 +1139,2 @@ try {

}
__name(validateEmailDomain, "validateEmailDomain");

@@ -1249,3 +1180,2 @@ // src/lib/errors/MultiplePossibilitiesConstraintError.ts

};
__name(MultiplePossibilitiesConstraintError, "MultiplePossibilitiesConstraintError");

@@ -1275,3 +1205,2 @@ // src/constraints/util/common/combinedResultFn.ts

}
__name(combinedErrorFn, "combinedErrorFn");

@@ -1287,11 +1216,8 @@ // src/constraints/util/urlValidators.ts

}
__name(createUrlValidators, "createUrlValidators");
function allowedProtocolsFn(allowedProtocols) {
return (input, url) => allowedProtocols.includes(url.protocol) ? null : new MultiplePossibilitiesConstraintError("s.string.url", "Invalid URL protocol", input, allowedProtocols);
}
__name(allowedProtocolsFn, "allowedProtocolsFn");
function allowedDomainsFn(allowedDomains) {
return (input, url) => allowedDomains.includes(url.hostname) ? null : new MultiplePossibilitiesConstraintError("s.string.url", "Invalid URL domain", input, allowedDomains);
}
__name(allowedDomainsFn, "allowedDomainsFn");

@@ -1306,3 +1232,2 @@ // src/constraints/StringConstraints.ts

}
__name(stringLengthComparator, "stringLengthComparator");
function stringLengthLt(length) {

@@ -1312,3 +1237,2 @@ const expected = `expected.length < ${length}`;

}
__name(stringLengthLt, "stringLengthLt");
function stringLengthLe(length) {

@@ -1318,3 +1242,2 @@ const expected = `expected.length <= ${length}`;

}
__name(stringLengthLe, "stringLengthLe");
function stringLengthGt(length) {

@@ -1324,3 +1247,2 @@ const expected = `expected.length > ${length}`;

}
__name(stringLengthGt, "stringLengthGt");
function stringLengthGe(length) {

@@ -1330,3 +1252,2 @@ const expected = `expected.length >= ${length}`;

}
__name(stringLengthGe, "stringLengthGe");
function stringLengthEq(length) {

@@ -1336,3 +1257,2 @@ const expected = `expected.length === ${length}`;

}
__name(stringLengthEq, "stringLengthEq");
function stringLengthNe(length) {

@@ -1342,3 +1262,2 @@ const expected = `expected.length !== ${length}`;

}
__name(stringLengthNe, "stringLengthNe");
function stringEmail() {

@@ -1351,3 +1270,2 @@ return {

}
__name(stringEmail, "stringEmail");
function stringRegexValidator(type, expected, regex) {

@@ -1360,3 +1278,2 @@ return {

}
__name(stringRegexValidator, "stringRegexValidator");
function stringUrl(options) {

@@ -1379,3 +1296,2 @@ const validatorFn = createUrlValidators(options);

}
__name(stringUrl, "stringUrl");
function stringIp(version) {

@@ -1393,7 +1309,5 @@ const ipVersion = version ? `v${version}` : "";

}
__name(stringIp, "stringIp");
function stringRegex(regex) {
return stringRegexValidator("s.string.regex", `expected ${regex}.test(expected) to be true`, regex);
}
__name(stringRegex, "stringRegex");
function stringUuid({ version = 4, nullable = false } = {}) {

@@ -1405,3 +1319,2 @@ version ??= "1-5";

}
__name(stringUuid, "stringUuid");

@@ -1453,3 +1366,2 @@ // src/validators/StringValidator.ts

};
__name(StringValidator, "StringValidator");

@@ -1485,3 +1397,2 @@ // src/validators/TupleValidator.ts

};
__name(TupleValidator, "TupleValidator");

@@ -1554,3 +1465,2 @@ // src/validators/UnionValidator.ts

};
__name(UnionValidator, "UnionValidator");

@@ -1587,3 +1497,2 @@ // src/validators/MapValidator.ts

};
__name(MapValidator, "MapValidator");

@@ -1594,3 +1503,2 @@ // src/validators/util/getValue.ts

}
__name(getValue, "getValue");

@@ -1616,3 +1524,2 @@ // src/validators/DefaultValidator.ts

};
__name(DefaultValidator, "DefaultValidator");

@@ -1654,3 +1561,2 @@ // src/lib/errors/UnknownEnumValueError.ts

};
__name(UnknownEnumValueError, "UnknownEnumValueError");

@@ -1679,6 +1585,7 @@ // src/validators/NativeEnumValidator.ts

const typeOfValue = typeof value;
if (typeOfValue === "number" && !this.hasNumericElements) {
return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string", value));
}
if (typeOfValue !== "string" && typeOfValue !== "number") {
if (typeOfValue === "number") {
if (!this.hasNumericElements) {
return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string", value));
}
} else if (typeOfValue !== "string") {
return Result.err(new ValidationError("s.nativeEnum(T)", "Expected the value to be a string or number", value));

@@ -1694,3 +1601,2 @@ }

};
__name(NativeEnumValidator, "NativeEnumValidator");

@@ -1768,7 +1674,5 @@ // src/lib/Shapes.ts

};
__name(Shapes, "Shapes");
// src/index.ts
var s = new Shapes();
module.exports = __toCommonJS(src_exports);
// Annotate the CommonJS export names for ESM import in node:

@@ -1775,0 +1679,0 @@ 0 && (module.exports = {

26

package.json
{
"name": "@sapphire/shapeshift",
"version": "2.0.1-next.6087677.0",
"version": "2.0.1-next.48c30c6.0",
"description": "Blazing fast input validation and transformation ⚡",

@@ -34,15 +34,15 @@ "author": "@sapphire",

"devDependencies": {
"@commitlint/cli": "^16.2.1",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@favware/npm-deprecate": "^1.0.4",
"@favware/rollup-type-bundler": "^1.0.7",
"@sapphire/eslint-config": "^4.3.0",
"@sapphire/prettier-config": "^1.4.0",
"@sapphire/ts-config": "^3.3.2",
"@sapphire/eslint-config": "^4.3.3",
"@sapphire/prettier-config": "^1.4.2",
"@sapphire/ts-config": "^3.3.4",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.11.0",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",

@@ -53,11 +53,11 @@ "eslint-plugin-prettier": "^4.0.0",

"jest-circus": "^27.5.1",
"lint-staged": "^12.3.5",
"prettier": "^2.5.1",
"lint-staged": "^12.3.7",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"standard-version": "^9.3.2",
"ts-jest": "^27.1.3",
"tsup": "^5.12.1",
"ts-jest": "^27.1.4",
"tsup": "^5.12.3",
"typedoc": "^0.22.13",
"typedoc-plugin-mdn-links": "^1.0.5",
"typescript": "^4.6.2"
"typescript": "^4.6.3"
},

@@ -64,0 +64,0 @@ "repository": {

@@ -403,2 +403,6 @@ <div align="center">

---
_**Function validation is not yet implemented and will be made available starting v2.1.0**_
#### Functions // TODO

@@ -421,2 +425,4 @@

---
### BaseValidator: methods and properties

@@ -439,2 +445,6 @@

---
_**Reshape is not yet implemented and will be made available starting v2.1.0**_
> :warning: `.transform`'s functions **must not throw**. If a validation error is desired to be thrown, `.reshape` instead.

@@ -453,2 +463,4 @@

---
`.default(value: T | (() => T))`: transform `undefined` into the given value or the callback's returned value:

@@ -455,0 +467,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc