Use is instead of Lodash is*

This commit is contained in:
Daniel Gasienica 2018-04-09 18:38:44 -04:00
parent 4852a9dee0
commit 6a63e427c8

View file

@ -1,4 +1,4 @@
const { isFunction, isString } = require('lodash'); const is = require('@sindresorhus/is');
const MIME = require('./mime'); const MIME = require('./mime');
const { arrayBufferToBlob, blobToArrayBuffer, dataURLToBlob } = require('blob-util'); const { arrayBufferToBlob, blobToArrayBuffer, dataURLToBlob } = require('blob-util');
@ -76,7 +76,7 @@ const INVALID_CHARACTERS_PATTERN = new RegExp(
// which currently doesnt support async testing: // which currently doesnt support async testing:
// https://github.com/leebyron/testcheck-js/issues/45 // https://github.com/leebyron/testcheck-js/issues/45
exports._replaceUnicodeOrderOverridesSync = (attachment) => { exports._replaceUnicodeOrderOverridesSync = (attachment) => {
if (!isString(attachment.fileName)) { if (!is.string(attachment.fileName)) {
return attachment; return attachment;
} }
@ -115,7 +115,7 @@ exports.hasData = attachment =>
// Attachment -> // Attachment ->
// IO (Promise Attachment) // IO (Promise Attachment)
exports.loadData = (readAttachmentData) => { exports.loadData = (readAttachmentData) => {
if (!isFunction(readAttachmentData)) { if (!is.function(readAttachmentData)) {
throw new TypeError("'readAttachmentData' must be a function"); throw new TypeError("'readAttachmentData' must be a function");
} }
@ -129,7 +129,7 @@ exports.loadData = (readAttachmentData) => {
return attachment; return attachment;
} }
if (!isString(attachment.path)) { if (!is.string(attachment.path)) {
throw new TypeError("'attachment.path' is required"); throw new TypeError("'attachment.path' is required");
} }
@ -142,7 +142,7 @@ exports.loadData = (readAttachmentData) => {
// Attachment -> // Attachment ->
// IO Unit // IO Unit
exports.deleteData = (deleteAttachmentData) => { exports.deleteData = (deleteAttachmentData) => {
if (!isFunction(deleteAttachmentData)) { if (!is.function(deleteAttachmentData)) {
throw new TypeError("'deleteAttachmentData' must be a function"); throw new TypeError("'deleteAttachmentData' must be a function");
} }
@ -156,7 +156,7 @@ exports.deleteData = (deleteAttachmentData) => {
return; return;
} }
if (!isString(attachment.path)) { if (!is.string(attachment.path)) {
throw new TypeError("'attachment.path' is required"); throw new TypeError("'attachment.path' is required");
} }