Skip to main content
Module

x/mixwithts/mod.ts

TypeScript compatible version of Justin Fagani's mixin library for ES6
Latest
import * as mixwithts from "https://deno.land/x/mixwithts@1.1.2/mod.ts";

Classes

MixinBuilder helper class (returned by mix()).

Variables

Applies mixin to superclass.

A basic mixin decorator that applies the mixin using the apply function so that it can be used with isApplicationOf, hasMixin, and other mixin decorator functions.

Decorates mixin so that it caches its applications. When applied multiple times to the same superclass, mixin will only create one subclass, memoize it and return it for each application.

Adds a Symbol.hasInstance implementation to the provided mixin object to enable the use of the instanceof operator with instances of classes that include the mixin.

Checks if the provided mixin has been applied to the given prototype object.

Returns true iff proto is a prototype created by the application of mixin to a superclass.

A fluent interface to apply a list of mixins to a superclass.

Decorates a mixin function to add deduplication, application caching, and instanceof support.

Unwraps the function wrapper to return the original function wrapped by one or more calls to wrap. Returns wrapper if it's not a wrapped function.

Sets up the function mixin to be wrapped by the function wrapper, while allowing properties on mixin to be available via wrapper, and allowing wrapper to be unwrapped to get to the original function.

Functions

Decorates mixin so that it only applies if it's not already on the prototype chain.