GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - nathan7/new-operator: the new operator as a function

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
.jshintrc
.jshintrc
 
 
README.md
README.md
 
 
Readme.md
Readme.md
 
 
component.json
component.json
 
 
index.js
index.js
 
 
package.json
package.json
 
 

Repository files navigation

new-operator

the new operator as a function

Rationale

This new inherits the first-class nature of functions, allowing you to do a couple of cool things that you never could with new. That also gets you .apply(), even for native constructors.

Reflect.construct

ES2016 (aka ES6) provides Reflect.construct, which works similarly. We fall back to it for cases with over 20 arguments if available.

Installation

npm install new-operator

API

var new_ = require('new-operator')

new_.call(constructor, …arguments)

new_.apply(constructor, arguments)

new_.bind(constructor, …arguments)

About

the new operator as a function

Resources

Readme
Activity
Custom properties

Stars

6 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.