Skip to content

Commit

Permalink
object package
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoloza committed Nov 26, 2021
1 parent 2d2b2a5 commit 52905c0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/object/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict'

export const isObject = arg => {
if (arg === null) return false
return (typeof arg === 'object') && (arg.constructor === Object)
}

export const isString = arg => typeof arg === 'string'

export const isNumber = arg => typeof arg === 'number'

export const isFunction = arg => typeof arg === 'function'

export const isArray = arg => Array.isArray(arg)

export const isObjectLike = arg => {
if (arg === null) return false
return (typeof arg === 'object')
}

export const isDefined = arg => {
return isObject(arg) ||
isObjectLike(arg) ||
isString(arg) ||
isNumber(arg) ||
isFunction(arg) ||
isArray(arg) ||
isObjectLike(arg)
}

0 comments on commit 52905c0

Please sign in to comment.