mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add isString and isObject type checks
This commit is contained in:
parent
bfda2bac84
commit
927fa001f9
2 changed files with 11 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import plist from 'plist'
|
import plist from 'plist'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
|
import { isString } from './type-checks.js'
|
||||||
import parseMacho from './macho/index.js'
|
import parseMacho from './macho/index.js'
|
||||||
|
|
||||||
const prettyBytes = require('pretty-bytes')
|
const prettyBytes = require('pretty-bytes')
|
||||||
|
|
@ -27,10 +28,6 @@ const knownAppExtensions = new Set([
|
||||||
'.app.zip'
|
'.app.zip'
|
||||||
])
|
])
|
||||||
|
|
||||||
function isString( maybeString ) {
|
|
||||||
return (typeof maybeString === 'string' || maybeString instanceof String)
|
|
||||||
}
|
|
||||||
|
|
||||||
function isValidHttpUrl( string ) {
|
function isValidHttpUrl( string ) {
|
||||||
if ( !isString( string ) ) return false
|
if ( !isString( string ) ) return false
|
||||||
|
|
||||||
|
|
|
||||||
10
helpers/type-checks.js
Normal file
10
helpers/type-checks.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export function isString( maybeString ) {
|
||||||
|
return (typeof maybeString === 'string' || maybeString instanceof String)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isObject( maybeObject ) {
|
||||||
|
return maybeObject === Object( maybeObject )
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue