Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@haventech/supertype
Advanced tools
A type system for classical inheritence, mix-ins and composition.
SuperType is a type system for JavaScript that supports:
Classical inheritence
Mixins
Composition including collections
Include lib/index.js
for use in the browser. Install on node via npm:
npm install supertype
It is automatically installed as a dependency for Amorphic
Classes are defined as "templates".
ObjectTemplate = require('supertype');
Animal = ObjectTemplate.create("Animal",
{
name: {type: String},
isMammal: {type: Boolean, value: true},
legs: {type: Number, value: 2}
});
Lion = Animal.extend("Lion",
{
init: function () {
Animal.call(this);
this.name = "Lion";
this.legs = 4;
},
canRoar: function () {return true}
});
Bear = Animal.extend("Bear",
{
init: function () {
Animal.call(this);
this.name = "Bear";
},
canHug: function () {return true}
});
Ark = ObjectTemplate.create("Ark",
{
animals: {type: Array, of: Animal, value: []},
board: function (animal) {
animal.ark = this;
this.animals.push(animal)
}
});
Animal.mixin(
{
ark: {type: Ark}
});
You create objects using new
:
var ark1 = new Ark();
ark1.board(new Lion());
ark1.board(new Bear());
var ark2 = new Ark();
ark2.board(new Lion());
ark2.board(new Bear());
Because SuperType knows about the interrelationships between your objects you can serialize and de-serialize even though you have circular references:
var serialArk1 = ark1.toJSONString();
var serialArk2 = ark2.toJSONString();
ark1 = Ark.fromJSON(serialArk1);
ark2 = Ark.fromJSON(serialArk2);
SuperType is licensed under the MIT license
FAQs
A type system for classical inheritence, mix-ins and composition.
The npm package @haventech/supertype receives a total of 21 weekly downloads. As such, @haventech/supertype popularity was classified as not popular.
We found that @haventech/supertype demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.