New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wadofgum

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wadofgum

simple highly extensible es6 models

  • 5.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

wadofgum Build Status

A super minimal and highly extensible modeling library. Wadofgum models use pure functions to work with the state of an object.

Wadofgum by itself doesn't do much, but with extensions, it can manage the state of an object with schemas, processors, etc.

Usage

The basic form of wadofgum is essentially just an object with a few additions to simplify using it as the base for a more robust modeling system.

const Wadofgum = require('wadofgum');

const Model = new Wadofgum();
Capabilities

The base class and all classes derived from it contain a capabilities property, which is a Set containing the names of capabilities that have been added to your class. By default, this set is empty. It is intended to be added to when loading a mixin.

For example:

const Wadofgum = require('wadofgum');
Wadofgum.capabilities.add('my_cap');

Mixins

A mixin is simply a function that accepts a base class as a parameter, performs some manipulation of it, and returns a new class:

const Wadofgum = require('wadofgum');

let myMixin = function (baseClass) {
  class myModel extends baseClass {
    static myMethod() {
      console.log('called myMethod');
    };
  }

  myModel.capabilities.add('myMethod');

  return myModel;
};

class Model extends Wadofgum.mixin(myMixin) {};
Model.myMethod(); // 'called myMethod'
Model.capabilities.has('myMethod'); // true

Note: extensions that want to process their options should add a getter and setter for them, and set the value in .meta.

Keywords

FAQs

Package last updated on 17 Feb 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc