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

@miyauci/isx

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@miyauci/isx - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0-beta.1

esm/number/is_positive_integer.js

2

esm/number/is_negative_number.js

@@ -12,2 +12,4 @@ // Copyright 2023-latest Tomoki Miyauchi. All rights reserved. MIT license.

* ```
*
* @deprecated use numeric::isNegativeNumber
*/

@@ -14,0 +16,0 @@ export function isNegativeNumber(input) {

@@ -15,2 +15,4 @@ // Copyright 2023-latest Tomoki Miyauchi. All rights reserved. MIT license.

* ```
*
* @deprecated use numeric::isNonNegativeNumber
*/

@@ -17,0 +19,0 @@ export function isNonNegativeNumber(input) {

@@ -15,2 +15,4 @@ // Copyright 2023-latest Tomoki Miyauchi. All rights reserved. MIT license.

* ```
*
* @deprecated use numeric::isNonPositiveNumber
*/

@@ -17,0 +19,0 @@ export function isNonPositiveNumber(input) {

@@ -10,4 +10,7 @@ // Copyright 2023-latest Tomoki Miyauchi. All rights reserved. MIT license.

* assertEquals(isPositiveNumber(1), true)
* assertEquals(isPositiveNumber(Infinity), true);
* assertEquals(isPositiveNumber(0), false)
* ```
*
* @deprecated use numeric::isPositiveNumber
*/

@@ -14,0 +17,0 @@ export function isPositiveNumber(input) {

@@ -14,2 +14,4 @@ // Copyright 2023-latest Tomoki Miyauchi. All rights reserved. MIT license.

* ```
*
* @deprecated use numeric::isUnitInterval
*/

@@ -16,0 +18,0 @@ export function isUnitInterval(input) {

{
"name": "@miyauci/isx",
"version": "1.3.1",
"version": "1.4.0-beta.1",
"description": "Collection of validation functions for JavaScript data",

@@ -121,2 +121,5 @@ "license": "MIT",

],
"number/is_positive_integer.js": [
"types/number/is_positive_integer.d.ts"
],
"number/is_positive_number.js": [

@@ -127,2 +130,17 @@ "types/number/is_positive_number.d.ts"

"types/number/is_unit_interval.d.ts"
],
"numeric/is_negative_number.js": [
"types/numeric/is_negative_number.d.ts"
],
"numeric/is_non_negative_number.js": [
"types/numeric/is_non_negative_number.d.ts"
],
"numeric/is_non_positive_number.js": [
"types/numeric/is_non_positive_number.d.ts"
],
"numeric/is_positive_number.js": [
"types/numeric/is_positive_number.d.ts"
],
"numeric/is_unit_interval.js": [
"types/numeric/is_unit_interval.d.ts"
]

@@ -277,2 +295,7 @@ }

},
"./number/is_positive_integer.js": {
"import": "./esm/number/is_positive_integer.js",
"require": "./script/number/is_positive_integer.js",
"types": "./types/number/is_positive_integer.d.ts"
},
"./number/is_positive_number.js": {

@@ -287,4 +310,29 @@ "import": "./esm/number/is_positive_number.js",

"types": "./types/number/is_unit_interval.d.ts"
},
"./numeric/is_negative_number.js": {
"import": "./esm/numeric/is_negative_number.js",
"require": "./script/numeric/is_negative_number.js",
"types": "./types/numeric/is_negative_number.d.ts"
},
"./numeric/is_non_negative_number.js": {
"import": "./esm/numeric/is_non_negative_number.js",
"require": "./script/numeric/is_non_negative_number.js",
"types": "./types/numeric/is_non_negative_number.d.ts"
},
"./numeric/is_non_positive_number.js": {
"import": "./esm/numeric/is_non_positive_number.js",
"require": "./script/numeric/is_non_positive_number.js",
"types": "./types/numeric/is_non_positive_number.d.ts"
},
"./numeric/is_positive_number.js": {
"import": "./esm/numeric/is_positive_number.js",
"require": "./script/numeric/is_positive_number.js",
"types": "./types/numeric/is_positive_number.d.ts"
},
"./numeric/is_unit_interval.js": {
"import": "./esm/numeric/is_unit_interval.js",
"require": "./script/numeric/is_unit_interval.js",
"types": "./types/numeric/is_unit_interval.d.ts"
}
}
}

138

README.md

@@ -315,86 +315,119 @@ # isx

## Number subtypes
## Numeric subtypes
Validates a subtype of `number`. All validate functions must satisfy ⊂ `number`.
Validates a subtype of `number` or `bigint`.
### isOdd
### isPositiveNumber
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_odd.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_odd.ts)
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/numeric/is_positive_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumeric%2Fis_positive_number.ts)
Whether the input is odd or not.
Whether the input is positive number or not.
```ts
import { isOdd } from "https://deno.land/x/isx@$VERSION/number/is_odd.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(isOdd(1), true);
assertEquals(isOdd(0), false);
import { isPositiveNumber } from "https://deno.land/x/isx@$VERSION/numeric/is_positive_number.ts";
import { assert, assertFalse } from "https://deno.land/std/testing/asserts.ts";
assert(isPositiveNumber(1));
assert(isPositiveNumber(Infinity));
assertFalse(isPositiveNumber(0));
```
### isEven
### isNonPositiveNumber
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_even.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_even.ts)
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/numeric/is_non_positive_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumeric%2Fis_non_positive_number.ts)
Whether the input is even or not.
Whether the input is non-positive number or not. Non-positive number means less
than or equal to zero.
```ts
import { isEven } from "https://deno.land/x/isx@$VERSION/number/is_even.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(isEven(0), true);
assertEquals(isEven(1), false);
import { isNonPositiveNumber } from "https://deno.land/x/isx@$VERSION/numeric/is_non_positive_number.ts";
import { assert, assertFalse } from "https://deno.land/std/testing/asserts.ts";
assert(isNonPositiveNumber(0));
assert(isNonPositiveNumber(-1));
assertFalse(isNonPositiveNumber(1));
```
### isPositiveNumber
### isNegativeNumber
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_positive_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_positive_number.ts)
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/numeric/is_negative_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumeric%2Fis_negative_number.ts)
Whether the input is positive number or not.
Whether the input is negative number or not.
```ts
import { isPositiveNumber } from "https://deno.land/x/isx@$VERSION/number/is_positive_number.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(isPositiveNumber(1), true);
assertEquals(isPositiveNumber(0), false);
import { isNegativeNumber } from "https://deno.land/x/isx@$VERSION/numeric/is_negative_number.ts";
import { assert, assertFalse } from "https://deno.land/std/testing/asserts.ts";
assert(isNegativeNumber(-1));
assertFalse(isNegativeNumber(0));
```
### isNonPositiveNumber
### isNonNegativeNumber
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_non_positive_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_non_positive_number.ts)
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/numeric/is_non_negative_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumeric%2Fis_non_negative_number.ts)
Whether the input is non-positive number or not. Non-positive number means less
than or equal to zero.
Whether the input is non-negative number or not. Non-negative number means
greater than or equal to zero.
```ts
import { isNonPositiveNumber } from "https://deno.land/x/isx@$VERSION/number/is_non_positive_number.ts";
import { isNonNegativeNumber } from "https://deno.land/x/isx@$VERSION/numeric/is_non_negative_number.ts";
import { assert, assertFalse } from "https://deno.land/std/testing/asserts.ts";
assert(isNonNegativeNumber(0));
assert(isNonNegativeNumber(1));
assertFalse(isNonNegativeNumber(-1));
```
### isUnitInterval
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/numeric/is_unit_interval.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumeric%2Fis_unit_interval.ts)
Whether the input is unit interval or not. The unit interval refers to the
interval between 0 and 1 on the real number line.
```ts
import { isUnitInterval } from "https://deno.land/x/isx@$VERSION/numeric/is_unit_interval.ts";
import { assert, assertFalse } from "https://deno.land/std/testing/asserts.ts";
assert(isUnitInterval(0));
assert(isUnitInterval(1.0));
assertFalse(isUnitInterval(-1));
```
## Number subtypes
Validates a subtype of `number`. All validate functions must satisfy ⊂ `number`.
### isOdd
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_odd.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_odd.ts)
Whether the input is odd or not.
```ts
import { isOdd } from "https://deno.land/x/isx@$VERSION/number/is_odd.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(isNonPositiveNumber(0), true);
assertEquals(isNonPositiveNumber(-1), true);
assertEquals(isNonPositiveNumber(1), false);
assertEquals(isOdd(1), true);
assertEquals(isOdd(0), false);
```
### isNegativeNumber
### isEven
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_negative_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_negative_number.ts)
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_even.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_even.ts)
Whether the input is negative number or not.
Whether the input is even or not.
```ts
import { isNegativeNumber } from "https://deno.land/x/isx@$VERSION/number/is_negative_number.ts";
import { isEven } from "https://deno.land/x/isx@$VERSION/number/is_even.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(isNegativeNumber(-1), true);
assertEquals(isNegativeNumber(0), false);
assertEquals(isEven(0), true);
assertEquals(isEven(1), false);
```
### isNonNegativeNumber
### isPositiveInteger
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_non_negative_number.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_non_negative_number.ts)
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_positive_integer.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_positive_integer.ts)
Whether the input is non-negative number or not. Non-negative number means
greater than or equal to zero.
Whether the input is positive integer or not.
```ts
import { isNonNegativeNumber } from "https://deno.land/x/isx@$VERSION/number/is_non_negative_number.ts";
import { isPositiveInteger } from "https://deno.land/x/isx@$VERSION/number/is_positive_integer.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(isNonNegativeNumber(0), true);
assertEquals(isNonNegativeNumber(1), true);
assertEquals(isNonNegativeNumber(-1), false);
assertEquals(isPositiveInteger(1), true);
assertEquals(isPositiveInteger(0), false);
```

@@ -416,17 +449,2 @@

### isUnitInterval
[![badge](https://deno.bundlejs.com/?q=https://deno.land/x/isx/number/is_unit_interval.ts&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fisx%2Fnumber%2Fis_unit_interval.ts)
Whether the input is unit interval or not. The unit interval refers to the
interval between 0 and 1 on the real number line.
```ts
import { isUnitInterval } from "https://deno.land/x/isx@$VERSION/number/is_unit_interval.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(isUnitInterval(0), true);
assertEquals(isUnitInterval(1.0), true);
assertEquals(isUnitInterval(-1), false);
```
## Iterable subtypes

@@ -433,0 +451,0 @@

@@ -15,2 +15,4 @@ "use strict";

* ```
*
* @deprecated use numeric::isNegativeNumber
*/

@@ -17,0 +19,0 @@ function isNegativeNumber(input) {

@@ -18,2 +18,4 @@ "use strict";

* ```
*
* @deprecated use numeric::isNonNegativeNumber
*/

@@ -20,0 +22,0 @@ function isNonNegativeNumber(input) {

@@ -18,2 +18,4 @@ "use strict";

* ```
*
* @deprecated use numeric::isNonPositiveNumber
*/

@@ -20,0 +22,0 @@ function isNonPositiveNumber(input) {

@@ -13,4 +13,7 @@ "use strict";

* assertEquals(isPositiveNumber(1), true)
* assertEquals(isPositiveNumber(Infinity), true);
* assertEquals(isPositiveNumber(0), false)
* ```
*
* @deprecated use numeric::isPositiveNumber
*/

@@ -17,0 +20,0 @@ function isPositiveNumber(input) {

@@ -17,2 +17,4 @@ "use strict";

* ```
*
* @deprecated use numeric::isUnitInterval
*/

@@ -19,0 +21,0 @@ function isUnitInterval(input) {

@@ -10,3 +10,5 @@ /** Whether the input is negative number or not.

* ```
*
* @deprecated use numeric::isNegativeNumber
*/
export declare function isNegativeNumber(input: number): boolean;

@@ -12,3 +12,5 @@ /** Whether the input is non-negative number or not.

* ```
*
* @deprecated use numeric::isNonNegativeNumber
*/
export declare function isNonNegativeNumber(input: number): boolean;

@@ -12,3 +12,5 @@ /** Whether the input is non-positive number or not.

* ```
*
* @deprecated use numeric::isNonPositiveNumber
*/
export declare function isNonPositiveNumber(input: number): boolean;

@@ -8,5 +8,8 @@ /** Whether the input is positive number or not.

* assertEquals(isPositiveNumber(1), true)
* assertEquals(isPositiveNumber(Infinity), true);
* assertEquals(isPositiveNumber(0), false)
* ```
*
* @deprecated use numeric::isPositiveNumber
*/
export declare function isPositiveNumber(input: number): boolean;

@@ -12,3 +12,5 @@ /** Whether the input is unit interval or not.

* ```
*
* @deprecated use numeric::isUnitInterval
*/
export declare function isUnitInterval(input: number): boolean;
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