@effect/schema
Advanced tools
Comparing version 0.19.0 to 0.19.1
{ | ||
"name": "@effect/schema", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -753,5 +753,29 @@ /** | ||
/** | ||
* @category type id | ||
* @since 1.0.0 | ||
*/ | ||
export declare const JsonNumberTypeId = "@effect/schema/JsonNumberTypeId"; | ||
/** | ||
* The `JsonNumber` is a schema for representing JSON numbers. It ensures that the provided value is a valid | ||
* number by filtering out `NaN` and `(+/-) Infinity`. This is useful when you want to validate and represent numbers in JSON | ||
* format. | ||
* | ||
* @example | ||
* import * as S from "@effect/schema/Schema" | ||
* | ||
* const is = S.is(S.JsonNumber) | ||
* | ||
* assert.deepStrictEqual(is(42), true) | ||
* assert.deepStrictEqual(is(Number.NaN), false) | ||
* assert.deepStrictEqual(is(Number.POSITIVE_INFINITY), false) | ||
* assert.deepStrictEqual(is(Number.NEGATIVE_INFINITY), false) | ||
* | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
export declare const JsonNumber: Schema<number, number>; | ||
/** | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
export declare const json: Schema<Json>; | ||
@@ -758,0 +782,0 @@ /** |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.array = exports.any = exports.annotations = exports.ValidDateTypeId = exports.ValidDateFromSelf = exports.UUIDTypeId = exports.UUID = exports.TrimmedTypeId = exports.Trim = exports.StartsWithTypeId = exports.PositiveTypeId = exports.PositiveBigintTypeId = exports.PatternTypeId = exports.NumberFromString = exports.NonPositiveTypeId = exports.NonPositiveBigintTypeId = exports.NonNegativeTypeId = exports.NonNegativeBigintTypeId = exports.NonNaNTypeId = exports.NegativeTypeId = exports.NegativeBigintTypeId = exports.MultipleOfTypeId = exports.MinLengthTypeId = exports.MinItemsTypeId = exports.MaxLengthTypeId = exports.MaxItemsTypeId = exports.LessThanTypeId = exports.LessThanOrEqualToTypeId = exports.LessThanOrEqualToBigintTypeId = exports.LessThanBigintTypeId = exports.ItemsCountTypeId = exports.IntTypeId = exports.InstanceOfTypeId = exports.IncludesTypeId = exports.GreaterThanTypeId = exports.GreaterThanOrEqualToTypeId = exports.GreaterThanOrEqualToBigintTypeId = exports.GreaterThanBigintTypeId = exports.FiniteTypeId = exports.EndsWithTypeId = exports.DateFromSelf = exports.Date = exports.BrandTypeId = exports.BetweenTypeId = exports.BetweenBigintTypeId = void 0; | ||
exports.array = exports.any = exports.annotations = exports.ValidDateTypeId = exports.ValidDateFromSelf = exports.UUIDTypeId = exports.UUID = exports.TrimmedTypeId = exports.Trim = exports.StartsWithTypeId = exports.PositiveTypeId = exports.PositiveBigintTypeId = exports.PatternTypeId = exports.NumberFromString = exports.NonPositiveTypeId = exports.NonPositiveBigintTypeId = exports.NonNegativeTypeId = exports.NonNegativeBigintTypeId = exports.NonNaNTypeId = exports.NegativeTypeId = exports.NegativeBigintTypeId = exports.MultipleOfTypeId = exports.MinLengthTypeId = exports.MinItemsTypeId = exports.MaxLengthTypeId = exports.MaxItemsTypeId = exports.LessThanTypeId = exports.LessThanOrEqualToTypeId = exports.LessThanOrEqualToBigintTypeId = exports.LessThanBigintTypeId = exports.JsonNumberTypeId = exports.JsonNumber = exports.ItemsCountTypeId = exports.IntTypeId = exports.InstanceOfTypeId = exports.IncludesTypeId = exports.GreaterThanTypeId = exports.GreaterThanOrEqualToTypeId = exports.GreaterThanOrEqualToBigintTypeId = exports.GreaterThanBigintTypeId = exports.FiniteTypeId = exports.EndsWithTypeId = exports.DateFromSelf = exports.Date = exports.BrandTypeId = exports.BetweenTypeId = exports.BetweenBigintTypeId = void 0; | ||
Object.defineProperty(exports, "asserts", { | ||
@@ -97,4 +97,4 @@ enumerable: true, | ||
}); | ||
exports.lessThan = exports.length = exports.lazy = exports.keyof = exports.json = exports.itemsCount = void 0; | ||
exports.optionalElement = exports.optional = exports.optionFromSelf = exports.optionFromNullable = exports.option = exports.omit = exports.object = exports.numberFromString = exports.number = exports.nullable = exports.null = exports.not = exports.nonPositiveBigint = exports.nonPositive = exports.nonNegativeBigint = exports.nonNegative = exports.nonNaN = exports.nonEmptyArray = exports.nonEmpty = exports.never = exports.negativeBigint = exports.negative = exports.multipleOf = exports.minLength = exports.minItems = exports.message = exports.maxLength = exports.maxItems = exports.make = exports.literal = exports.lessThanOrEqualToBigint = exports.lessThanOrEqualTo = exports.lessThanBigint = void 0; | ||
exports.lazy = exports.keyof = exports.json = exports.itemsCount = void 0; | ||
exports.optionalElement = exports.optional = exports.optionFromSelf = exports.optionFromNullable = exports.option = exports.omit = exports.object = exports.numberFromString = exports.number = exports.nullable = exports.null = exports.not = exports.nonPositiveBigint = exports.nonPositive = exports.nonNegativeBigint = exports.nonNegative = exports.nonNaN = exports.nonEmptyArray = exports.nonEmpty = exports.never = exports.negativeBigint = exports.negative = exports.multipleOf = exports.minLength = exports.minItems = exports.message = exports.maxLength = exports.maxItems = exports.make = exports.literal = exports.lessThanOrEqualToBigint = exports.lessThanOrEqualTo = exports.lessThanBigint = exports.lessThan = exports.length = void 0; | ||
Object.defineProperty(exports, "parse", { | ||
@@ -1154,6 +1154,35 @@ enumerable: true, | ||
/** | ||
* @category type id | ||
* @since 1.0.0 | ||
*/ | ||
const JsonNumberTypeId = "@effect/schema/JsonNumberTypeId"; | ||
/** | ||
* The `JsonNumber` is a schema for representing JSON numbers. It ensures that the provided value is a valid | ||
* number by filtering out `NaN` and `(+/-) Infinity`. This is useful when you want to validate and represent numbers in JSON | ||
* format. | ||
* | ||
* @example | ||
* import * as S from "@effect/schema/Schema" | ||
* | ||
* const is = S.is(S.JsonNumber) | ||
* | ||
* assert.deepStrictEqual(is(42), true) | ||
* assert.deepStrictEqual(is(Number.NaN), false) | ||
* assert.deepStrictEqual(is(Number.POSITIVE_INFINITY), false) | ||
* assert.deepStrictEqual(is(Number.NEGATIVE_INFINITY), false) | ||
* | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
const json = /*#__PURE__*/lazy(() => union(_null, string, number, boolean, array(json), record(string, json)), { | ||
exports.JsonNumberTypeId = JsonNumberTypeId; | ||
const JsonNumber = /*#__PURE__*/(0, _Function.pipe)(number, /*#__PURE__*/filter(n => !isNaN(n) && isFinite(n), { | ||
typeId: JsonNumberTypeId, | ||
description: "a JSON number" | ||
})); | ||
/** | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
exports.JsonNumber = JsonNumber; | ||
const json = /*#__PURE__*/lazy(() => union(_null, string, JsonNumber, boolean, array(json), record(string, json)), { | ||
[I.ArbitraryHookId]: () => arbitraryJson | ||
@@ -1160,0 +1189,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
Sorry, the diff of this file is too big to display
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
919250
17511