isPrimitiveType function
const isBoolean = (variable) => typeof variable === 'boolean'
const isString = (variable) => typeof variable === 'string'
const isNumber = (variable) => typeof variable === 'number'
const isUndefined = (variable) => typeof variable === 'undefined'
// typeof null === 'object' due to historical reason
const isNull = (variable) => variable === null
const isSymbol = (variable) => typeof variable === 'symbol'
const isBigint = (variable) => typeof variable === 'bigint'
Example
isBoolean(true) // true
isString('str') // true
isNumber(666) // true
isUndefined(undefined) // true
isSymbol(Symbol('foo')) // true
isBigint(9007199254740991n) // true
isNull(null) // true