@corefunc/corefunc
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,4 +0,4 @@ | ||
import fnIsArray from "lodash-es/isArray"; | ||
import fnIsRegExp from "lodash-es/isRegExp"; | ||
import fnIsString from "lodash-es/isString"; | ||
import isArray from "../is/isArray"; | ||
import isRegExp from "../is/isRegExp"; | ||
import isString from "../is/isString"; | ||
@@ -9,14 +9,14 @@ /** | ||
*/ | ||
function toRegExp(pattern) { | ||
if (fnIsRegExp(pattern)) { | ||
export default function toRegExp(pattern): boolean | RegExp { | ||
if (isRegExp(pattern)) { | ||
return pattern; | ||
} | ||
if (fnIsString(pattern)) { | ||
if (isString(pattern)) { | ||
return new RegExp(pattern); | ||
} | ||
if (fnIsArray(pattern)) { | ||
if (fnIsString(pattern[0]) === false) { | ||
if (isArray(pattern)) { | ||
if (isString(pattern[0]) === false) { | ||
return false; | ||
} | ||
if (fnIsString(pattern[1]) === true) { | ||
if (isString(pattern[1]) === true) { | ||
return new RegExp(pattern[0], pattern[1]); | ||
@@ -28,3 +28,1 @@ } | ||
} | ||
export default toRegExp; |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
export default function toString(value): string { | ||
export default function toString(value: any): string { | ||
if (value === null || value === undefined) { | ||
@@ -8,0 +8,0 @@ return ""; |
@@ -1,5 +0,3 @@ | ||
function isArray(value) { | ||
export default function isArray(value: any): boolean { | ||
return Array.isArray(value); | ||
} | ||
export default isArray; |
@@ -67,3 +67,3 @@ { | ||
}, | ||
"version": "0.0.8" | ||
"version": "0.0.9" | ||
} |
@@ -5,3 +5,3 @@ # CoreFunc | ||
## Recommended usage for Three Shaking | ||
## Recommended usage for Tree Shaking | ||
@@ -8,0 +8,0 @@ ```javascript |
79373
198
2706