🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@dozerg/no-new

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dozerg/no-new

Convert ES6 class constructor to normal function.

latest
Source
npmnpm
Version
0.0.9
Version published
Weekly downloads
10K
5.91%
Maintainers
1
Weekly downloads
 
Created
Source

No New

npm Downloads Build Status

Convert an ES6 class constructor to a normal function.

Install

npm i @dozerg/no-new

Usage

import noNew from '@dozerg/no-new';

class A {
  constructor(readonly i: number, readonly s: string) {}
}

const AA = noNew(A);

// Instead of calling new A(1, 'hello'), you can use:
const a = AA(1, 'hello');   // a is an object of class A

APIs

function noNew<T>(ctor: T): Function

Accept a class constructor, and return a function which will create an object of the class.

License

MIT © Zhao DAI daidodo@gmail.com

Keywords

new

FAQs

Package last updated on 31 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts