1
- import type { IClassGeneratorOptions , IClassGenerator } from './types'
2
1
import micromatch from 'micromatch'
3
2
import fs from 'fs'
4
3
import path from 'path'
@@ -79,27 +78,6 @@ export function getGroupedEntries<T>(
79
78
return groupedEntries as Record < 'css' | 'html' | 'js' | 'other' , [ string , T ] [ ] >
80
79
}
81
80
82
- export const acceptChars = 'abcdefghijklmnopqrstuvwxyz' . split ( '' )
83
-
84
- export function stripEscapeSequence ( words : string ) {
85
- return words . replace ( / \\ / g, '' )
86
- }
87
-
88
- export const validate = ( opts : IClassGeneratorOptions , classGenerator : IClassGenerator ) => {
89
- if ( ! opts . log ) return
90
- for ( const className in classGenerator . newClassMap ) {
91
- const c = classGenerator . newClassMap [ className ]
92
- if ( c . usedBy . length >= 1 ) {
93
- continue
94
- }
95
- if ( c . usedBy [ 0 ] . match ( / .+ \. c s s : * $ / ) ) {
96
- console . log ( `The class name '${ className } ' is not used: defined at ${ c . usedBy [ 0 ] } .` )
97
- } else {
98
- console . log ( `The class name '${ className } ' is not defined: used at ${ c . usedBy [ 0 ] } .` )
99
- }
100
- }
101
- }
102
-
103
81
export function isRegexp ( value : unknown ) {
104
82
return Object . prototype . toString . call ( value ) === '[object RegExp]'
105
83
}
@@ -108,33 +86,6 @@ export function isMap(value: unknown) {
108
86
return Object . prototype . toString . call ( value ) === '[object Map]'
109
87
}
110
88
111
- export function regExpTest ( arr : ( string | RegExp ) [ ] = [ ] , str : string ) {
112
- if ( Array . isArray ( arr ) ) {
113
- for ( let i = 0 ; i < arr . length ; i ++ ) {
114
- const item = arr [ i ]
115
- if ( typeof item === 'string' ) {
116
- if ( item === str ) {
117
- return true
118
- }
119
- } else if ( isRegexp ( item ) ) {
120
- item . lastIndex = 0
121
- if ( item . test ( str ) ) {
122
- return true
123
- }
124
- }
125
- }
126
- return false
127
- }
128
- throw new TypeError ( "paramater 'arr' should be a Array of Regexp | String !" )
129
- }
130
-
131
- export function escapeStringRegexp ( str : string ) {
132
- if ( typeof str !== 'string' ) {
133
- throw new TypeError ( 'Expected a string' )
134
- }
135
- return str . replace ( / [ | \\ { } ( ) [ \] ^ $ + * ? . ] / g, '\\$&' ) . replace ( / - / g, '\\x2d' )
136
- }
137
-
138
89
export function createGlobMatcher ( pattern : string | string [ ] | undefined , fallbackValue : boolean = false ) {
139
90
if ( typeof pattern === 'undefined' ) {
140
91
return function ( file : string ) {
0 commit comments