1.1.1 • Published 10 months ago

is-constructor v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
10 months ago

is-constructor

CI

This utility function determines whether a given value is a constructor function. It performs a series of checks to accurately identify constructors, including class constructors and legacy function constructors.

Key features:

  • Accurately identifies both modern class constructors and legacy function constructors
  • Handles edge cases and corner cases
  • Written in TypeScript with full type support
  • Lightweight with no dependencies

While the current implementation is robust, I'm always open to suggestions for improvements or optimizations. If you have ideas on how to enhance the accuracy or performance of the checks, please feel free to submit a pull request or open an issue for discussion.

Usage

ES5/NodeJS:

var isConstructor = require("is-constructor");

isConstructor(/* your thing to test */);

ES6/TypeScript:

import * as isConstructor from "is-constructor";

isConstructor(/* your thing to test */);
1.1.1

10 months ago

1.1.0

10 months ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago