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

ow

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ow - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

10

dist/index.d.ts

@@ -7,3 +7,3 @@ import { type BasePredicate } from './predicates/base-predicate.js';

*/
export declare type Main = <T>(value: T, label: string | Function, predicate: BasePredicate<T>, idLabel?: boolean) => void;
export type Main = <T>(value: T, label: string | Function, predicate: BasePredicate<T>, idLabel?: boolean) => void;
/**

@@ -23,4 +23,4 @@ Retrieve the type from the given predicate.

*/
export declare type Infer<P> = P extends BasePredicate<infer T> ? T : never;
export declare type Ow = {
export type Infer<P> = P extends BasePredicate<infer T> ? T : never;
export type Ow = {
/**

@@ -58,3 +58,3 @@ Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.

*/
export declare type ReusableValidator<T> = {
export type ReusableValidator<T> = {
/**

@@ -83,3 +83,3 @@ Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.

*/
export declare type AssertingValidator<T> = T extends ReusableValidator<infer R> ? (value: unknown, label?: string) => asserts value is R : T extends BasePredicate<infer R> ? (value: unknown, label?: string) => asserts value is R : never;
export type AssertingValidator<T> = T extends ReusableValidator<infer R> ? (value: unknown, label?: string) => asserts value is R : T extends BasePredicate<infer R> ? (value: unknown, label?: string) => asserts value is R : never;
declare const _ow: Ow;

@@ -86,0 +86,0 @@ export default _ow;

import { type Predicates } from './predicates.js';
import type { BasePredicate } from './index.js';
declare type Optionalify<P> = P extends BasePredicate<infer X> ? P & BasePredicate<X | undefined> : P;
export declare type Modifiers = {
type Optionalify<P> = P extends BasePredicate<infer X> ? P & BasePredicate<X | undefined> : P;
export type Modifiers = {
/**

@@ -6,0 +6,0 @@ Make the following predicate optional so it doesn't fail when the value is `undefined`.

@@ -22,3 +22,3 @@ /// <reference types="node" resolution-mode="require"/>

import { AnyPredicate } from './predicates/any.js';
export declare type Predicates = {
export type Predicates = {
/**

@@ -25,0 +25,0 @@ Test the value to be a string.

@@ -13,4 +13,4 @@ import type { Main } from '../index.js';

*/
export declare type BasePredicate<T = unknown> = {
export type BasePredicate<T = unknown> = {
[testSymbol](value: T, main: Main, label: string | Function, idLabel?: boolean): void;
};

@@ -11,7 +11,7 @@ import type { Main } from '../index.js';

*/
export declare type ValidatorMessageBuilder<T> = (value: T, label?: string) => string;
export type ValidatorMessageBuilder<T> = (value: T, label?: string) => string;
/**
@hidden
*/
export declare type Validator<T> = {
export type Validator<T> = {
message(value: T, label?: string, result?: any): string;

@@ -29,3 +29,3 @@ validator(value: T): unknown;

*/
export declare type PredicateOptions = {
export type PredicateOptions = {
optional?: boolean;

@@ -36,3 +36,3 @@ };

*/
export declare type Context<T = unknown> = {
export type Context<T = unknown> = {
validators: Array<Validator<T>>;

@@ -44,3 +44,3 @@ } & PredicateOptions;

export declare const validatorSymbol: unique symbol;
export declare type CustomValidator<T> = (value: T) => {
export type CustomValidator<T> = (value: T) => {
/**

@@ -47,0 +47,0 @@ Should be `true` if the validation is correct.

@@ -1,1 +0,1 @@

export declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
/**
@hidden
*/
export declare type CollectionLike<T> = {
export type CollectionLike<T> = {
has: (item: T) => boolean;

@@ -6,0 +6,0 @@ };

import type { BasePredicate } from '../index.js';
export declare type Shape = {
export type Shape = {
[key: string]: BasePredicate | Shape;

@@ -22,3 +22,3 @@ };

*/
export declare type TypeOfShape<S extends BasePredicate | Shape> = S extends BasePredicate<infer X> ? X : S extends Shape ? {
export type TypeOfShape<S extends BasePredicate | Shape> = S extends BasePredicate<infer X> ? X : S extends Shape ? {
[K in keyof S]: TypeOfShape<S[K]>;

@@ -25,0 +25,0 @@ } : never;

{
"name": "ow",
"version": "1.1.0",
"version": "1.1.1",
"description": "Function argument validation for humans",

@@ -17,7 +17,7 @@ "license": "MIT",

"types": "./dist/index.d.ts",
"node": "./dist/index.js"
"default": "./dist/index.js"
},
"./dev-only": {
"types": "./dist/index.d.ts",
"node": "./dev-only.js"
"default": "./dev-only.js"
}

@@ -24,0 +24,0 @@ },

@@ -70,3 +70,3 @@ <p align="center">

[Complete API documentation](https://sindresorhus.com/ow/interfaces/Ow.html)
[Complete API documentation](https://sindresorhus.com/ow/)

@@ -145,50 +145,52 @@ Ow includes TypeScript type guards, so using it will narrow the type of previously-unknown values.

[Predicate docs.](https://sindresorhus.com/ow/types/Predicates.html)
#### Primitives
- [`undefined`](https://sindresorhus.com/ow/interfaces/Ow.html#undefined-1)
- [`null`](https://sindresorhus.com/ow/interfaces/Ow.html#null)
- [`string`](https://sindresorhus.com/ow/classes/StringPredicate.html)
- [`number`](https://sindresorhus.com/ow/classes/NumberPredicate.html)
- [`boolean`](https://sindresorhus.com/ow/classes/BooleanPredicate.html)
- [`symbol`](https://sindresorhus.com/ow/interfaces/Ow.html#symbol-1)
- `undefined`
- `null`
- `string`
- `number`
- `boolean`
- `symbol`
#### Built-in types
- [`array`](https://sindresorhus.com/ow/classes/ArrayPredicate.html)
- [`function`](https://sindresorhus.com/ow/interfaces/Ow.html#function)
- [`buffer`](https://sindresorhus.com/ow/interfaces/Ow.html#buffer)
- [`object`](https://sindresorhus.com/ow/classes/ObjectPredicate.html)
- [`regExp`](https://sindresorhus.com/ow/interfaces/Ow.html#regexp-1)
- [`date`](https://sindresorhus.com/ow/classes/DatePredicate.html)
- [`error`](https://sindresorhus.com/ow/classes/ErrorPredicate.html)
- [`promise`](https://sindresorhus.com/ow/interfaces/Ow.html#promise-1)
- [`map`](https://sindresorhus.com/ow/classes/MapPredicate.html)
- [`set`](https://sindresorhus.com/ow/classes/SetPredicate.html)
- [`weakMap`](https://sindresorhus.com/ow/classes/WeakMapPredicate.html)
- [`weakSet`](https://sindresorhus.com/ow/classes/WeakSetPredicate.html)
- `array`
- `function`
- `buffer`
- `object`
- `regExp`
- `date`
- `error`
- `promise`
- `map`
- `set`
- `weakMap`
- `weakSet`
#### Typed arrays
- [`int8Array`](https://sindresorhus.com/ow/interfaces/Ow.html#int8Array)
- [`uint8Array`](https://sindresorhus.com/ow/interfaces/Ow.html#uint8Array-1)
- [`uint8ClampedArray`](https://sindresorhus.com/ow/interfaces/Ow.html#uint8ClampedArray-1)
- [`int16Array`](https://sindresorhus.com/ow/interfaces/Ow.html#int16Array)
- [`uint16Array`](https://sindresorhus.com/ow/interfaces/Ow.html#uint16Array-1)
- [`int32Array`](https://sindresorhus.com/ow/interfaces/Ow.html#int32Array)
- [`uint32Array`](https://sindresorhus.com/ow/interfaces/Ow.html#uint32Array-1)
- [`float32Array`](https://sindresorhus.com/ow/interfaces/Ow.html#float32Array)
- [`float64Array`](https://sindresorhus.com/ow/interfaces/Ow.html#float64Array)
- `int8Array`
- `uint8Array`
- `uint8ClampedArray`
- `int16Array`
- `uint16Array`
- `int32Array`
- `uint32Array`
- `float32Array`
- `float64Array`
#### Structured data
- [`arrayBuffer`](https://sindresorhus.com/ow/interfaces/Ow.html#arrayBuffer)
- [`dataView`](https://sindresorhus.com/ow/interfaces/Ow.html#dataView)
- [`sharedArrayBuffer`](https://sindresorhus.com/ow/interfaces/Ow.html#sharedArrayBuffer-1)
- `arrayBuffer`
- `dataView`
- `sharedArrayBuffer`
#### Miscellaneous
- [`nan`](https://sindresorhus.com/ow/interfaces/Ow.html#nan)
- [`nullOrUndefined`](https://sindresorhus.com/ow/interfaces/Ow.html#nullOrUndefined)
- [`iterable`](https://sindresorhus.com/ow/interfaces/Ow.html#iterable)
- [`typedArray`](https://sindresorhus.com/ow/interfaces/Ow.html#typedArray-1)
- `nan`
- `nullOrUndefined`
- `iterable`
- `typedArray`

@@ -195,0 +197,0 @@ ### Predicates

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