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

ow

Package Overview
Dependencies
Maintainers
2
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 0.23.0 to 0.23.1

24

dist/index.d.ts

@@ -11,3 +11,3 @@ import { Predicate } from './predicates/predicate';

/**
Returns `true` if the value matches the predicate, otherwise returns `false`.
Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.

@@ -17,11 +17,13 @@ @param value - Value to test.

*/
isValid: <T>(value: T, predicate: BasePredicate<T>) => value is T;
<T>(value: unknown, predicate: BasePredicate<T>): asserts value is T;
/**
Create a reusable validator.
Test if `value` matches the provided `predicate`. Throws an `ArgumentError` with the specified `label` if the test fails.
@param predicate - Predicate used in the validator function.
@param value - Value to test.
@param label - Label which should be used in error messages.
@param predicate - Predicate to test against.
*/
create: (<T>(predicate: BasePredicate<T>) => ReusableValidator<T>) & (<T>(label: string, predicate: BasePredicate<T>) => ReusableValidator<T>);
<T>(value: unknown, label: string, predicate: BasePredicate<T>): asserts value is T;
/**
Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.
Returns `true` if the value matches the predicate, otherwise returns `false`.

@@ -31,11 +33,9 @@ @param value - Value to test.

*/
<T>(value: unknown, predicate: BasePredicate<T>): asserts value is T;
isValid: <T>(value: T, predicate: BasePredicate<T>) => value is T;
/**
Test if `value` matches the provided `predicate`. Throws an `ArgumentError` with the specified `label` if the test fails.
Create a reusable validator.
@param value - Value to test.
@param label - Label which should be used in error messages.
@param predicate - Predicate to test against.
@param predicate - Predicate used in the validator function.
*/
<T>(value: unknown, label: string, predicate: BasePredicate<T>): asserts value is T;
create: (<T>(predicate: BasePredicate<T>) => ReusableValidator<T>) & (<T>(label: string, predicate: BasePredicate<T>) => ReusableValidator<T>);
}

@@ -42,0 +42,0 @@ /**

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

import type { Predicate } from '../predicates/predicate';
/**

@@ -8,2 +9,2 @@ Operator which inverts the following validation.

*/
export declare const not: (predicate: any) => any;
export declare const not: (predicate: Predicate) => Predicate;

@@ -87,3 +87,4 @@ "use strict";

message: (object, label) => {
let { name } = object.constructor;
var _a;
let { name } = (_a = object === null || object === void 0 ? void 0 : object.constructor) !== null && _a !== void 0 ? _a : {};
if (!name || name === 'Object') {

@@ -90,0 +91,0 @@ name = JSON.stringify(object);

@@ -66,3 +66,3 @@ import { BasePredicate, testSymbol } from './base-predicate';

*/
get [validatorSymbol](): Validator<T>[];
get [validatorSymbol](): Array<Validator<T>>;
/**

@@ -107,3 +107,3 @@ Invert the following validators.

*/
protected addValidator(validator: Validator<T>): this;
addValidator(validator: Validator<T>): this;
}

@@ -9,2 +9,2 @@ import { CallSite } from 'callsites';

*/
export declare const inferLabel: (callsites: readonly CallSite[]) => string | undefined;
export declare const inferLabel: (callsites: readonly CallSite[]) => void | string;

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

declare const _default: (string: string | undefined) => boolean | "" | undefined;
declare const _default: (string: string | undefined) => string | boolean | undefined;
/**

@@ -3,0 +3,0 @@ Test if the string is a valid JavaScript identifier.

{
"name": "ow",
"version": "0.23.0",
"version": "0.23.1",
"description": "Function argument validation for humans",

@@ -21,4 +21,4 @@ "license": "MIT",

"build": "del-cli dist && tsc",
"prepublishOnly": "npm run build",
"postpublish": "gh-pages --dist docs --no-history --message \"Deploy documentation\"",
"prepare": "npm run build",
"// postpublish": "npm run docs && gh-pages --dist docs --no-history --message \"Deploy documentation\"",
"example": "npm run build && node example.js"

@@ -55,3 +55,3 @@ },

"lodash.isequal": "^4.5.0",
"type-fest": "^0.20.2",
"type-fest": "^1.2.0",
"vali-date": "^1.0.0"

@@ -62,3 +62,3 @@ },

"@types/lodash.isequal": "^4.5.5",
"@types/node": "^14.14.20",
"@types/node": "^15.6.2",
"@types/vali-date": "^1.0.0",

@@ -68,8 +68,7 @@ "ava": "^2.4.0",

"expect-type": "^0.11.0",
"gh-pages": "^3.1.0",
"gh-pages": "^3.2.0",
"nyc": "^15.1.0",
"ts-node": "^9.1.1",
"typedoc": "^0.20.13",
"typescript": "~4.1.3",
"xo": "^0.37.1"
"ts-node": "^10.0.0",
"typescript": "^4.3.2",
"xo": "^0.38.2"
},

@@ -93,3 +92,3 @@ "browser": {

"ava/no-ignored-test-files": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/ban-types": "off",

@@ -96,0 +95,0 @@ "@typescript-eslint/no-explicit-any": "off",

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

[![Coverage Status](https://codecov.io/gh/sindresorhus/ow/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/ow) [![gzip size](https://badgen.net/bundlephobia/minzip/ow)](https://bundlephobia.com/result?p=ow) [![install size](https://packagephobia.now.sh/badge?p=ow)](https://packagephobia.now.sh/result?p=ow)
[![Coverage Status](https://codecov.io/gh/sindresorhus/ow/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/ow)
[![gzip size](https://badgen.net/bundlephobia/minzip/ow)](https://bundlephobia.com/result?p=ow)
[![install size](https://packagephobia.now.sh/badge?p=ow)](https://packagephobia.now.sh/result?p=ow)

@@ -10,0 +12,0 @@ > Function argument validation for humans

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