File tree 3 files changed +166
-236
lines changed
3 files changed +166
-236
lines changed Original file line number Diff line number Diff line change 1
1
import { useRef , useEffect } from 'react' ;
2
2
import * as d3 from 'd3' ;
3
3
// @ts -ignore-error
4
- // import { debugPrint } from '@iter-tools/regex/internal/debug';
5
-
6
- const _debugPrint = ( matcher : any , sentinel : any ) : string | null => {
7
- if ( matcher === null ) return null ;
8
-
9
- let m = matcher ;
10
- let str = '' ;
11
- while ( m !== null ) {
12
- if ( typeof matcher . match !== 'function' ) {
13
- throw new Error ( 'debugPrint can only print matchers.' ) ;
14
- }
15
-
16
- switch ( m . name ) {
17
- case 'literal' :
18
- str += m . value ;
19
- break ;
20
- case 'boundaryAssertion' :
21
- str += '\\b' ;
22
- break ;
23
- case 'edgeAssertion' :
24
- str += m . kind === 'start' ? '^' : '$' ;
25
- break ;
26
- case 'expression' :
27
- str += `(${ m . matchers . map ( ( m : any ) => _debugPrint ( m , sentinel ) ) . join ( '|' ) } )` ;
28
- break ;
29
- case 'repeat' :
30
- if ( m . repeatCont . name !== 'unmatched' ) {
31
- str += `(${ m . exprCont . seqs
32
- . map ( ( m : any ) => _debugPrint ( m , m . next ) )
33
- . filter ( Boolean )
34
- . join ( '|' ) } )*`;
35
- }
36
- break ;
37
- default :
38
- break ;
39
- }
40
-
41
- if ( m . next === sentinel ) {
42
- return str === '' ? null : str ;
43
- } else {
44
- m = m . next ;
45
- }
46
- }
47
- return str ;
48
- } ;
49
-
50
- const debugPrint = ( matcher : any ) => _debugPrint ( matcher , null ) ;
4
+ import { debugPrint } from '@iter-tools/regex/internal/debug' ;
51
5
52
6
export const useD3 = ( render , dependencies ) => {
53
7
const ref = useRef ( null ) ;
Original file line number Diff line number Diff line change 9
9
"lint" : " next lint"
10
10
},
11
11
"dependencies" : {
12
- "@iter-tools/regex" : " iter-tools/regex#1c641e479857d0d33020629c16953297c4a277b2 " ,
12
+ "@iter-tools/regex" : " iter-tools/regex#9bab6c40e70141252bac88aae8ecf1debb51c37a " ,
13
13
"d3" : " ^7.4.2" ,
14
14
"grommet" : " ^2.17.2" ,
15
15
"grommet-icons" : " ^4.5.0" ,
You can’t perform that action at this time.
0 commit comments