Skip to content

isClass

Determine if a value was declared with `class` syntax

148 bytes

Usage

This function returns true if the provided value is a constructor declared with the ES6 class keyword.

import * as _ from 'radashi'
class MyClass {}
function OldSchoolClass() {
this.foo = 'bar'
}
_.isClass(MyClass) // => true
_.isClass(Error) // => false
_.isClass(OldSchoolClass) // => false
_.isClass('abc') // => false
_.isClass({}) // => false
_.isClass(undefined) // => false