@specialblend/is-constructable

0.0.1 • Public • Published

is-constructable

check if provided function is constructable (can be called with new keyword)

install

npm i @specialblend/is-constructable

example

import isConstructable from '@specialblend/is-constructable'

isConstructable('foo') // false
isConstructable(true) // false
isConstructable(false) // false
isConstructable(null) // false
isConstructable(undefined) // false
isConstructable(Symbol('foo')) // false
isConstructable(function *generatorFoo() {}) // false

isConstructable(Boolean) // true
isConstructable(Number) // true
isConstructable(String) // true
isConstructable(Array) // true
isConstructable(Object) // true
isConstructable(Promise) // true
isConstructable(class Foo {}) // true
isConstructable(function foo() {}) // true

Dependencies (0)

    Dev Dependencies (14)

    Package Sidebar

    Install

    npm i @specialblend/is-constructable

    Weekly Downloads

    1

    Version

    0.0.1

    License

    ISC

    Unpacked Size

    3.17 kB

    Total Files

    5

    Last publish

    Collaborators

    • __specialblend__