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 🙏

© 2026 – Pkg Stats / Ryan Hefner

isotropic-create

v0.13.1

Published

Creates an object with a specific constructor function and prototype object

Downloads

74

Readme

isotropic-create

npm version License

A utility that creates an object with a specific constructor function and prototype object.

Why Use This?

  • Safer Object Creation: Avoids issues that can occur when forgetting the new keyword
  • Familiar Semantics: Retains the constructor property you'd expect from new
  • Explicit Prototypes: Clearly specifies the prototype object for better code readability
  • Controlled Inheritance: Provides a cleaner approach to prototypal inheritance

Really though, for most use cases it's better not to directly use isotropic-create. Use isotropic-make instead!

Installation

npm install isotropic-create

Usage

import _create from 'isotropic-create';

// Define a constructor function
const _Person = (name, age) => {
    const instance = _create(_Person, _Person.prototype);

    instance.name = name;
    instance.age = age;

    return instance;
};

// Define methods on the prototype
_Person.prototype.greet = function () {
    return `Hello, my name is ${this.name}`;
};

{
    // Create an instance without using 'new'
    const john = _Person('John', 30);

    console.log(john.greet()); // "Hello, my name is John"
    console.log(john.constructor === _Person); // true
    console.log(Object.getPrototypeOf(john) === _Person.prototype); // true
}

How It Works

isotropic-create uses Object.create() to create a new object with the specified prototype and then adds the constructor property with the right settings. This approach:

  1. Avoids the issues that can occur when forgetting the new keyword
  2. Explicitly sets the prototype chain
  3. Adds the constructor property (non-enumerable) pointing to the constructor function

It's important to note that isotropic-create creates the instance object but does not call the constructor function! A useful pattern is to use it within a constructor function and then return the instance.

API

create(constructorFunction, prototypeObject)

Returns a new object with prototypeObject as its prototype and a constructor property that points to constructorFunction.

Parameters

  • constructorFunction (Function): The constructor function to assign to the object
  • prototypeObject (Object): The prototype object to use

Returns

  • (Object): A new object with the specified prototype and constructor

Contributing

Please refer to CONTRIBUTING.md for contribution guidelines.

Issues

If you encounter any issues, please file them at https://github.com/ibi-group/isotropic-create/issues