swiss-knife-utils
v0.0.2
Published
My must-have utils and type guards
Downloads
3
Maintainers
Readme
swiss-knife-utils
My must-have utils and type guards
Installation
yarn add swiss-knife-utils
or
npm install swiss-knife-utils
Usage
import { isFunction, isNil, isHTMLElement, getWindowFromElement } from 'swiss-knife-utils'
function handleOnClick(cb) {
return (event) => {
if (isNil(event)) {
return
}
if (isFunction(cb)) {
cb(event)
}
if (isHTMLElement(event.target)) {
const domWindow = getWindowFromElement(event.target)
}
}
}
Utils
Logic
- isArray
- isBoolean
- isEmptyArray
- isEmptyString
- isFunction
- isHTMLElement
- isNil
- isNonEmptyArray
- isNonEmptyString
- isNumber
- isString
DOM
- getWindowFromElement