Skip to content

Commit 152f9cb

Browse files
committed
feat: rename null_ and undefined_ steps to null and undefined
1 parent eef659c commit 152f9cb

File tree

9 files changed

+32
-32
lines changed

9 files changed

+32
-32
lines changed

packages/internal/src/steps/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export * from './looseObject'
1818
export * from './max'
1919
export * from './min'
2020
export * from './never'
21-
export * from './null_'
21+
export * from './null'
2222
export * from './number'
2323
export * from './object'
2424
export * from './parseJSON'
@@ -39,7 +39,7 @@ export * from './toTrimmedEnd'
3939
export * from './toTrimmedStart'
4040
export * from './toUppercase'
4141
export * from './transform'
42-
export * from './undefined_'
42+
export * from './undefined'
4343
export * from './union'
4444
export * from './unknown'
4545
export * from './use'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './null'

packages/internal/src/steps/null_/null_.test.ts renamed to packages/internal/src/steps/null/null.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ const v = createValchecker({ steps: [null_, check] })
1717
describe('null plugin', () => {
1818
describe('valid inputs', () => {
1919
it('should pass for null', () => {
20-
const result = v.null_().execute(null)
20+
const result = v.null().execute(null)
2121
expect(result).toEqual({ value: null })
2222
})
2323
})
2424

2525
describe('invalid inputs', () => {
2626
it('should fail for number', () => {
27-
const result = v.null_().execute(42)
27+
const result = v.null().execute(42)
2828
expect(result).toEqual({
2929
issues: [{
3030
code: 'null:expected_null',
@@ -35,7 +35,7 @@ describe('null plugin', () => {
3535
})
3636

3737
it('should fail for string', () => {
38-
const result = v.null_().execute('hello')
38+
const result = v.null().execute('hello')
3939
expect(result).toEqual({
4040
issues: [{
4141
code: 'null:expected_null',
@@ -46,7 +46,7 @@ describe('null plugin', () => {
4646
})
4747

4848
it('should fail for boolean', () => {
49-
const result = v.null_().execute(true)
49+
const result = v.null().execute(true)
5050
expect(result).toEqual({
5151
issues: [{
5252
code: 'null:expected_null',
@@ -57,7 +57,7 @@ describe('null plugin', () => {
5757
})
5858

5959
it('should fail for undefined', () => {
60-
const result = v.null_().execute(undefined)
60+
const result = v.null().execute(undefined)
6161
expect(result).toEqual({
6262
issues: [{
6363
code: 'null:expected_null',
@@ -68,7 +68,7 @@ describe('null plugin', () => {
6868
})
6969

7070
it('should fail for object', () => {
71-
const result = v.null_().execute({})
71+
const result = v.null().execute({})
7272
expect(result).toEqual({
7373
issues: [{
7474
code: 'null:expected_null',
@@ -79,7 +79,7 @@ describe('null plugin', () => {
7979
})
8080

8181
it('should fail for array', () => {
82-
const result = v.null_().execute([])
82+
const result = v.null().execute([])
8383
expect(result).toEqual({
8484
issues: [{
8585
code: 'null:expected_null',
@@ -90,7 +90,7 @@ describe('null plugin', () => {
9090
})
9191

9292
it('should fail for bigint', () => {
93-
const result = v.null_().execute(123n)
93+
const result = v.null().execute(123n)
9494
expect(result).toEqual({
9595
issues: [{
9696
code: 'null:expected_null',
@@ -102,7 +102,7 @@ describe('null plugin', () => {
102102

103103
it('should fail for symbol', () => {
104104
const sym = Symbol('test')
105-
const result = v.null_().execute(sym)
105+
const result = v.null().execute(sym)
106106
expect(result).toEqual({
107107
issues: [{
108108
code: 'null:expected_null',
@@ -115,7 +115,7 @@ describe('null plugin', () => {
115115

116116
describe('custom messages', () => {
117117
it('should use custom message for invalid input', () => {
118-
const result = v.null_('Custom error message').execute(42)
118+
const result = v.null('Custom error message').execute(42)
119119
expect(result).toEqual({
120120
issues: [{
121121
code: 'null:expected_null',
@@ -128,14 +128,14 @@ describe('null plugin', () => {
128128

129129
describe('chaining', () => {
130130
it('should chain with check', () => {
131-
const result = v.null_()
131+
const result = v.null()
132132
.check(n => n === null)
133133
.execute(null)
134134
expect(result).toEqual({ value: null })
135135
})
136136

137137
it('should fail chaining with check', () => {
138-
const result = v.null_()
138+
const result = v.null()
139139
.check(n => n !== null)
140140
.execute(null)
141141
expect(result).toEqual({

packages/internal/src/steps/null_/null_.ts renamed to packages/internal/src/steps/null/null.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface PluginDef extends TStepPluginDef {
2929
* ### Issues:
3030
* - `'null:expected_null'`: The value is not null.
3131
*/
32-
null_: DefineStepMethod<
32+
null: DefineStepMethod<
3333
Meta,
3434
this['This'] extends Meta['ExpectedThis']
3535
? IsExactlyAnyOrUnknown<InferOutput<this['This']>> extends true
@@ -47,7 +47,7 @@ interface PluginDef extends TStepPluginDef {
4747

4848
/* @__NO_SIDE_EFFECTS__ */
4949
export const null_ = implStepPlugin<PluginDef>({
50-
null_: ({
50+
null: ({
5151
utils: { addSuccessStep, success, resolveMessage, failure },
5252
params: [message],
5353
}) => {

packages/internal/src/steps/null_/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './undefined'

packages/internal/src/steps/undefined_/undefined_.test.ts renamed to packages/internal/src/steps/undefined/undefined.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ const v = createValchecker({ steps: [undefined_, check] })
1717
describe('undefined plugin', () => {
1818
describe('valid inputs', () => {
1919
it('should pass for undefined', () => {
20-
const result = v.undefined_().execute(undefined)
20+
const result = v.undefined().execute(undefined)
2121
expect(result).toEqual({ value: undefined })
2222
})
2323
})
2424

2525
describe('invalid inputs', () => {
2626
it('should fail for number', () => {
27-
const result = v.undefined_().execute(42)
27+
const result = v.undefined().execute(42)
2828
expect(result).toEqual({
2929
issues: [{
3030
code: 'undefined:expected_undefined',
@@ -35,7 +35,7 @@ describe('undefined plugin', () => {
3535
})
3636

3737
it('should fail for string', () => {
38-
const result = v.undefined_().execute('hello')
38+
const result = v.undefined().execute('hello')
3939
expect(result).toEqual({
4040
issues: [{
4141
code: 'undefined:expected_undefined',
@@ -46,7 +46,7 @@ describe('undefined plugin', () => {
4646
})
4747

4848
it('should fail for boolean', () => {
49-
const result = v.undefined_().execute(true)
49+
const result = v.undefined().execute(true)
5050
expect(result).toEqual({
5151
issues: [{
5252
code: 'undefined:expected_undefined',
@@ -57,7 +57,7 @@ describe('undefined plugin', () => {
5757
})
5858

5959
it('should fail for null', () => {
60-
const result = v.undefined_().execute(null)
60+
const result = v.undefined().execute(null)
6161
expect(result).toEqual({
6262
issues: [{
6363
code: 'undefined:expected_undefined',
@@ -68,7 +68,7 @@ describe('undefined plugin', () => {
6868
})
6969

7070
it('should fail for object', () => {
71-
const result = v.undefined_().execute({})
71+
const result = v.undefined().execute({})
7272
expect(result).toEqual({
7373
issues: [{
7474
code: 'undefined:expected_undefined',
@@ -79,7 +79,7 @@ describe('undefined plugin', () => {
7979
})
8080

8181
it('should fail for array', () => {
82-
const result = v.undefined_().execute([])
82+
const result = v.undefined().execute([])
8383
expect(result).toEqual({
8484
issues: [{
8585
code: 'undefined:expected_undefined',
@@ -90,7 +90,7 @@ describe('undefined plugin', () => {
9090
})
9191

9292
it('should fail for bigint', () => {
93-
const result = v.undefined_().execute(123n)
93+
const result = v.undefined().execute(123n)
9494
expect(result).toEqual({
9595
issues: [{
9696
code: 'undefined:expected_undefined',
@@ -102,7 +102,7 @@ describe('undefined plugin', () => {
102102

103103
it('should fail for symbol', () => {
104104
const sym = Symbol('test')
105-
const result = v.undefined_().execute(sym)
105+
const result = v.undefined().execute(sym)
106106
expect(result).toEqual({
107107
issues: [{
108108
code: 'undefined:expected_undefined',
@@ -115,7 +115,7 @@ describe('undefined plugin', () => {
115115

116116
describe('custom messages', () => {
117117
it('should use custom message for invalid input', () => {
118-
const result = v.undefined_('Custom error message').execute(42)
118+
const result = v.undefined('Custom error message').execute(42)
119119
expect(result).toEqual({
120120
issues: [{
121121
code: 'undefined:expected_undefined',
@@ -128,14 +128,14 @@ describe('undefined plugin', () => {
128128

129129
describe('chaining', () => {
130130
it('should chain with check', () => {
131-
const result = v.undefined_()
131+
const result = v.undefined()
132132
.check(u => u === undefined)
133133
.execute(undefined)
134134
expect(result).toEqual({ value: undefined })
135135
})
136136

137137
it('should fail chaining with check', () => {
138-
const result = v.undefined_()
138+
const result = v.undefined()
139139
.check(u => u !== undefined)
140140
.execute(undefined)
141141
expect(result).toEqual({

packages/internal/src/steps/undefined_/undefined_.ts renamed to packages/internal/src/steps/undefined/undefined.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface PluginDef extends TStepPluginDef {
2929
* ### Issues:
3030
* - `'undefined:expected_undefined'`: The value is not undefined.
3131
*/
32-
undefined_: DefineStepMethod<
32+
undefined: DefineStepMethod<
3333
Meta,
3434
this['This'] extends Meta['ExpectedThis']
3535
? IsExactlyAnyOrUnknown<InferOutput<this['This']>> extends true
@@ -47,7 +47,7 @@ interface PluginDef extends TStepPluginDef {
4747

4848
/* @__NO_SIDE_EFFECTS__ */
4949
export const undefined_ = implStepPlugin<PluginDef>({
50-
undefined_: ({
50+
undefined: ({
5151
utils: { addSuccessStep, success, resolveMessage, failure },
5252
params: [message],
5353
}) => {

packages/internal/src/steps/undefined_/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)