
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
isotropic-create
Advanced tools
Creates an object with a specific constructor function and prototype object
A utility that creates an object with a specific constructor function and prototype object.
new keywordconstructor property you'd expect from newReally though, for most use cases it's better not to directly use isotropic-create.
Use isotropic-make instead!
npm install isotropic-create
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
}
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:
new keywordIt'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.
Returns a new object with prototypeObject as its prototype and a constructor property that points to constructorFunction.
constructorFunction (Function): The constructor function to assign to the objectprototypeObject (Object): The prototype object to usePlease refer to CONTRIBUTING.md for contribution guidelines.
If you encounter any issues, please file them at https://github.com/ibi-group/isotropic-create/issues
FAQs
Creates an object with a specific constructor function and prototype object
The npm package isotropic-create receives a total of 9 weekly downloads. As such, isotropic-create popularity was classified as not popular.
We found that isotropic-create demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.