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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wwl-js-mixin-chain

v0.1.0

Published

| Master | Develop | |--------|---------| | [![Build Status](https://travis-ci.org/wonderweblabs/wwl-js-mixin-chain.svg?branch=master)](https://travis-ci.org/wonderweblabs/wwl-js-mixin-chain) | [![Build Status](https://travis-ci.org/wonderweblabs/wwl-js-m

Downloads

12

Readme

WWL JS Mixin Chain

| Master | Develop | |--------|---------| | Build Status | Build Status |


The mixin chain allows to include prototypes with an undefined parent class into your classes structure.

So you can append prototypes with mixin like code by using the ext function of the mixin chain.

Mixin prototypes needs to be encapsuled inside a function getting the super class as parameter.

Example

Let's assume, we've got the following super class:


class SuperClass
  attribute1: 1
  attribute2: 2
  attribute3: 3
  getValue1: -> 1
  getValue2: -> 2
  getValue3: -> 3
  getValue4: -> 4
  @getStaticValue1: -> 1
  @getStaticValue2: -> 2
  @getStaticValue3: -> 3
  @getStaticValue4: -> 4

And then, we implemented the following mixins which are overwriting some attributes, instance functions and class functions:


MixinA = (superclass) -> class MA extends superclass
  attribute1: 10
  attribute3: 30
  getValue1: -> super() + 10
  getValue4: -> 'MixinA'
  @getStaticValue1: -> super() + 10
  @getStaticValue4: -> 'MixinA'

MixinB = (superclass) -> class MB extends superclass
  attribute2: 200
  attribute3: 300
  getValue1: -> super() + 100
  getValue2: -> super() + 100
  getValue4: -> 'MixinB'
  @getStaticValue1: -> super() + 100
  @getStaticValue2: -> super() + 100
  @getStaticValue4: -> 'MixinB'

Inherit SuperClass only

ext = require('wwl-js-mixin-chain')

class T extends ext(SuperClass).with()
t = new T()

t.attribute1          # 1
t.attribute2          # 2
t.attribute3          # 3
t.getValue1()         # 1
t.getValue2()         # 2
t.getValue3()         # 3
t.getValue4()         # 4
T.getStaticValue1()   # 1
T.getStaticValue2()   # 2
T.getStaticValue3()   # 3
T.getStaticValue4()   # 4

Inherit SuperClass with MixinA

ext = require('wwl-js-mixin-chain')

class T extends ext(SuperClass).with(MixinA)
t = new T()

t.attribute1          # 10
t.attribute2          # 2
t.attribute3          # 30
t.getValue1()         # 11
t.getValue2()         # 2
t.getValue3()         # 3
t.getValue4()         # 'MixinA'
T.getStaticValue1()   # 11
T.getStaticValue2()   # 2
T.getStaticValue3()   # 3
T.getStaticValue4()   # 'MixinA'

Inherit SuperClass with MixinB

ext = require('wwl-js-mixin-chain')

class T extends ext(SuperClass).with(MixinB)
t = new T()

t.attribute1          # 1
t.attribute2          # 200
t.attribute3          # 300
t.getValue1()         # 101
t.getValue2()         # 102
t.getValue3()         # 3
t.getValue4()         # 'MixinB'
T.getStaticValue1()   # 101
T.getStaticValue2()   # 102
T.getStaticValue3()   # 3
T.getStaticValue4()   # 'MixinB'

Inherit SuperClass with MixinA and MixinB

ext = require('wwl-js-mixin-chain')

class T extends ext(SuperClass).with(MixinA, MixinB)
t = new T()

t.attribute1          # 10
t.attribute2          # 200
t.attribute3          # 300
t.getValue1()         # 111
t.getValue2()         # 102
t.getValue3()         # 3
t.getValue4()         # 'MixinB'
T.getStaticValue1()   # 111
T.getStaticValue2()   # 102
T.getStaticValue3()   # 3
T.getStaticValue4()   # 'MixinB'

Inherit SuperClass with MixinB and MixinA

ext = require('wwl-js-mixin-chain')

class T extends ext(SuperClass).with(MixinB, MixinA)
t = new T()

t.attribute1          # 10
t.attribute2          # 200
t.attribute3          # 30
t.getValue1()         # 111
t.getValue2()         # 102
t.getValue3()         # 3
t.getValue4()         # 'MixinA'
T.getStaticValue1()   # 111
T.getStaticValue2()   # 102
T.getStaticValue3()   # 3
T.getStaticValue4()   # 'MixinA'