npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

denew

v1.0.0

Published

never type new again!

Downloads

28

Readme

denew

Are you bothered by the new keyword?

Is its presence in code irksome?

Does reading it set off an internal monologue about how presumptuous this glorified factory function is, insisting its hallowed summoning be heralded with a claim of needing something heretofore unseen?

I thought so.

This module wraps the call to all native new-ables (like Array, Map, Set, etc in the browser, node, or a web worker) to internally do it for you so you never have to use the keyword again, and can invoke them like any other factory function.

so instead of

var s = new Set()

it can just be

var s = Set()

Except for classes, because you make those, and there's currently not way to globally proxy all class creation. Though if you don't like new you probably don't use classes. Also someone already made a thing for that.

Does this break invocations that already use new?

None that I've found so far:

require('denew')
var x=Set()
var y=new Set() //no error
var z=new Set   //no error
x.add(7)
y.add(6) //no error
z.add(5) //no error

var d=Date()
var e=new Date() //no error
var f=new Date   //no error
d.getTime //[Function: getTime]
e.getTime //[Function: getTime]
f.getTime //[Function: getTime]

//etc

Though...I guess if you're someone who says:

var x=new Date //without the (), which is valid but weird

you cannot now just say:

var x=Date

you still have to execute it:

var x=Date()