# construct-new

> Like the new operator, but a function.

Latest version **2.0.11** (published 2026-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install construct-new
pnpm add construct-new
yarn add construct-new
bun add construct-new
```

## Health

**Score 50/100 (C)** — status: active.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.11 |
| Published | 2026-05-13 |
| First published | 2024-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 17 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | tj-commits |
| Maintainers | tj-commits |
| Keywords | instance, of, intrinsic, get, cache, ecmascript, javascript, is |

## Links

- npm: https://www.npmjs.com/package/construct-new
- Repository: https://github.com/10xEngineersQualityProgramming/construct-new
- Homepage: https://github.com/10xEngineersQualityProgramming/construct-new#readme
- Issues: https://github.com/10xEngineersQualityProgramming/construct-new/issues
- npm.io page: https://npm.io/package/construct-new

## Dependencies (17)

- [noop6](https://npm.io/package/noop6.md) ^1.0.9
- [is-nil](https://npm.io/package/is-nil.md) ^1.0.1
- [isarray](https://npm.io/package/isarray.md) ^2.0.5
- [is-es2015](https://npm.io/package/is-es2015.md) ^0.1.6
- [true-value](https://npm.io/package/true-value.md) ^3.0.3
- [is-function](https://npm.io/package/is-function.md) ^1.0.2
- [is-arguments](https://npm.io/package/is-arguments.md) ^1.1.1
- [node-call.next](https://npm.io/package/node-call.next.md) ^1.0.1
- [immediate-error](https://npm.io/package/immediate-error.md) 6.4.2
- [is-constructable](https://npm.io/package/is-constructable.md) ^1.0.0
- [lodash.stubarray](https://npm.io/package/lodash.stubarray.md) ^4.13.0
- [identity-function](https://npm.io/package/identity-function.md) ^1.0.0
- [es-intrinsic-cache](https://npm.io/package/es-intrinsic-cache.md) ^1.0.4
- [@10xly/strict-equals](https://npm.io/package/@10xly/strict-equals.md) 1.0.0
- [construct-new-second](https://npm.io/package/construct-new-second.md) ^1.0.1
- [es-logical-and-operator](https://npm.io/package/es-logical-and-operator.md) ^1.0.0
- [es-logical-not-operator](https://npm.io/package/es-logical-not-operator.md) ^1.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.11 (latest) — 2026-05-13
- 2.0.10 — 2026-03-12
- 2.0.9 — 2026-02-20
- 2.0.8 — 2026-02-19
- 2.0.7 — 2026-02-19
- 2.0.6 — 2026-02-19
- 2.0.5 — 2026-01-18
- 2.0.4 — 2025-12-24
- 2.0.3 — 2025-12-14
- 2.0.2 — 2025-12-14
- 2.0.1 — 2025-12-14
- 1.1.0 — 2025-12-05
- 1.0.1 — 2024-09-21
- 1.0.0 — 2024-09-21

## README

# construct-new
Like the new operator, but as a function for convenience and familiarity.

## Usage
What you would normally do:
```js
class Foo {
  constructor(name) {
    this.name = name
  }
  print() {
    console.log("Hi, I am " + this.name)
  }
}
const myFoo = new Foo("bar")
myFoo.print() // output: Hi, I am bar
```
What you would do with this:
```js
const construct = require('construct-new')
class Foo {
  constructor(name) {
    this.name = name
  }
  print() {
    console.log("Hi, I am " + this.name)
  }
}
const myFoo = construct({
  target: Foo,
  args: ["bar"]
})

myFoo.print() // Hi, I am bar
```
or
```js
construct({
  target: Foo,
  args: ["bar"],
  callback: (myFoo) => {
    myFoo.print() // Hi, I am bar
  }
})
```

If the class doesn't take any arguments, you don't have to pass in the args property, it will still work like the args is an empty array.

---
_Source: https://npm.io/package/construct-new · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
