File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ export const makeOptions = (version: string): BuildOptions => ({
7272 version : "1.3.1" ,
7373 subPath : "number/is_positive_number.js" ,
7474 } ,
75+ "https://deno.land/x/isx@1.3.1/number/is_negative_number.ts" : {
76+ name : "@miyauci/isx" ,
77+ version : "1.3.1" ,
78+ subPath : "number/is_negative_number.js" ,
79+ } ,
7580 "https://deno.land/x/isx@1.3.1/date/is_valid_date.ts" : {
7681 name : "@miyauci/isx" ,
7782 version : "1.3.1" ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { OptionalValidator } from "./validators/object/optional.ts";
1212import { NullishValidator } from "./validators/nullish.ts" ;
1313import { IntegerValidator } from "./validators/number/integer.ts" ;
1414import { PositiveNumberValidator } from "./validators/number/positive_number.ts" ;
15+ import { NegativeNumberValidator } from "./validators/number/negative_number.ts" ;
1516import { PatternValidator } from "./validators/string/pattern.ts" ;
1617import { CountValidator } from "./validators/iterable/count.ts" ;
1718import { EmptyValidator } from "./validators/iterable/empty.ts" ;
@@ -127,6 +128,9 @@ export const unique = /* @__PURE__ */ new UniqueValidator().expect(({ item }) =>
127128
128129// number
129130export const int = /* @__PURE__ */ new IntegerValidator ( ) . expect ( shouldBeBut ) ;
131+ export const negative = /* @__PURE__ */ new NegativeNumberValidator ( ) . expect (
132+ shouldBeBut ,
133+ ) ;
130134export const positive = /* @__PURE__ */ new PositiveNumberValidator ( )
131135 . expect ( shouldBeBut ) ;
132136
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export { isSingle } from "https://deno.land/x/isx@1.3.1/iterable/is_single.ts";
77export { isNonNullable } from "https://deno.land/x/isx@1.3.1/is_non_nullable.ts" ;
88export { isString } from "https://deno.land/x/isx@1.3.1/is_string.ts" ;
99export { isPositiveNumber } from "https://deno.land/x/isx@1.3.1/number/is_positive_number.ts" ;
10+ export { isNegativeNumber } from "https://deno.land/x/isx@1.3.1/number/is_negative_number.ts" ;
1011export { isValidDate } from "https://deno.land/x/isx@1.3.1/date/is_valid_date.ts" ;
1112export { filterKeys } from "https://deno.land/std@0.187.0/collections/filter_keys.ts" ;
1213export { default as escapeStringRegex } from "https://esm.sh/escape-string-regexp@5.0.0?pin=v122" ;
Original file line number Diff line number Diff line change 1+ // Copyright 2023-latest Tomoki Miyauchi. All rights reserved. MIT license.
2+ // This module is browser compatible.
3+
4+ import { ScalarValidator } from "../../utils.ts" ;
5+ import { isNegativeNumber , ToPredicate } from "../../deps.ts" ;
6+
7+ export class NegativeNumberValidator extends ScalarValidator < number > {
8+ is = isNegativeNumber as ToPredicate < typeof isNegativeNumber > ;
9+
10+ override toString ( ) {
11+ return "negative number" ;
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments