Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
09611eb
major(vest): suite is not callable
ealush Dec 27, 2024
433a39d
major(vest): Replacing done with after
ealush Dec 28, 2024
de0e444
remove staticsuite
ealush Dec 28, 2024
8b636c7
remove promisify
ealush Dec 28, 2024
a83bcfe
Result object is now a promise
ealush Dec 28, 2024
8b4357a
[wip] run field (missing part: I need to make the callback run when t…
ealush Dec 30, 2024
a943084
Running field callbacks
ealush Jan 1, 2025
4b9f84d
Bring back runStatic
ealush Jan 1, 2025
f0bc259
lint
ealush Jan 2, 2025
88876d9
remove suiterunresult specific tests
ealush Jan 18, 2025
5c08350
Build the initial memo isolate
ealush Jan 18, 2025
60116f1
memo tests
ealush Jan 19, 2025
28cfb04
Use cache api in memo isolate
ealush Jan 19, 2025
24309f6
add(vest-utils): Cache.set
ealush Jan 19, 2025
724144b
fix: persisted suite error
ealush Jan 19, 2025
d2cd8d0
breaking(vest): delete test.memo
ealush Jan 19, 2025
77c2adc
Add more memo tests
ealush Jan 19, 2025
b5448c2
Remove memo cache from the suite context
ealush Jan 20, 2025
c76154e
Group name is not stored on the test, but instead, traversed from upward
ealush Jan 20, 2025
b6769be
types(vest-utils): closest now takes a generic
ealush Jan 20, 2025
57f29ec
Remove useGroupName hook
ealush Jan 20, 2025
c6e1158
breaking(vest): remove isValidByGroup
ealush Jan 24, 2025
7d9dad2
Rename optionalFunctionValue to dynamicValue
ealush Jan 24, 2025
16441b4
removal of dependson
ealush Jan 26, 2025
b06a6bb
lint(vest): remove some lint disables
ealush Feb 1, 2025
d807827
breaking(vest): after runs for each async field
ealush Feb 2, 2025
e8ecbd1
lint(vest): remove eslint disables
ealush Feb 2, 2025
508e28f
lint: reduce lint exceptions
ealush Feb 2, 2025
85a029e
patch(vest): use Promise.withResolvers
ealush Feb 2, 2025
e0d317c
lint(use-use):fix use-use lint rule to only apply to functions
ealush Feb 2, 2025
c7218da
minor(vest): add focus pre run modifier
ealush Feb 2, 2025
6ef0e60
patch(vest): extract suite method creation
ealush Feb 2, 2025
8d477e3
minor(vest-utils): withResolvers
ealush Feb 4, 2025
7ede65f
patch(vest): use withResolvers
ealush Feb 4, 2025
185fe50
lit
ealush Feb 9, 2025
04cda0c
More after tests
ealush Apr 15, 2025
a84bc3d
patch: replace traversal and summarization enginer
ealush Jul 31, 2025
c6905ea
breaking(n4s): 6
ealush Nov 8, 2025
596390a
v6-is-valid-by-group
ealush Nov 9, 2025
12e15ca
Update test titles
ealush Nov 12, 2025
c001fab
feat: expose suite schema metadata
ealush Nov 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .swp
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/context/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
assign,
defaultTo,
invariant,
optionalFunctionValue,
dynamicValue,
Nullable,
} from 'vest-utils';

Expand Down Expand Up @@ -72,7 +72,7 @@ export function createCascade<T extends Record<string, unknown>>(
const out = assign(
{},
parentContext ? parentContext : {},
optionalFunctionValue(init, value, parentContext) ?? value,
dynamicValue(init, value, parentContext) ?? value,
) as T;

return ctx.run(Object.freeze(out), fn) as R;
Expand Down
3 changes: 0 additions & 3 deletions packages/n4s/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ src
!types/
!dist/
tsconfig.json
!schema/
!isURL/
!email/
!date/
!compounds/
!compose/

# Manual Section. Edit at will.
75 changes: 0 additions & 75 deletions packages/n4s/CHANGELOG.md

This file was deleted.

4 changes: 2 additions & 2 deletions packages/n4s/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 ealush
Copyright (c) 2025 ealush

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
46 changes: 2 additions & 44 deletions packages/n4s/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
# Enforce - n4s
# n4s

[![Join Discord](https://badgen.net/discord/online-members/WmADZpJnSe?icon=discord&label=Discord)](https://discord.gg/WmADZpJnSe) [![Version](https://badgen.net/npm/v/vest?&icon=npm)](https://www.npmjs.com/package/n4s) [![Downloads](https://badgen.net/npm/dt/n4s?label=Downloads)](https://www.npmjs.com/package/n4s) [![bundlephobia](https://badgen.net/bundlephobia/minzip/n4s)](https://bundlephobia.com/package/n4s) [![Status](https://badgen.net/github/status/ealush/vest)](https://github.com/ealush/vest/actions)

Enforce is a validations assertions library. It provides rules that you can test your data against.

By default, enforce throws an error when your validations fail. These errors should be caught by a validation testing framework such as [Vest](https://github.com/ealush/vest).

You can extend Enforce per need, and you can add your custom validation rules in your app.

```js
import { enforce } from 'n4s';

enforce(4).isNumber();
// passes

enforce(4).isNumber().greaterThan(2);
// passes

enforce(4)
.lessThan(2) // throws an error, will not carry on to the next rule
.greaterThan(3);
```

## Installation

```
npm i n4s
```

## Non throwing validations

> This functionality replaces the no-longer supported ensure export, as it performs the same functionality with better performance.

If you wish to use enforce's functionality safely with a boolean return interface, you can use its lazy validation interface:

```js
enforce.isArray().longerThan(3).test([1, 2, 3]);
```

[Read the docs](https://ealush.github.io/n4s)

- [List of enforce rules](https://ealush.github.io/n4s/#/rules)
- [Schema validation](https://ealush.github.io/n4s/#/shape)
- [Custom enforce rules](https://ealush.github.io/n4s/#/custom)
typed schema validation version of enforce
149 changes: 23 additions & 126 deletions packages/n4s/package.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,24 @@
{
"version": "5.0.28",
"name": "n4s",
"version": "5.10.10",
"description": "typed schema validation version of enforce",
"license": "MIT",
"author": "ealush",
"private": true,
"main": "./dist/cjs/n4s.js",
"module": "./dist/es/n4s.production.js",
"unpkg": "./dist/umd/n4s.production.js",
"jsdelivr": "./dist/umd/n4s.production.js",
"types": "./types/n4s.d.ts",
"name": "n4s",
"author": "ealush",
"description": "Assertion library for form validations",
"keywords": [
"vest",
"enforce",
"n4s",
"validation",
"assertion",
"schema validation",
"form validation",
"validation library"
],
"scripts": {
"test": "vx test",
"release": "vx release"
},
"dependencies": {
"context": "^3.0.33",
"vest-utils": "^1.3.3"
"repository": {
"type": "git",
"url": "https://github.com/ealush/vest.git",
"directory": "packages/n4s"
},
"devDependencies": {
"@types/validator": "^13.11.10",
"validator": "13.9.0"
"bugs": {
"url": "https://github.com/ealush/vest.git/issues"
},
"vxAllowResolve": [
"validator"
],
"module": "./dist/es/n4s.production.js",
"exports": {
"./schema": {
"production": {
"types": "./types/schema.d.ts",
"browser": "./dist/es/schema.production.js",
"umd": "./dist/umd/schema.production.js",
"import": "./dist/es/schema.production.js",
"require": "./dist/cjs/schema.production.js",
"node": "./dist/cjs/schema.production.js",
"module": "./dist/es/schema.production.js",
"default": "./dist/cjs/schema.production.js"
},
"development": {
"types": "./types/schema.d.ts",
"browser": "./dist/es/schema.development.js",
"umd": "./dist/umd/schema.development.js",
"import": "./dist/es/schema.development.js",
"require": "./dist/cjs/schema.development.js",
"node": "./dist/cjs/schema.development.js",
"module": "./dist/es/schema.development.js",
"default": "./dist/cjs/schema.development.js"
},
"types": "./types/schema.d.ts",
"browser": "./dist/es/schema.production.js",
"umd": "./dist/umd/schema.production.js",
"import": "./dist/es/schema.production.js",
"require": "./dist/cjs/schema.production.js",
"node": "./dist/cjs/schema.production.js",
"module": "./dist/es/schema.production.js",
"default": "./dist/cjs/schema.production.js"
},
"./isURL": {
"production": {
"types": "./types/isURL.d.ts",
Expand Down Expand Up @@ -153,66 +109,6 @@
"module": "./dist/es/date.production.js",
"default": "./dist/cjs/date.production.js"
},
"./compounds": {
"production": {
"types": "./types/compounds.d.ts",
"browser": "./dist/es/compounds.production.js",
"umd": "./dist/umd/compounds.production.js",
"import": "./dist/es/compounds.production.js",
"require": "./dist/cjs/compounds.production.js",
"node": "./dist/cjs/compounds.production.js",
"module": "./dist/es/compounds.production.js",
"default": "./dist/cjs/compounds.production.js"
},
"development": {
"types": "./types/compounds.d.ts",
"browser": "./dist/es/compounds.development.js",
"umd": "./dist/umd/compounds.development.js",
"import": "./dist/es/compounds.development.js",
"require": "./dist/cjs/compounds.development.js",
"node": "./dist/cjs/compounds.development.js",
"module": "./dist/es/compounds.development.js",
"default": "./dist/cjs/compounds.development.js"
},
"types": "./types/compounds.d.ts",
"browser": "./dist/es/compounds.production.js",
"umd": "./dist/umd/compounds.production.js",
"import": "./dist/es/compounds.production.js",
"require": "./dist/cjs/compounds.production.js",
"node": "./dist/cjs/compounds.production.js",
"module": "./dist/es/compounds.production.js",
"default": "./dist/cjs/compounds.production.js"
},
"./compose": {
"production": {
"types": "./types/compose.d.ts",
"browser": "./dist/es/compose.production.js",
"umd": "./dist/umd/compose.production.js",
"import": "./dist/es/compose.production.js",
"require": "./dist/cjs/compose.production.js",
"node": "./dist/cjs/compose.production.js",
"module": "./dist/es/compose.production.js",
"default": "./dist/cjs/compose.production.js"
},
"development": {
"types": "./types/compose.d.ts",
"browser": "./dist/es/compose.development.js",
"umd": "./dist/umd/compose.development.js",
"import": "./dist/es/compose.development.js",
"require": "./dist/cjs/compose.development.js",
"node": "./dist/cjs/compose.development.js",
"module": "./dist/es/compose.development.js",
"default": "./dist/cjs/compose.development.js"
},
"types": "./types/compose.d.ts",
"browser": "./dist/es/compose.production.js",
"umd": "./dist/umd/compose.production.js",
"import": "./dist/es/compose.production.js",
"require": "./dist/cjs/compose.production.js",
"node": "./dist/cjs/compose.production.js",
"module": "./dist/es/compose.production.js",
"default": "./dist/cjs/compose.production.js"
},
".": {
"development": {
"types": "./types/n4s.d.ts",
Expand All @@ -236,14 +132,15 @@
"./package.json": "./package.json",
"./*": "./*"
},
"repository": {
"type": "git",
"url": "https://github.com/ealush/vest.git",
"directory": "packages/n4s"
"dependencies": {
"context": "^3.0.33",
"vest-utils": "^1.3.3"
},
"bugs": {
"url": "https://github.com/ealush/vest.git/issues"
"devDependencies": {
"@types/validator": "^13.11.10",
"validator": "13.9.0"
},
"unpkg": "./dist/umd/n4s.production.js",
"jsdelivr": "./dist/umd/n4s.production.js"
"vxAllowResolve": [
"validator"
]
}
Loading