Prefer is.*
over Lodash is*
functions
This commit is contained in:
parent
2ee78ec556
commit
f2c9ccae90
1 changed files with 6 additions and 9 deletions
|
@ -1,13 +1,10 @@
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
|
|
||||||
|
const is = require('@sindresorhus/is');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const {
|
|
||||||
escapeRegExp,
|
|
||||||
isRegExp,
|
|
||||||
isString,
|
|
||||||
} = require('lodash');
|
|
||||||
const { compose } = require('lodash/fp');
|
const { compose } = require('lodash/fp');
|
||||||
|
const { escapeRegExp } = require('lodash');
|
||||||
|
|
||||||
|
|
||||||
const PHONE_NUMBER_PATTERN = /\+\d{7,12}(\d{3})/g;
|
const PHONE_NUMBER_PATTERN = /\+\d{7,12}(\d{3})/g;
|
||||||
|
@ -28,7 +25,7 @@ const REDACTION_PLACEHOLDER = '[REDACTED]';
|
||||||
|
|
||||||
// redactPhoneNumbers :: String -> String
|
// redactPhoneNumbers :: String -> String
|
||||||
exports.redactPhoneNumbers = (text) => {
|
exports.redactPhoneNumbers = (text) => {
|
||||||
if (!isString(text)) {
|
if (!is.string(text)) {
|
||||||
throw new TypeError('"text" must be a string');
|
throw new TypeError('"text" must be a string');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +34,7 @@ exports.redactPhoneNumbers = (text) => {
|
||||||
|
|
||||||
// redactGroupIds :: String -> String
|
// redactGroupIds :: String -> String
|
||||||
exports.redactGroupIds = (text) => {
|
exports.redactGroupIds = (text) => {
|
||||||
if (!isString(text)) {
|
if (!is.string(text)) {
|
||||||
throw new TypeError('"text" must be a string');
|
throw new TypeError('"text" must be a string');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +47,11 @@ exports.redactGroupIds = (text) => {
|
||||||
|
|
||||||
// redactSensitivePaths :: String -> String
|
// redactSensitivePaths :: String -> String
|
||||||
exports.redactSensitivePaths = (text) => {
|
exports.redactSensitivePaths = (text) => {
|
||||||
if (!isString(text)) {
|
if (!is.string(text)) {
|
||||||
throw new TypeError('"text" must be a string');
|
throw new TypeError('"text" must be a string');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRegExp(APP_ROOT_PATH_PATTERN)) {
|
if (!is.regExp(APP_ROOT_PATH_PATTERN)) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue