File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1
- const { isPlainObject } = require ( "lodash" ) ;
2
1
3
2
const MATH_LOG_2 = Math . log ( 2 ) ;
4
3
/**
@@ -9,6 +8,10 @@ const CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+
9
8
const DEFAULT_TOLERANCE = 4 ;
10
9
const DEFAULT_ADDTIONAL_REGEXES = { } ;
11
10
11
+ function isPlainObject ( obj ) {
12
+ return typeof obj === 'object' && obj . constructor === Object ;
13
+ }
14
+
12
15
function checkOptions ( { tolerance, additionalRegexes } ) {
13
16
tolerance = tolerance || DEFAULT_TOLERANCE ;
14
17
if ( typeof tolerance !== "number" || tolerance <= 0 ) {
@@ -18,6 +21,7 @@ function checkOptions({ tolerance, additionalRegexes }) {
18
21
if ( ! isPlainObject ( additionalRegexes ) ) {
19
22
throw new Error ( "Expected additionalRegexes to be a plain object" ) ;
20
23
}
24
+
21
25
const compiledRegexes = { } ;
22
26
for ( const regexName in additionalRegexes ) {
23
27
if ( additionalRegexes . hasOwnProperty ( regexName ) ) {
You can’t perform that action at this time.
0 commit comments