Skip to content

检测是否为原始值

js
function isPrimitive(value) {
  return value === null || (typeof value !== 'object' && typeof value !== 'function')
}