Comparing version 1.1.0 to 1.2.0
@@ -7,2 +7,3 @@ export { above } from './generics/above'; | ||
export { either } from './generics/either'; | ||
export { has } from './generics/has'; | ||
export { instance } from './generics/instance'; | ||
@@ -12,3 +13,6 @@ export { literal } from './generics/literal'; | ||
export { min } from './generics/min'; | ||
export { noneable } from './generics/noneable'; | ||
export { nullable } from './generics/nullable'; | ||
export { object } from './generics/object'; | ||
export { optional } from './generics/optional'; | ||
export { or } from './generics/or'; | ||
@@ -15,0 +19,0 @@ export { record } from './generics/record'; |
@@ -15,2 +15,4 @@ "use strict"; | ||
exports.either = either_1.either; | ||
var has_1 = require("./generics/has"); | ||
exports.has = has_1.has; | ||
var instance_1 = require("./generics/instance"); | ||
@@ -24,4 +26,10 @@ exports.instance = instance_1.instance; | ||
exports.min = min_1.min; | ||
var noneable_1 = require("./generics/noneable"); | ||
exports.noneable = noneable_1.noneable; | ||
var nullable_1 = require("./generics/nullable"); | ||
exports.nullable = nullable_1.nullable; | ||
var object_1 = require("./generics/object"); | ||
exports.object = object_1.object; | ||
var optional_1 = require("./generics/optional"); | ||
exports.optional = optional_1.optional; | ||
var or_1 = require("./generics/or"); | ||
@@ -28,0 +36,0 @@ exports.or = or_1.or; |
import { Constructor } from '../types'; | ||
export declare const instance: <T extends Constructor<any>>(constructor: T) => (value: any) => value is InstanceType<T>; | ||
export declare const instance: <T extends Constructor<any>>(constructor: T) => (value: unknown) => value is InstanceType<T>; |
@@ -1,1 +0,1 @@ | ||
export declare const test: (expression: RegExp) => (value: any) => value is string; | ||
export declare const test: (expression: RegExp) => (value: unknown) => value is string; |
import { Predicate } from '../types'; | ||
export declare const tuple: <T extends any[]>(...predicates: { [K in keyof T]: Predicate<T[K]>; }) => (value: any) => value is { [K_1 in keyof T]: T[K_1]; }; | ||
export declare const tuple: <T extends any[]>(...predicates: { [K in keyof T]: Predicate<T[K]>; }) => (value: unknown) => value is { [K_1 in keyof T]: T[K_1]; }; |
@@ -9,3 +9,3 @@ declare type ObjectWith<K extends PropertyKey> = { | ||
}; | ||
export declare type Intersect<T> = (T extends any ? (k: T) => void : never) extends ((k: infer I) => void) ? I : never; | ||
export declare type Intersect<T> = (T extends any ? (k: T) => void : never) extends (k: infer I) => void ? I : never; | ||
export declare type None = null | undefined; | ||
@@ -15,4 +15,3 @@ export declare type Some = Function | boolean | bigint | number | string | symbol | object; | ||
export declare type Primitive = null | undefined | boolean | number | string | symbol | bigint; | ||
export interface SerializableArray<T extends Serializable> extends Array<T> { | ||
} | ||
export declare type SerializableArray = Array<Serializable>; | ||
export declare type SerializablePrimitive = null | boolean | number | string; | ||
@@ -22,3 +21,3 @@ export declare type SerializableObject = { | ||
}; | ||
export declare type Serializable = SerializablePrimitive | SerializableObject | SerializableArray<any>; | ||
export declare type Serializable = SerializablePrimitive | SerializableObject | SerializableArray; | ||
export {}; |
{ | ||
"name": "isntnt", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A collection of composable JavaScript runtime type predicates with TypeScript type guard declarations", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -41,2 +41,8 @@ Isntnt is a collection of composable JavaScript runtime type predicates with TypeScript type guard declarations. Supports generics including union and intersection types. | ||
## has | ||
```typescript | ||
const hasFoo = has('foo') // (value: unknown) => value is { 'foo': unknown } | ||
``` | ||
## instance | ||
@@ -66,2 +72,14 @@ | ||
## noneable | ||
```typescript | ||
const isNoneableString = noneable(isString) // (value: unknown) => value is string | null | undefined | ||
``` | ||
## nullable | ||
```typescript | ||
const isNullableString = nullable(isString) // (value: unknown) => value is string | null | ||
``` | ||
## object | ||
@@ -73,2 +91,8 @@ | ||
## optional | ||
```typescript | ||
const isOptionalString = optional(isString) // (value: unknown) => value is string | undefined | ||
``` | ||
## or | ||
@@ -83,3 +107,3 @@ | ||
```typescript | ||
const isDict = record(isString, isString) // (value: unknown) => value is Record<string, string> | ||
const isEnum = record(isString, isNumber) // (value: unknown) => value is Record<string, number> | ||
``` | ||
@@ -148,3 +172,3 @@ | ||
```typescript | ||
isDicionary(value) // value is ObjectOf<string> | ||
isDictionary(value) // value is ObjectOf<string> | ||
``` | ||
@@ -151,0 +175,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 not supported yet
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
215013
205
778
442