@hookstate/validation
Advanced tools
Comparing version 1.8.0 to 2.0.0
@@ -1,2 +0,2 @@ | ||
import { StateMarkerID, self } from '@hookstate/core'; | ||
import { self } from '@hookstate/core'; | ||
@@ -99,3 +99,3 @@ var PluginID = Symbol('Validate'); | ||
// if (nestedInst[k] !== undefined) { | ||
// result = result.concat((nestedInst[k] as StateLink<StateValueAtPath, ValidationExtensions>) | ||
// result = result.concat((nestedInst[k] as State<StateValueAtPath, ValidationExtensions>) | ||
// .extended.errors(filter, depth - 1, first)); | ||
@@ -133,9 +133,3 @@ // if (first && result.length > 0) { | ||
if ($this) { | ||
var state_1; | ||
if ($this[StateMarkerID]) { | ||
state_1 = $this; | ||
} | ||
else { | ||
state_1 = $this[self]; | ||
} | ||
var state_1 = $this; | ||
var plugin = state_1[self].attach(PluginID)[0]; | ||
@@ -181,3 +175,3 @@ if (plugin instanceof Error) { | ||
id: PluginID, | ||
create: function () { return new ValidationPluginInstance(); } | ||
init: function () { return new ValidationPluginInstance(); } | ||
}; | ||
@@ -184,0 +178,0 @@ } |
@@ -103,3 +103,3 @@ 'use strict'; | ||
// if (nestedInst[k] !== undefined) { | ||
// result = result.concat((nestedInst[k] as StateLink<StateValueAtPath, ValidationExtensions>) | ||
// result = result.concat((nestedInst[k] as State<StateValueAtPath, ValidationExtensions>) | ||
// .extended.errors(filter, depth - 1, first)); | ||
@@ -137,9 +137,3 @@ // if (first && result.length > 0) { | ||
if ($this) { | ||
var state_1; | ||
if ($this[core.StateMarkerID]) { | ||
state_1 = $this; | ||
} | ||
else { | ||
state_1 = $this[core.self]; | ||
} | ||
var state_1 = $this; | ||
var plugin = state_1[core.self].attach(PluginID)[0]; | ||
@@ -185,3 +179,3 @@ if (plugin instanceof Error) { | ||
id: PluginID, | ||
create: function () { return new ValidationPluginInstance(); } | ||
init: function () { return new ValidationPluginInstance(); } | ||
}; | ||
@@ -188,0 +182,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Plugin, Path, StateLink, State } from '@hookstate/core'; | ||
import { Plugin, Path, State } from '@hookstate/core'; | ||
export declare type ValidationSeverity = 'error' | 'warning'; | ||
@@ -18,3 +18,2 @@ export interface ValidationError { | ||
export declare function Validation(): Plugin; | ||
export declare function Validation<S>($this: StateLink<S>): ValidationExtensions<S>; | ||
export declare function Validation<S>($this: State<S>): ValidationExtensions<S>; |
{ | ||
"name": "@hookstate/validation", | ||
"version": "1.8.0", | ||
"version": "2.0.0", | ||
"description": "Plugin for @hookstate/core to enable validation of data state.", | ||
@@ -38,8 +38,8 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"@hookstate/core": "^1.8.3" | ||
"@hookstate/core": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.9.6", | ||
"@babel/runtime": "7.9.6", | ||
"@hookstate/core": "1.8.3", | ||
"@babel/core": "7.10.1", | ||
"@babel/runtime": "7.10.1", | ||
"@hookstate/core": "2.0.0", | ||
"@rollup/plugin-babel": "5.0.2", | ||
@@ -63,3 +63,3 @@ "@rollup/plugin-commonjs": "12.0.0", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.10.5", | ||
"rollup": "2.11.0", | ||
"rollup-plugin-peer-deps-external": "2.2.2", | ||
@@ -66,0 +66,0 @@ "rollup-plugin-typescript2": "0.27.1", |
@@ -5,4 +5,4 @@ # @hookstate/validation | ||
Plugin for @hookstate/core to enable validation of data state. See [demo](https://hookstate.js.org/plugin-validation). | ||
Plugin for @hookstate/core to enable validation of data state. | ||
This plugin requires the target environment to support `Array.from`, `Array.includes` and `Object.values`, which can be polyfilled using `core-js`. | ||
[Learn more...](https://hookstate.js.org/docs/extensions-validation) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8
47210
373