Add isString and isObject type checks

This commit is contained in:
Sam Carlton 2021-06-08 16:44:37 -05:00
parent bfda2bac84
commit 927fa001f9
2 changed files with 11 additions and 4 deletions

View file

@ -1,6 +1,7 @@
import plist from 'plist'
import axios from 'axios'
import { isString } from './type-checks.js'
import parseMacho from './macho/index.js'
const prettyBytes = require('pretty-bytes')
@ -27,10 +28,6 @@ const knownAppExtensions = new Set([
'.app.zip'
])
function isString( maybeString ) {
return (typeof maybeString === 'string' || maybeString instanceof String)
}
function isValidHttpUrl( string ) {
if ( !isString( string ) ) return false

10
helpers/type-checks.js Normal file
View file

@ -0,0 +1,10 @@
export function isString( maybeString ) {
return (typeof maybeString === 'string' || maybeString instanceof String)
}
export function isObject( maybeObject ) {
return maybeObject === Object( maybeObject )
}