Skip to content

Commit 501bae5

Browse files
committed
Removed dependency on lodash
1 parent 1dff856 commit 501bae5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { isPlainObject } = require("lodash");
21

32
const MATH_LOG_2 = Math.log(2);
43
/**
@@ -9,6 +8,10 @@ const CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+
98
const DEFAULT_TOLERANCE = 4;
109
const DEFAULT_ADDTIONAL_REGEXES = {};
1110

11+
function isPlainObject(obj) {
12+
return typeof obj === 'object' && obj.constructor === Object;
13+
}
14+
1215
function checkOptions({ tolerance, additionalRegexes }) {
1316
tolerance = tolerance || DEFAULT_TOLERANCE;
1417
if (typeof tolerance !== "number" || tolerance <= 0) {
@@ -18,6 +21,7 @@ function checkOptions({ tolerance, additionalRegexes }) {
1821
if (!isPlainObject(additionalRegexes)) {
1922
throw new Error("Expected additionalRegexes to be a plain object");
2023
}
24+
2125
const compiledRegexes = {};
2226
for (const regexName in additionalRegexes) {
2327
if (additionalRegexes.hasOwnProperty(regexName)) {

0 commit comments

Comments
 (0)