File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed
packages/rich-text-types/src/validator Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 1
1
import isPlainObject from 'is-plain-obj' ;
2
+
3
+ import { ValidationError } from '.' ;
2
4
import {
3
5
maxSizeError ,
4
6
typeMismatchError ,
@@ -8,8 +10,6 @@ import {
8
10
minSizeError ,
9
11
} from './errors' ;
10
12
import type { Path } from './path' ;
11
- import { uniqWith } from 'lodash' ;
12
- import { ValidationError } from '.' ;
13
13
14
14
export class ObjectAssertion {
15
15
private _errors : ValidationError [ ] = [ ] ;
@@ -30,9 +30,10 @@ export class ObjectAssertion {
30
30
path : error . path ,
31
31
} ) ;
32
32
33
- return uniqWith ( this . _errors , ( a , b ) => {
34
- return serializeError ( a ) === serializeError ( b ) ;
35
- } ) ;
33
+ return this . _errors . filter (
34
+ ( error , index ) =>
35
+ this . _errors . findIndex ( ( step ) => serializeError ( error ) === serializeError ( step ) ) === index ,
36
+ ) ;
36
37
}
37
38
38
39
/**
Original file line number Diff line number Diff line change 1
- import type { Path } from './path' ;
2
- import { ObjectAssertion } from './assert' ;
3
1
import { ValidationError } from '.' ;
4
2
import {
5
3
AssetHyperlink ,
@@ -11,6 +9,8 @@ import {
11
9
ResourceLinkInline ,
12
10
} from '../nodeTypes' ;
13
11
import { Block , Document , Inline } from '../types' ;
12
+ import { ObjectAssertion } from './assert' ;
13
+ import type { Path } from './path' ;
14
14
15
15
export type Node = Document | Block | Inline ;
16
16
Original file line number Diff line number Diff line change 1
- import type { Path } from './path' ;
2
- import { ObjectAssertion } from './assert' ;
3
1
import { ValidationError } from '.' ;
4
2
import { Text } from '../types' ;
3
+ import { ObjectAssertion } from './assert' ;
4
+ import type { Path } from './path' ;
5
5
6
6
export function assertText ( text : Text , path : Path ) : ValidationError [ ] {
7
7
const $ = new ObjectAssertion ( text , path ) ;
You can’t perform that action at this time.
0 commit comments